Question: Books(bid:integer, bname:string, author:string, year:integer, price:integer)Orders(cid:integer, bid:integer, quantity:integer)Customers(cid:integer, cname:string, zipcode:string) The meaning of attributes is as follows:bid: book unique identifier, bname: book name; author, year and
Books(bid:integer, bname:string, author:string, year:integer, price:integer)Orders(cid:integer, bid:integer, quantity:integer)Customers(cid:integer, cname:string, zipcode:string) The meaning of attributes is as follows:bid: book unique identifier, bname: book name; author, year and price (per unit) are self-explanatoryquantity: number of books purchased with an ordercid: unique customer identifier, cname: customer name, zipcode: customer address zipcode.Write SQL queries for the following:
(a)Find distinct authors of books ordered in quantities of at least 50 from zi pcode 02125.
(b)Find the names of customers who ordered only books with pri ce l owe r than $100.
(c)Find the average price of ordered books for each customer (listed as cid) who bought at least 20 different book titles costing at least $20 each.
(d)Find the names of customers who ordered every book written by Edgar Codd.
(e)Find the author name(s) of the best-selling book(s) (meaning the books that sold the hi ghest number of copies).
( f)[630 onl y] Find the name(s) of most valuable customer( s), i.e. those who spent the most money.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
