patron patron id 12A7 23U9 64J3 12H34 25V6 84Y8 book isbn 11353 11958 11789 11005 65345...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
patron patron id 12A7 23U9 64J3 12H34 25V6 84Y8 book isbn 11353 11958 11789 11005 65345 89434 43498 44983 patron_name Juliet Beatrice Falstaff Claudius Miranda Puck age 21 14 87 city Dallas Houston Baton Rouge Dallas 73 31 Shreveport Dallas 48 title War and Peace Great Expectations The Hobbit Don Quixote The Count of Monte Cristo The Lord of the Rings Moby Dick The Brothers Karamazov publisher Penguin Penguin Random House RAE Oxford Random House Oxford Oxford state TX TX LA TX LA TX phone 972-7823562 713-5689420 225-5387460 972-6597534 318-9837547 972-1764390 num_copies 5 7 10 4 3 18 5 2 pages 1225 328 300 928 1276 1178 378 840 69939 author author name Miguel de Cervantes J. R. R. Tolkien Charles Dickens Herman Melville Fyodor Dostoevsky borrows isbn A Christmas Carol 11353 44983 11789 65345 65345 11005 43498 44983 65345 patron id 12A7 12A7 12A7 12H34 25V6 64J3 84Y8 84Y8 12H34 country Spain England England USA Russia age 33 54 41 56 47 is_author isbn author name 11005 Miguel de Cervantes 11789 J. R. R. Tolkien 89434 J. R. R. Tolkien 11958 Charles Dickens 69939 Charles Dickens 43498 Herman Melville 44983 Fyodor Dostoevsky Oxford checkout date return_date 02/09/2022 02/16/2022 02/09/2022 02/16/2022 02/09/2022 02/16/2022 03/09/2022 03/18/2022 03/09/2022 03/11/2022 03/09/2022 03/16/2022 04/09/2022 04/09/2022 04/09/2022 date 1605 1937 1937 1861 1843 1851 1880 birth_date 09/29/1547 01/03/1892 02/07/1812 08/01/1819 11/11/1821 03/17/2022 03/17/2022 NULL 3 104 a) (0 pts.) Create the above tables in PostgreSQL, making sure that all dates are implemented using the DATE type. The table definitions must define the necessary primary keys, foreign keys, not-null constraints, and check constraints. b) (10 pts.) Find the names of the patrons that have borrowed more than two books on the same day. c) (10 pts.) Find the names of the English authors who have written books that have been borrowed two or more times. d) (10 pts.) Find those dates on which at least three books were returned. e) (10 pts.) Find the dates on which books written by Miguel de Cervantes or Fyodor Dostoevsky were borrowed. You must not use nested queries. Page 2 of 3 f) (10 pts.) Repeat question e) but using a nested query. g) (10 pts.) Find the dates on which books by Alexandre Dumas were borrowed and none from Herman Melville. You must not use nested queries. h) (10 pts.) Repeat question g) but using a nested query. i) (10 pts.) Find the titles of books borrowed two or more times using a correlated query with EXISTS. You cannot use GROUP BY. j) (10 pts.) Change the city and state of Miranda from "Shreveport" and “Louisiana” to "Orlando" and "Florida", respectively. k) (10 pts.) Delete all patrons that have not borrowed a book in more than 3 years. patron patron id 12A7 23U9 64J3 12H34 25V6 84Y8 book isbn 11353 11958 11789 11005 65345 89434 43498 44983 patron_name Juliet Beatrice Falstaff Claudius Miranda Puck age 21 14 87 city Dallas Houston Baton Rouge Dallas 73 31 Shreveport Dallas 48 title War and Peace Great Expectations The Hobbit Don Quixote The Count of Monte Cristo The Lord of the Rings Moby Dick The Brothers Karamazov publisher Penguin Penguin Random House RAE Oxford Random House Oxford Oxford state TX TX LA TX LA TX phone 972-7823562 713-5689420 225-5387460 972-6597534 318-9837547 972-1764390 num_copies 5 7 10 4 3 18 5 2 pages 1225 328 300 928 1276 1178 378 840 69939 author author name Miguel de Cervantes J. R. R. Tolkien Charles Dickens Herman Melville Fyodor Dostoevsky borrows isbn A Christmas Carol 11353 44983 11789 65345 65345 11005 43498 44983 65345 patron id 12A7 12A7 12A7 12H34 25V6 64J3 84Y8 84Y8 12H34 country Spain England England USA Russia age 33 54 41 56 47 is_author isbn author name 11005 Miguel de Cervantes 11789 J. R. R. Tolkien 89434 J. R. R. Tolkien 11958 Charles Dickens 69939 Charles Dickens 43498 Herman Melville 44983 Fyodor Dostoevsky Oxford checkout date return_date 02/09/2022 02/16/2022 02/09/2022 02/16/2022 02/09/2022 02/16/2022 03/09/2022 03/18/2022 03/09/2022 03/11/2022 03/09/2022 03/16/2022 04/09/2022 04/09/2022 04/09/2022 date 1605 1937 1937 1861 1843 1851 1880 birth_date 09/29/1547 01/03/1892 02/07/1812 08/01/1819 11/11/1821 03/17/2022 03/17/2022 NULL 3 104 a) (0 pts.) Create the above tables in PostgreSQL, making sure that all dates are implemented using the DATE type. The table definitions must define the necessary primary keys, foreign keys, not-null constraints, and check constraints. b) (10 pts.) Find the names of the patrons that have borrowed more than two books on the same day. c) (10 pts.) Find the names of the English authors who have written books that have been borrowed two or more times. d) (10 pts.) Find those dates on which at least three books were returned. e) (10 pts.) Find the dates on which books written by Miguel de Cervantes or Fyodor Dostoevsky were borrowed. You must not use nested queries. Page 2 of 3 f) (10 pts.) Repeat question e) but using a nested query. g) (10 pts.) Find the dates on which books by Alexandre Dumas were borrowed and none from Herman Melville. You must not use nested queries. h) (10 pts.) Repeat question g) but using a nested query. i) (10 pts.) Find the titles of books borrowed two or more times using a correlated query with EXISTS. You cannot use GROUP BY. j) (10 pts.) Change the city and state of Miranda from "Shreveport" and “Louisiana” to "Orlando" and "Florida", respectively. k) (10 pts.) Delete all patrons that have not borrowed a book in more than 3 years.
Expert Answer:
Answer rating: 100% (QA)
the SQL queries to create the tables answer a CREATE TABLE patron patronid VARCHAR4 PRIMARY KEY patronname VARCHAR20 NOT NULL age INT NOT NULL city VA... View the full answer
Related Book For
Systems Analysis and Design in a Changing World
ISBN: 978-1305117204
7th edition
Authors: John W. Satzinger, Robert B. Jackson, Stephen D. Burd
Posted Date:
Students also viewed these programming questions
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Use the attached "words.txt" file to store the words along with their ranks in an AVL tree. Then provide the user the option to search for any word. If the word exists the program displays the rank...
-
The raw data for Problem 22, from Freund (1979), appear below. For the model of Problem 22, a. Fit the model. b. What discrepancies do you note between the results of (a) and the data summary...
-
State whether the following statement are True or False An increase in the owner(s) equity, in the absence of any further investment by the owners is typically effected by sale transactions.
-
In this problem you will derive Equation 35-28 for the resolving power of a diffraction grating containing N slits separated by a distance d. To do this you will calculate the angular separation...
-
In your own words, what is the difference between Manage Quality and Control Quality on a project?
-
Consider the calculation of an external rate of return (ERR). The positive cash flows in the cash flow profile are moved forward to \(t=n\) using what value of \(i\) in the \((F \mid P i, n-t)\)...
-
Nona Inc., which produces a single product, has prepared the following standard cost sheet for one unit of the product. Direct materials (8 pounds at $2.50 per pound) ....$20 Direct labor (3 hours at...
-
Pops Popcorn has three project choices for the coming year, but only $9,000 in its budget for new projects. Project 1 is a new corn seed separator that identifies grannies (seeds that do not pop when...
-
WTI is planning to launch a new component. Production volume will be limited, with only 128 components to be produced in total. WTI expects the manufacture of the first component to take 25 direct...
-
A large old firm whose diversification fails but whose CEO also the bank overvalued special purpose entities ,rather as Enron once did ,is an example of vered out of Select one : a.Type 1 and 3...
-
(Option Strategies/Arbitrage Strategy) Consider the following three European put options with the same underlying non-dividend paying stock and the same expirations: The first put option has a strike...
-
What is the DCR for year one (NOI/DS)? What is the Cash-on-Cash Return for year one (BTCF/Initial Equity Investment)? Discounted Cash Flow What is the NOI for year 3? What is the Unleveraged IRR and...
-
discuss Digital Transformation impact on marketing research.
-
The CSI 300 Index is currently trading at 4,150. The continu- ously compounded risk-free rate is r = 0.06. The price of a European call option on the CSI 300 Index expiring in one year with a strike...
-
Azie sells 1,500 carpets a year during the last MCO at an average price per carpet of RM499. The ordering cost per unit is RM13. If the economic order quantity is 100 units, calculate the total...
-
Mo buys a car. The total cost of the car is 6000 Mo pays a deposit of 900 Her then pays 12 equal monthly payments. How much is each monthly payment?
-
Write a paper about how diet relates to breast cancer in women study design to use: case control study purpose & rationale the purpose of this final project is to utilize the methods and...
-
What is an action bar? Have you noticed one on an app? Describe it.
-
Given the following list of classes and associations for the previous car insurance system, list the preconditions and postconditions for the use case Add a new vehicle to an existing policy.
-
What is an association, and what system development standard defines it?
-
Determine the work required to transport \(10 \mathrm{~kg}\) of material from Earth to the ISS, the International Space Station, in orbit \(420 \mathrm{~km}\) above the Earth's surface.
-
Show that the force field expressed in spherical coordinates \(\mathbf{F}=f(r, \theta) \mathbf{r}\) is conservative if and only if the function \(f\) is independent of \(\theta\).
-
Show that in the case of a binary system in which the orbit is circular of radius \(r\), the kinetic energy corresponds to half the absolute value of the potential energy. In other words, the total...
Study smarter with the SolutionInn App