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

Write SQL code that could be used from these seven tables below 7. List the part

ID: 3699014 • Letter: W

Question

Write SQL code that could be used from these seven tables below

7. List the part number and part description of parts with units on hand higher than the average

units on hand across all parts.

8. List the full name and credit limit of customer who bought a Gas Grill.

9. List the warehouse number and total dollar amount of all items sold from that warehouse.

Rename the calculated column TOTAL_VALUE.

TOTAL_VALUE=SUM(NUMBER_ORDERED*QUOTED_PRICE).

10. 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

Table: PART Column Data Type gth Precision Scale Nullable PART NUMBER PART DESCRIPTION UNITS ON HAND ITEM CLASS WAREHOUSE NUMBERNUMBER UNIT PRICE VARCHAR2 VARCHAR2 NUMBER CHAR No - Yes Yes - Yes Yes 2 Yes 12 NUMBE 7

Explanation / Answer

Hi, I have answered Q7 to Q11.

Please post others in separate post. As per the chegg guide line please post only 4 parts in a single post.

7.select part_number,part_description from part
where units_on_hand>(select avg(units_on_hand) from part);


8.select c.credit_limit from customer c
join orders ord on c.c_number=ord.c_number
join order_line ordl on ord.order_number=ordl.order_number
join part p on ordl.part_number=p.part_number and p.part_description='Gas Grill';


9.select w_no,sum(total_price) as total_value from
(
select a.warehouse_number w_no ,a.unit_price*b.number_ordered as total_price from part a
join order_line b on a.part_number=b.part_number
)
group by w_no;

10.select part_description from part
where units_on_hand=(select max(units_on_hand) from part);

11.select a.part_description from part a
join order_line b on a.part_number=b.part_number
where b.number_ordered=(select max(number_ordered) from order_line);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote