Can you verfiy I am doing these queries in SQL correctly? If not can you give so
ID: 3742362 • Letter: C
Question
Can you verfiy I am doing these queries in SQL correctly? If not can you give some feedback on what I am not doing correctly? Thank you!
1) How many copies of the book titled “The Lost Tribe” are owned by the library branch whose name is “Sharpstown”?
SELECT NumberOfCopies
FROM BOOK, BOOK_COPIES, LIBRARY_BRANCH
WHERE BOOK.BookID = BOOK_COPIES.BookID
AND LIBRARY_BRANCH.BranchName = ‘Sharpstown’
AND BOOK.Title = ‘The Lost Tribe’ ;
2) How many copies of the book titled “The Lost Tribe” are owned by each library branch?
SELECT NumberOfCopies
FROM BOOK, BOOK_COPIES, LIBRARY_BRANCH
WHERE BOOK.BookID = BOOK_COPIES.BookID
AND BOOK.Title = ‘The Lost Tribe’ ;
3) Retrieve the names of all borrowers who do not have any books checked out.
SELECT Name
FROM BORROWER
WHERE CardNumber NOT IN (SELECT CardNumber
FROM BOOK_LOANS);
Book BooklD Title PublisherName Book_Authors BookID AuthorsName Publisher Name Address Phone Book_Copies BookID BranchlD NumberOfCopies Book Loans BookID BranchID CardNumber DateOut DueDate Library_Branch BranchID BranchName Address Borrower CardNumber Name Address PhoneExplanation / Answer
(a) How many copies of the book titled The Lost Tribe are owned by the library branch whose name is ‘Sharpstown’?
Sharps id Branch id(Branch name=0Sharpstown0(Library Branch))
Tribe id Book id(Title=0The Lost Tribe0(Book))
Answer No of copies(Book Copies Sharps id Tribe id)
-or
Answer No of copies(Branch name=0Sharpstown0Title=0The Lost Tribe0( Book Copies Library Branch Book))
(c) Retrieve the names of all borrowers who do not have any books checked out.
None id Card no(Borrower) Card no(Book Loans)
Answer Name(Borrower None id)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.