Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

K. Group customers by LastName and then by FirstName. L. Count the number of cus

ID: 3628844 • Letter: K

Question

K. Group customers by LastName and then by FirstName.

L. Count the number of customers having each combination of LastName and FirstName.

M. Show the FirstName and LastName of all customers who have had an order with TotalAmount greater than $ 100.00. Use a subquery. Present the results sorted by LastName in ascending order and then FirstName in descending order.

N. Show the FirstName and LastName of all customers who have had an order with TotalAmount greater than $ 100.00. Use a join. Present results sorted by LastName in ascending order and then FirstName in descending order.

O. Show the FirstName and LastName, of all customers who have had an order with an Item named ‘ Dress Shirt’. Use a subquery. Present results sorted by LastName in ascending order and then FirstName in descending order.

Explanation / Answer

K)select firstname from (select lastname from table_name group by lastname) group by firstname L)select count(*) from table_name where firstname(+)=lastname; M)select firstname,lastname from table_name where table_name.number in (select number from item_table_name) having sum(total_items)>100 order by lastname asc,firstname by desc; N)select firstname,lastname from table_name,item_table_name where table_name.number=item_table_name.number having sum(total_items)>100 order by lastname asc,firstname by desc; O)select firstname,lastname from table_name where table_name.number in (select number from item_table_name) AND item_table_name.item_name='Dress Shirt’ order by lastname asc,firstname by desc;