Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the following questions, use the relational schema defined as follow. Book (

ID: 3593558 • Letter: F

Question

For the following questions, use the relational schema defined as follow.

Book

(ISBN, title, author, edition, year)

BookCopy

(copyNo, ISBN, available)

Borrower

(borrowerNo, borrowerName, borrowerAddress)

BookLoan

(copyNo, dateOut, dateDue, borrowerNo)

where

Book contains details of book titles in the library and the ISBN is the primary key.

BookCopy contains details of the individual copies of books in the library and copyNo is the primary key. ISBN is a foreign key identifying the book title.

Borrower contains details of library members who can borrow books and borrowerNo is the primary key.

BookLoan contains details of the book copies that are borrowed by library members and copyNo/dateOut forms the primary key. borrowerNo is a foreign key identifying the borrower.

1. Insert one new row for the BookCopy table.

2. List all book titles.

3. List all borrower details, in alphabetical order of borrower name..

4. List all book titles published in the year 2005 written by “J. K. Rowling”.

5. How many copies of ISBN “0 - 7475 - 8108 - 8” are there?

6. List all copies of the book with “Harry Potter” keyword in title that are available for borrowing.

7. List the names of borrowers who currently have the book title “Lord of the Rings” on loan.

8. List the names of borrowers who will overdue books today.

9. List the top 10 most - borrowed books in the library.

10. Modify the address of borrower John Smith to “123 Main Street”.

Explanation / Answer

1. INSERT INTO BookCopy (copyNo, ISBN, available)

VALUES(2, '123', 'yes') //supposing that available contains yes or no value.

2. SELECT title FROM Book.

3. SELECT * FROM Borrower ORDER BY borrowerName ASC // you may or may not use ASC as its default value.

4. SELECT Title from book WHERE year = 2005 AND author LIKE 'J. K. Rowling'

5. SELECT copyNo WHERE ISBN = '0 - 7475 - 8108 - 8'

6. SELECT * FROM BookCopy WHERE Book.title LIKE %HARRY POTTER% AND available = 'Yes'

8. SELECT borrowerName FROM Borrower WHERE BookLoan.borrowerNo = Borrower.borrowerNo

10 UPDATE Borrower SET borrowerName = “123 Main Street” WHERE  borrowerName = "John Smith"

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote