Question: Write a query to display the patron ID, last name, number of times that patron has ever checked out a book, and the number of

Write a query to display the patron ID, last name, number of times that patron has ever checked out a book, and the number of different books the patron has ever checked out. For example, if a given patron has checked out the same book twice, that would count as two checkouts but only one book. Limit the results to only patrons who have made at least three checkouts. Sort the results in descending order by number of books, then in descending order by number of checkouts, and then in ascending order by patron ID (Figure P7.102).

Figure P7.102 Checkouts and Books by Patron PAT_ID PAT_LNAME NUM CHECKOUTS NUM DIFFERENT BOOKS 1161 Koch 1165

Figure P7.102 Checkouts and Books by Patron PAT_ID PAT_LNAME NUM CHECKOUTS NUM DIFFERENT BOOKS 1161 Koch 1165 Baldwin 1181 Horne 1185 Yang 1210 Cooley 1229 Burke 1160 carter 1171 Marsh 1172 Miles 1207 Ramos 1209 Mathis 1183 Hughes 3 3 3 3 MMMMMMMMM 3 3 3 3 3 3 3 3 333 3 3 3 NNNNN@@@ 3 3 2 2 2 2 2 1

Step by Step Solution

3.29 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

sql SELECT PATID AS Patron ID PATLNAME AS Last Name C... View full answer

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 Database Systems Design Implementation Questions!