Question: Write a query that returns a row for each customer, a count of invoices for each customer, the total extended price of all invoices, the
Write a query that returns a row for each customer, a count
of invoices for each customer, the total extended price of all invoices,
the min value, and the max value of the invoice total.
To get the total value of an invoice, you have
to sum up the extended price value in the InvoiceLines table.
we use the Invoices, InvoiceLines, and Customers
tables. The first two tables join on the InvoiceID column. Customers joins
to Invoices on the CustomerID. Order the results by the
count of invoices (lDESC), then by the largest invoice (ASC).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
