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

Use the relational schema of Pine Valley Furniture (PVF) database system to crea

ID: 3698092 • Letter: U

Question

Use the relational schema of Pine Valley Furniture (PVF) database system to create and execute SQL queries. Here is the relational schema:

pvf_cust (cid, name, address, city, state, zipcode)

pvf_order (oid, orderdate, cid)

     cid is a foreign key references customer(cid)

pvf_product (pid, prod_desc, prod_finish, price, prod_line_id)

pvf_order_item (oid, pid, quantity)

     oid is a foreign key references pvf_order(oid)

     pid is a foreign key references pvf_prod(pid)

(a) List order ID and total number (quantity) of items in each order.

(b) Same as (a), but only display those orders that include more than 5 items.

Explanation / Answer

1.
Select oid,sum(quantity) as 'total item' from pvf_order_item
group by oid;

2.
Select oid,sum(quantity) as 'total item' from pvf_order_item
group by oid having sum(quantity) > 5

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