Question: Introduction to Oracle 12c SQL and DB concepts: books ( book_id, title, author_last_name, author_first_name, rating) patrons (patron_id, last_name, first_name, street_address, city_state_zip, location) transactions (transaction_id, patron_id,

Introduction to Oracle 12c SQL and DB concepts:

books ( book_id, title, author_last_name, author_first_name, rating)

patrons (patron_id, last_name, first_name, street_address, city_state_zip, location)

transactions (transaction_id, patron_id, book_id, transaction_date, transaction_type)

*Book_Id, Patron_id and Transaction_id are primary keys. Patron_id and book_id in transactions table are foreign keys.

Possible values for the transaction type are 1 = checking out , 2 = returning 3 = placing a hold.

  1. Write SQL to list all patrons and their number of transactions for each transaction type. Include all patrons even if they do not have transactions.
  2. Write SQL to list all the books (book ids and first 10 characters of the title) and their total number of transactions in 2013. Include all books even if they have no transactions (count should be 0). Sort the results by the most popular book (the book with the most transactions).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!