Question: Consider the Customers-Agents-Products (CAP) database with schema below. CUSTOMERS ( cid , cname, city, discnt) AGENTS ( aid , aname, city, percent) PRODUCTS ( pid
Consider the Customers-Agents-Products (CAP) database with schema below.
CUSTOMERS (cid, cname, city, discnt)
AGENTS (aid, aname, city, percent)
PRODUCTS (pid, pname, city, quantity, price)
ORDERS (ordno, month, year, cid, aid, pid, qty, dollars)
SQL Queries with aggregates:
Q8: List the names and ids of products for which the number of purchase orders (not the total sum of quantities within orders) in 2020 exceeded 1 million.
Q9: List the names and ids of agents in New York who, in 2020, placed orders of products with prices more than $1million less than one thousand times.
Q10: For each of month of 2020, list the agents who placed the orders with the highest total dollar amount.
Q11: List the names and ids of customers who, in 2020, placed purchase orders through at least 10 agents per month.
Q12: List the names and ids of customers who (a) have only ordered through agents in their own cities, and (b) placed the highest number of purchase orders.
I only need the generic clause of the database so no data is needed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
