Use the relational schema of Pine Valley Furniture (PVF) database system to crea
ID: 3698098 • 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)
1. What are the best-selling products (in terms of number of pieces sold)? Display pid, prod_desc, and total number of pieces being sold of the products.
Explanation / Answer
select o.pid,prod_desc,sum(quantity)
from product p,pvf_order_item item o
where p.pid=o.pid
group by o.pid
order by sum(quantity) desc
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.