Question
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
-
Top 5 occupations that borrowed the most in 2016
-
Average number of borrowed books by job title
-
Create a VIEW and display the titles that were borrowed by at least 20% of clients
-
The top month of borrows in 2017
-
Average number of borrows by age
-
The oldest and the youngest clients of the library
-
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started