Problem Description: Bookstore owner needs to know how many copies of books writ
ID: 332595 • Letter: P
Question
Problem Description:
Bookstore owner needs to know how many copies of books written by each author have been sold. For each author, display author ID, first name, last name, and total number of books written by the author that have been sold. Display the output in descending order of total books sold.
See below a screenshot that shows partial output. Please make sure that your screenshot displays complete statement, its complete output, and your account email. Also ensure that column headings look like those shown in the screenshot below.
ORDERS Order# Customer# Orderdate Shipdate Shipstreet Shipcity Shipstate Shipzip Shipcost CUSTOMERS Customer# astname Firstname Emalil Address Ci State BOOKAUTHOR AUTHOR BOOKS ISBN Title Pubdate PublD Cost Retail Discount Category ip Referred ISBN AuthorlD Authorl Lname Fname Reglon ORDERITEMStle Order# item# ISBN Quantity Paldeach PubID Name PROMOTION Contact Phone Gift Minretail MaxretailExplanation / Answer
Select BOOKAUTHOR.AuthorID as Author ID, AUTHOR.Fname as First Name, AUTHOR.Lname as Last Name, ORDERITEMS.Quantity as Books Sold from BOOKAUTHOR, AUTHOR, BOOKS, ORDERITEMS where BOOKAUTHOR.AuthorID = AUTHOR.AuthorID and BOOKS.ISBN = ORDERITEMS.ISBN and BOOKS.ISBN = BOOKAUTHOR.ISBN group by BOOKAUTHOR.AuthorID
In this case we have joined 4 tables namely BOOKAUTHOR, AUTHOR, BOOKS and ORDERITEMS to retrive the following result set. The command AS has been used to have the column names, and the conditions has been used to jon the 4 tables and the quantity of books sold of each author is determined as Group By has been used.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.