Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Relational Database Schema for a Library Database: BOOK(BKID, BK_TITLE, BK_LIST_

ID: 3805200 • Letter: R

Question

Relational Database Schema for a Library Database: BOOK(BKID, BK_TITLE, BK_LIST_PRICE, PBID) PUBLISHER(PBID, PB_NAME, PB_STREET, PB_ZIPCODE, PB.PHONE) AUTHOR(AUID, AU_NAME, AU_DOB) LIBRARY_BRANCH(LBID, LB_NAME, LB_STREET, LB_ZIPCODE) BORROWER(CRID, CR_NAME, CR_DOB, CR_STREET, CR_ ZIPCODE) ZIPCODE(ZIPCODE, CITY, STATE) BOOK_COPIES(BKID, LBID, NO_OF_COPIES) BOOK_AUTHORS(BKIP, AUID) For each of the following, write the SQL query: List all the attributes for each Author born after January 18, 1976. List the Name and Date-of-Birth for each Author. List the Name and Date-of-Birth for each Author born after January 18, 1976. List the Title, List Price and Publisher's Name for each Book. List the Title, List Price and Publisher's Name for each Book whose List Price is more than $200.00. List the Title, List Price, Author's Name and Publisher's Name for each Book whose List Price is more than $200.00. List the ID, Name, City, State & Zipcode of each Publisher who has published at least one Book whose List Price was more than $200.00. List the number of books, and the minimum, average & maximum List Price for all books. List the Name, and average and maximum book List Price of each Publisher. List number of Publishers who have published at least one Book whose List Price is more than $200.00. List the ID & Name of each Publisher who has never published a Book whose List Price was more than $200.00. List the ID & Name of each Publisher who only publishes Books whose List Price is more than $200.00.

Explanation / Answer

1.select * from Author where to_char(au_dob,'MON')>'JAN' and to_char(au_dob,'YYYY')>'1976' and
to_char(au_dob,'DD')>18;

2.select au_name,au_dob from Author;

3.select au_name,au_dob from author where to_char(au_dob,'MON')>'JAN' and to_char(au_dob,'YYYY')>'1976' and to_char(au_dob,'DD')>18;

4.select bk_title ,bk_list_price,pb_name from book,publisher where book.pbid=publisher.pbid;

5.select bk_title ,bk_list_price,pb_name from book,publisher where book.pbid=publisher.pbid
and bk_list_price>200;

6.select book.bk_title ,book.bk_list_price,author.au_name,publisher.pb_name from book,publisher,author,book_authors where
book.pbid=publisher.pbid
and book.bkid=book_authors.bkid
and book_authors.auid=authors.auid
and bk_list_price>200;