Question: Look at the following table : User table : UserID Name Email Phonenumber Address 300 Josh Allen josh@mail.com 18273912 Buffalo 301 Lamar Rome lamar@mail.com 18273674
Look at the following table : User table :
| UserID | Name | Phonenumber | Address | |
| 300 | Josh Allen | josh@mail.com | 18273912 | Buffalo |
| 301 | Lamar Rome | lamar@mail.com | 18273674 | Baltimore |
| 302 | Ben Roethlisberger | ben@mail.com | 18263234 | Pittsburgh |
| 303 | Ryan Tannehill | ryan@hoo.com | 12734950 | Tennessee |
| 304 | Baker Mayfield | baker@hoo.com | 13492750 | Cleveland |
Officer table :
| Officerid | Name | Position | Levels |
| 200 | John Harbaugh | Head of Library | Admin |
| 201 | Andy Reid | High Officer | Admin |
| 202 | Ron Rivera | High Officer | Admin |
| 203 | Bill Belichick | Low Officer | Admin |
Book Table :
| Bookid | Title | Author | Publisher | Pages | Year |
| 100 | The Catcher in the Rye | Jane Austen | Penguin Random House | 535 | 2005 |
| 101 | Nine Stories | Scott Hanselman | Hachette Livre | 534 | 2008 |
| 102 | Franny and Zooey | Jane Austen | Simon & Schuster | 404 | 2000 |
| 103 | The Great Gatsby | Todd Miranda | Harper Collins | 406 | 2003 |
| 104 | Tender id the Night | Michael Moore | Harper Collins | 432 | 2009 |
| 105 | Pride and Prejudice | Jane Austen | Simon & Schuster | 558 | 2000 |
| 106 | Hollow Kingdom | Marcus Peters | Harper Collins | 264 | 2010 |
| 107 | Race and Wealth | Justin Tucker | Scholastic | 537 | 2002 |
| 108 | Lonely Warrior | Scott Hanselman | Hachette Livre | 292 | 2006 |
| 109 | King Beggar | Jane Austen | Simon & Schuster | 484 | 2001 |
Create a table (Sql syntax) of :
-
Borrowing transaction data = borrowing id, date, book ID, number of books, borrower (user) ID, borrowing time and officer ID.
-
Return transaction data = borrowing id, date, book ID, number of books, borrower (user) ID, borrowing time and officer ID.
Create an SQL Syntax based on these scenarios :
-
On Friday January 1, 2021, Josh Allen wanted to borrow 2 books of Nine Stories, on that day the officer was Mr. Ron Rivera, and she returned the book 3 days later to Mr. Bill Bellichick
-
The officer wants to display 5 books that have the most number of pages.
-
The officer wants to display book data and borrower data.
-
The officer wants to display the book data written by Jane Austen, and to display the most recent books from Jane Austen.
-
On Thursday December 31, 2020, Baker Mayfield wanted to borrow 4 of the Tender id The Night books, he met Mr Andy Reid, and he returned it a week after the date of the loan.
-
The officer wants to display loan officer data and data on books borrowed in December 2020.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
