Question: Question 1: Explain the difference between a primary key and a foreign key in a relation. Question 2: Define the terms integrity constraint and referential

Question 1:

Explain the difference between a primary key and a foreign key in a relation.

Question 2:

Define the terms "integrity constraint" and "referential integrity" in the context of the relational model.

Question 3:

Give an example of a situation where a violation of a referential integrity constraint might occur, and explain how to resolve the issue.

Question 4:

Assuming a library database schema with the following tables and attributes: Book (BookID, Title, AuthorID, PublisherID, Rating, Price) Author (AuthorID, FirstName, LastName) Publisher (PublisherID, Name)

Borrower (BorrowerID, FirstName, LastName)

1- Write a SQL query to retrieve the names of all authors who have written a book published by "Penguin Books".

2- Write a SQL query to retrieve the total number of books borrowed by each borrower.

3- Write a SQL query to retrieve the names of all publishers who have published at least one book with a rating of 4 stars or higher.

4- Write a SQL query to calculate the average price of books.

5- Write a SQL query to find the maximum price of books.

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!