Question: There are 6 tables created with data 1 . Book 2 . Borrower 3 . Cat 4 . Copies 5 . Loan 6 . Publisher

There are 6 tables created with data
1.Book
2.Borrower
3.Cat
4.Copies
5.Loan
6.Publisher
Task (11 Questions):
1) Some books have not been borrowed/loaned at all. Write a query to list such books with details such as book id, ISBN, title, number of copies. Sort them by title. [3 rows of output].
2)Write a query to retrieve the name and the total number of loans per borrower. The output should be sorted by the borrower's name. [6 rows of output]
3)Write a query to find out which books have the greatest number of copies. The output should display books title(s) and it/their number of copies. [1 row of output]
4)Write a query to retrieve book's titles, number of copies and publisher's names. The result should be sorted by the publishers name, then by number of copies and then by books title. [16 rows of output]
5)Write a query to retrieve the name, phone, and postcode of borrowers who are students and live in a suburb with postcode less than 4200, sort by postcode. [5 rows of output]
6)Write a query to find out what books have 'SQL' in their titles. The query should output book's titles, book's isbn, publishers ids and publisher's names. Sort the results by title. [3 rows of output]
7) For copies that were loaned, write a query using RIGHT JOIN to list the number of times that each copy was loaned out. Sort them in order of copy_id.[15 rows of output]
8) Write a query to create a new table NEW1 and with 3 columns [COPY_ID, BOOK_ID, BOOK_TITLE]. The new table should contain a list of the all the copies with the book details such as book-id and book-title. So, copy the required data from COPIES and BOOK tables. [50 rows]
9)Write a SQL statement to insert one new loan record as follows:
Loan_id: 21
Borrower_id: 4
Copy_id: 9
Borrowed date: Current date
Due date: 7 days later
Returned date: Null
10)Write a SQL statement to delete loan_id (21) from the loan table.
11)Write an update statement to extend the due date of all overdue loans for 2 more days from today. Use curdate() function. Indicate how many rows were updated by the query.

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 Accounting Questions!