Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this project you will build a database for a public library. This database is aimed to collect and analyze information about the clients' reading

In this project you will build a database for a public library. This database is aimed to collect and analyze information about the clients' reading interests. The project concentrates only on books and the clients' interests in books. The analyses that will result from this project will be used by the library's management to decide on the future purchasing policy.

A. Write the SQL statements in order to create the tables for the database. Use the Entity Relationship Diagram (ERD) of the database shown in Figure 1. For simplicity, we are assuming in this project that a book cannot be written by more than one author. You need to create the tables as well as the required constraints, including the keys (primary and foreign), and the relationships between tables.

Figure 1: ERD for Library Database

  1. Top 5 occupations that borrowed the most in 2016

  2. Average number of borrowed books by job title

  3. Create a VIEW and display the titles that were borrowed by at least 20% of clients

  4. The top month of borrows in 2017

  5. Average number of borrows by age

  6. The oldest and the youngest clients of the library

  7. First and last names of authors that wrote books in more than one genre

As you work on these queries, create indexes that will increase your queries' performance.

You must include comments in your code that address the purpose of your query and explains each step. Save your queries and results in a plain-text file that you will submit as your assignment.

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

Step: 3

blur-text-image

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

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago