- 1

What is the number of items placed for the 8th person on this list?

I have a set of data in tables consisting of ER diagrams and there are relationships between them and some of them Table of invoices and customers and asked me the following: Run Query: Show the number of orders placed by each customer (hint: this is found in the invoices table) and sort the result by the number of orders in descending order. Then What is the number of items placed for the 8th person on this list? Can anyone help me to write the code?

2nd Jul 2021, 5:02 PM
pasant Hussein
pasant Hussein - avatar
6 Réponses
0
Something Simple i hope you will orient SELECT c.CustomerID,c.CustomerName, COUNT(o.CustomerID) NumberOfOrders FROM Customers c JOIN Orders o ON o.CustomerID = c.CustomerID GROUP BY o.CustomerID ORDER BY NumberOfOrders DESC
3rd Jul 2021, 11:59 AM
Borislav Binev
Borislav Binev - avatar
0
And when you want only the 8th person from this generated list add this for end on previous query LIMIT 1 OFFSET 7
3rd Jul 2021, 12:06 PM
Borislav Binev
Borislav Binev - avatar
0
But i don't have a column called NumberOfOrdera So the main problem i don't know which column i should use for the number of orders
4th Jul 2021, 9:08 AM
pasant Hussein
pasant Hussein - avatar
0
PM me and give me the names of columns in table of customers and names of colums in table of invoices and then i will write you a completely finished query
4th Jul 2021, 5:32 PM
Borislav Binev
Borislav Binev - avatar
0
What is the mean of PM me ? Do You mean chatting you?
4th Jul 2021, 5:49 PM
pasant Hussein
pasant Hussein - avatar
0
Yes pm private message
4th Jul 2021, 8:59 PM
Borislav Binev
Borislav Binev - avatar