Question: Lab 3-1/* Modify the following query to add a column that identifies theperformance of salespersons and contains the following feedbackbased on the number of orders

Lab 3-1/* Modify the following query to add a column that identifies theperformance of salespersons and contains the following feedbackbased on the number of orders processed by a salesperson:'Need to Work Hard' for the order count range 1-100'Fine' for the order count range of 101-300'Strong Performer' for the order count greater than 300Give the new column an alias to make the report more readable. */SELECTSalesPersonID,p.LastName,p.FirstName,COUNT(o.SalesOrderid)[Total Orders]FROMSales.SalesOrderHeader oJOINPerson.Person pONo.SalesPersonID =p.BusinessEntityIDGROUPBYo.SalesPersonID,p.LastName,p.FirstNameORDERBYp.LastName,p.FirstName;Lab 3-2/* Modify the following query to add a rank without gaps in theranking based on total orders in the descending order. Alsopartition by territory.*/SELECTo.TerritoryID,s.Name,year(o.OrderDate)Year,COUNT(o.SalesOrderid)[Total Orders]FROMSales.SalesTerritory s JOINSales.SalesOrderHeader oONs.TerritoryID =o.TerritoryIDGROUPBYo.TerritoryID,s.Name,year(o.OrderDate)ORDERBYo.TerritoryID;Lab 3-3/* Write a query that returns the male salesperson(s) who received the lowest bonus amount in Europe. Include the salesperson'sid and bonus amountin the returned data. Your solution must retrieve the tie if there is a tie. */

Lab 3-4/* Write a query to retrieve the most valuable customer of each year.The most valuable customer of a year is the customer who has made the most purchase for the year. Use the yearly sum of the TotalDue column in SalesOrderHeader as a customer's total purchase for a year. If there is a tie for the most valuable customer, your solution should retrieve it.Include the customer's id, total purchase, and total order count for the year. Display the total purchase in two decimal places.Sort the returned data by the year. */Lab 3-5/* Write a query to retrieve the dates in which there was at least one product sold but no product in redwas sold. Return the "date" and "total product quantity soldfor the date" columns. The order quantity can be found inSalesOrderDetail. Display only the date for a date.Sort the returned data by the"total product quantity sold for the date" column in desc. */

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!