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

Develop SQL query to answer each question. In a WORD compatible document and for

ID: 3822323 • Letter: D

Question

Develop SQL query to answer each question. In a WORD compatible document and for each question: State my question Write the SQL query to answer the question Paste a section of the results from your query (copy from phpmyadmin display) Upload your completed assignment Contact Ran Xu or Faeze Brahman if you have questions. List the top 10 customers that placed the most orders (total quantity of orders, not $$)? List the top 10 customers by order value ($$) Which country is our biggest customer (by the total $$ of orders)? Each order is made up of several parts, and each part is produced by different suppliers. Which supplier provides the most parts? Which countries provided us the most supplies? List the total value ($$) of purchases by country.

Explanation / Answer

[1]


SELECT *
FROM ( SELECT customer_id,COUNT(*)
                 FROM   order
     GROUP BY customer_id
     ORDER BY COUNT(*) DESC
   ) a
WHERE rownum = 10;


[2]

SELECT *
FROM ( SELECT customer_id
                 FROM   order
     GROUP BY customer_id
     ORDER BY price DESC
   ) a
WHERE rownum = 10;


[3]

SELECT *
FROM ( SELECT customer_id,country_code ,COUNT(*)
                 FROM   order
     GROUP BY customer_id,country_code
     ORDER BY COUNT(*) DESC
   ) a
WHERE rownum = 1;


[4]

SELECT *
( SELECT suppliers_id,count(*)
FROM   suppliers_id
grouy by suppliers_id
order by count(*) DESC
) a
WHERE rownum = 1;

[1]

SELECT * FROM ( SELECT customer_id,COUNT(*) FROM placed GROUP BY cid ORDER BY COUNT(*) DESC ) a WHERE rownum = 1

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote