Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 4 Answer all parts Consider the following relational schema: Primary keys are highlighted and underlined authors(author_id, last_name, first_name) books(book_id, title, num_pages, author_id) branches(branch_id, branch_name,

QUESTION 4 Answer all parts Consider the following relational schema: Primary keys are highlighted and underlined authors(author_id, last_name, first_name) books(book_id, title, num_pages, author_id) branches(branch_id, branch_name, address, phone_no) copies(copy_id, branch_id, book_id, cost) loans(loan_id, copy_id, borrower_id, due_date) borrowers(borrower_id, name,member_since) Write SQL queries to answer the following: (a) Using SQL Statement create a relational schema for the above entities. Remember to consider foreign keys when creating tables. (12 marks) (b) Find the titles of books that have fewer than 10 copies. (3 marks) (c) Find the names of borrowers who have been members since 2005 and have read all the books. (4 marks) (d) Find the average number of pages in the books for each branch and order the result by increasing average page count. (4 marks) (e) For each book-branch combination, find the number of copies of the book available at the branch. Give the branch name, book title, and count in the results. (2 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

Describe the nature of negative messages.

Answered: 1 week ago