Question: using SQL Assume the relations shown below (underlined attributes are primary and foreign keys): merchants( mid , name, city, state) products( pid , name, category,
using SQL Assume the relations shown below (underlined attributes are primary and foreign keys):
merchants(mid, name, city, state)
products(pid, name, category, description)
sell(mid,pid, price, quantity_available)
orders(oid, shipping_method, shipping_cost)
contain(oid,pid)
customers(cid, fullname, city, state)
place(cid,oid, order_date)
For each of the following questions write a SQL query:
List names and sellers of products that are no longer available (quantity=0)
List names and descriptions of products that are not sold.
How many customers bought SATA drives but not any routers between 2009 and 2019?
HP has a 20% sale on all its Networking products.
What did Uriel Whitney order from Acer on October 13, 2016? (make sure to at least retrieve product names and prices).
List the annual total sales for each company (sort the results along the company and the year attributes).
Which company had the highest annual revenue and in what year?
On average, what was the cheapest shipping method used in 2016?
What is the best sold ($) category for each company?
For each company find out which customers have spent the most and the least amounts.
General Guidelines
Your tables must have primary or foreign key constraints along with:
Productsnameconstraint: Printer, Ethernet Adapter, Desktop, Hard Drive, Laptop, Router, Network Card, Super Drive, Monitor
Productscategoryconstraint: Peripheral, Networking, Computer
Sellpriceconstraint: between 0 and 100,000
Sellquantity_availableconstraint: between 0 and 1,000
Ordersshipping_methodconstraint: UPS, FedEx, USPS
Ordersshipping_costconstraint: between 0 and 500
Place order_date: between 2005-1-1 and 2019-12-31
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
