Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1 SQL [10 points] We define a database for FSU libraries as follow, Books: (bookID INTEGER, title TEXT, genre TEXT, lib INTEGER REFERENCES

image

Problem 1 SQL [10 points] We define a database for FSU libraries as follow, Books: (bookID INTEGER, title TEXT, genre TEXT, lib INTEGER REFERENCES Libraries, PRIMARY KEY (bookID)); Libraries: (libraryID INTEGER, name TEXT, PRIMARY KEY (libraryID)); Checkouts: (book INTEGER REFERENCES Books, day DATETIME, PRIMARY KEY (book, day)). 1. [3 points] Write a SQL query that returns the bookID and genre of each book that has ever been checked out; 2. [3 points] Write a SQL query that returns the bookID of the book that has been checked out the most times, and the corresponding checked-out count. We assume that each book was checked out a unique number of times; 3. [4 points] Write a SQL query that finds the name of all of the pairs of libraries that have books with matching titles. In the output, report the names of both libraries (the first name is alphabetically less than the second) and the matching titles of the books.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

ANSWER 1 SELECT bookID genre FROM Books INNER JOIN Checkouts ON BooksbookID Chec... 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

Database System Concepts

Authors: Henry F. Korth, S. Sudarshan

4th Edition

978-0073523323, 0-07-255481-9, 73523321, 978-0072554816

More Books

Students also viewed these Programming questions

Question

understand the restrictions of top-down job redesign approaches;

Answered: 1 week ago