Question: 15. Provide an sql query for the following: a) Show contactfirstname, contact last name, state, and creditlimit for the customers with the highest credit limit
15. Provide an sql query for the following:
a) Show contactfirstname, contact last name, state, and creditlimit for the customers with the highest credit limit in each US state. Hint: Start with a query to find the highest creditlimit in each US state and then use it as a subquery to show the contact first/last name, state, and creditlimit.
b) Show city and number of customers for the top 3 and bottom 3 US cities with the highest and lowest number of customers. Hint: Write two queries to find the top 3 and bottom 3 US cities and their number of customers first. Combine the results of the two queries using a set operator to show all results.
c) Show total profit and grand total on orders placed by customers who are not assigned to a sales representative. Hint: Grand total is the sum of quantity multiplied by the unit price.
d). Show repid, first and last name for sales representatives who are not assigned to any customers.



salesrep Columns (5) repid repfirstname replastname phone i commission orderinfo Columns (14) id orderid i orderdate shipdate i shipmode customernumber i productid i category 1 subcategory productname unitprice i quantity discount profit customer Columns (13) i customernumber customername contactlastname i contactfirstname iphone addressline 1 i addressline2 city i state postal code country i salesrepemployeenumber creditlimit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
