Write SQL code that could be used from these five tables below 10. List the part
ID: 3698755 • Letter: W
Question
Write SQL code that could be used from these five tables below10. List the part description of the part with the most units on hand. 11. List the part description of the part that was sold the most (in terms of total number ordered). 12. List the full name and number of different parts for each order each customer has placed. Rename the calculated column as TOTAL_PARTS. 13. List the order date of an order containing a part description with letter D (or d) in it. 14. List the customer name of those who purchased products with a unit price of more than $150. 15. List sales representative number and the number of customers handled by each sales representative who got paid at most as the average total commission. Rename the number of transactions as NO_Customers SELECT FRON ORDER LNE ORDER NUMBER PART NUMBER NUMBER ORDERED 21 05 22.95 4999
Explanation / Answer
Ans 10. SELECT PART_DESCRIPTION , MAX(UNITS_ON_HAND) AS MAX_UNITS_ON_HAND
FROM PART
FROM PART INNER JOIN ORDER_LINE
ON PART.PART_NUMBER = ORDER_line.PART_NUMBER
GROUP BY PART_DESCRIPTION
FROM CUSTOMER
INNERJOIN ORDERS ON CUSTOMER.C_NUMBER = ORDERS.C_NUMBER
INNERJOIN ORDER_LINE ON ORDER.PARTNUMBER = ORDER_LINE.PART_NUMBER
Ans 13. SELECT * ORDER.ORDER_DATE
FROM ORDER INNER JOIN ORDER_LINE ON ORDER.ORDERED_NUMBER = ORDER_LINE.ORDER_NUMBER
INNERJOIN ( SELECT PART_DESCRIPTION
FROM PART
WHERE PART_DESCRIPTION LIKE %D% or %d%
)
ON ORDER_LINE.PART_NUMBER= PART. PART_NUMBER
Ans 14.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.