Question & Answer: SQL Help!! Three part question: 1. List Top 10 customers by their names who ordered the most quantity and their country of origin. (double inner…..

SQL Help!!

Three part question:

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: SQL Help!! Three part question: 1. List Top 10 customers by their names who ordered the most quantity and their country of origin. (double inner…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
Order Essay

1. List Top 10 customers by their names who ordered the most quantity and their country of origin. (double inner join)

2. List top 5 customers of from Canada that placed the most orders (quantity). (double inner join)

3. Order top 20 customer from United States and China who placed the most order (Quantity) according to their order date from earliest to latest. Also, report the country of origin.

Photos of the database below:

Question & Answer: SQL Help!! Three part question: 1. List Top 10 customers by their names who ordered the most quantity and their country of origin. (double inner..... 1

Question & Answer: SQL Help!! Three part question: 1. List Top 10 customers by their names who ordered the most quantity and their country of origin. (double inner..... 2

Question & Answer: SQL Help!! Three part question: 1. List Top 10 customers by their names who ordered the most quantity and their country of origin. (double inner..... 3

Question & Answer: SQL Help!! Three part question: 1. List Top 10 customers by their names who ordered the most quantity and their country of origin. (double inner..... 4

Question & Answer: SQL Help!! Three part question: 1. List Top 10 customers by their names who ordered the most quantity and their country of origin. (double inner..... 5

Question & Answer: SQL Help!! Three part question: 1. List Top 10 customers by their names who ordered the most quantity and their country of origin. (double inner..... 6

Question & Answer: SQL Help!! Three part question: 1. List Top 10 customers by their names who ordered the most quantity and their country of origin. (double inner..... 7

Question & Answer: SQL Help!! Three part question: 1. List Top 10 customers by their names who ordered the most quantity and their country of origin. (double inner..... 8

Expert Answer

 1. Select c.c_name,sum(l.quantity) AS Sum_Quantity, n.n_name From customer c Inner Join Nation n on c.c_nationkey=n.n_nationkey Inner Join Orders on o.o_custkey=c.c_custkey Inner join lineitem l on l.orderkey=o.o_orderkey group by l.l_orderkey order by Sum_Quantity Desc Limit 10.

2.Select c.c_name,sum(l.quantity) AS Sum_Quantity, n.n_name From customer c Inner Join Nation n on c.c_nationkey=n.n_nationkey Inner Join Orders on o.o_custkey=c.c_custkey Inner join lineitem l on l.orderkey=o.o_orderkey where n.n_name=’Canada’ group by l.l_orderkey order by Sum_Quantity Desc Limit 5.

3.Select c.c_name,sum(l.quantity) AS Sum_Quantity, n.n_name From customer c Inner Join Nation n on c.c_nationkey=n.n_nationkey Inner Join Orders on o.o_custkey=c.c_custkey Inner join lineitem l on l.orderkey=o.o_orderkey where n.n_name in (‘United States’,’China’) group by l.l_orderkey order by Sum_Quantity Desc,o.o_orderdate Asc Limit 20.

Still stressed from student homework?
Get quality assistance from academic writers!