This document contains the code for 3 stored procedures. The first procedure selects department names that have more than 10 employees. The second procedure alters the first to also select department names with more than 10 employees. The third procedure selects customer IDs that belong to the territory covered by salesperson Linda Mitchell based on matching the territory IDs.
This document contains the code for 3 stored procedures. The first procedure selects department names that have more than 10 employees. The second procedure alters the first to also select department names with more than 10 employees. The third procedure selects customer IDs that belong to the territory covered by salesperson Linda Mitchell based on matching the territory IDs.
This document contains the code for 3 stored procedures. The first procedure selects department names that have more than 10 employees. The second procedure alters the first to also select department names with more than 10 employees. The third procedure selects customer IDs that belong to the territory covered by salesperson Linda Mitchell based on matching the territory IDs.
as begin select d.Name from HumanResources.Department d where (select count(e.DepartmentID) from HumanResources.EmployeeDepartmentHistory e where e.DepartmentID= d.DepartmentID)>10 order by d.Name end go execute sp_EmpledosDepartamento go --mostrar los empleados que tienen cantidad de empleados mayor a 10. alter procedure sp_empleadoDepartamento as SELECT d.Name FROM HumanResources.Department d WHERE (SELECT COUNT(e.DepartmentID) FROM HumanResources.EmployeeDepartmentHistory e WHERE e.DepartmentID=d.DepartmentID)>10 order by d.Name go execute sp_empleadoDepartamento go --mostrar, si se supone que cada vendedor solo cubre un territorio de ventas --los cliente del territorio que cubre linda mitchell. create procedure sp_ClientesVendedor as begin SELECT CustomerID FROM Sales.Customer C WHERE C.TerritoryID=(SELECT S.TerritoryID FROM Sales.SalesPerson S WHERE S.BusinessEntityID=276) order by CustomerID end go execute sp_ClientesVendedor go