4. A database is built in the library to catalogue books and handle book lending. Each book in the library is catalogued by author. Any number of books can be associated to an author. Each user is allowed to borrow one and only one book. The database stores information about the following entities and their relationships: User: unique reference number, name, and phone number, ● Author: unique reference number, name ● Book: unique title, category (e.g. Physics, Science,..), publication year, the user (reference) borrowing the book, the author (reference) of the book. a) Write SQL CREATE TABLE statements for these three tables. Justify your choices of keys used. b) Write SQL statements to perform the following tasks: (i) Insert a new entry in the user table (for a set of values at your choice). (ii) List the title for all books with author "Stephen King". (iii) List the names of all the authors in the database, and beside each name give the number of books published on or after 2017

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
4.
A database is built in the library to catalogue books and handle book lending.
Each book in the library is catalogued by author. Any number of books can be
associated to an author. Each user is allowed to borrow one and only one book.
The database stores information about the following entities and their
relationships:
User: unique reference number, name, and phone number,
Author: unique reference number, name
Book: unique title, category (e.g. Physics, Science,..), publication year, the
user (reference) borrowing the book, the author (reference) of the book.
a) Write SQL CREATE TABLE statements for these three tables. Justify
your choices of keys used.
b) Write SQL statements to perform the following tasks:
(i) Insert a new entry in the user table (for a set of values
at your choice).
(ii) List the title for all books with author "Stephen King".
(iii) List the names of all the authors in the database, and beside
each name give the number of books published on or after 2017
Transcribed Image Text:4. A database is built in the library to catalogue books and handle book lending. Each book in the library is catalogued by author. Any number of books can be associated to an author. Each user is allowed to borrow one and only one book. The database stores information about the following entities and their relationships: User: unique reference number, name, and phone number, Author: unique reference number, name Book: unique title, category (e.g. Physics, Science,..), publication year, the user (reference) borrowing the book, the author (reference) of the book. a) Write SQL CREATE TABLE statements for these three tables. Justify your choices of keys used. b) Write SQL statements to perform the following tasks: (i) Insert a new entry in the user table (for a set of values at your choice). (ii) List the title for all books with author "Stephen King". (iii) List the names of all the authors in the database, and beside each name give the number of books published on or after 2017
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Types of Database Architectures
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education