Module 7 Assignment 2
Module 7 Assignment 2
3. Write a query to display the number of different patrons who have ever checked
out a book.
4. Write a query to display the subject and the number of books in each subject. Sort
the results by the number of books in descending order and then by subject name
in ascending order .
5. Write a query to display the author ID and the number of books written by that
author. Sort the results in descending order by number of books, then in ascending
order by author ID.
6. Write a query to display the total value of all books in the library.
7. Write a query to display the patron ID, book number, and days kept for each
checkout. “Days Kept” is the difference from the date on which the book is
returned to the date it was checked out. Sort the results by days kept in
descending order, then by patron ID, and then by book number.
8. Write a query to display the patron ID, patron full name, and patron type for each
patron sorted by patron ID.
9. Write a query to display the book number, title with year, and subject for each
book. Sort the results by the book number
10. Write a query to display the author last name, author first name, and book number
for each book written by that author. Sort the results by author last name, first
name, and then book number
11. Write a query to display the author ID, book number, title, and subject for each
book. Sort the results by book number and then author ID
12. Write a query to display the author last name, first name, book title, and
replacement cost for each book. Sort the results by book number and then author
ID
13. Write a query to display the patron ID, book number, patron first name and last
name, and book title for all currently checked out books. (Remember to use the
redundant relationship described in the assignment instructions for current
checkouts.) Sort the output by patron last name and book title
14. Write a query to display the patron ID, full name (first and last), and patron type
for all patrons. Sort the results by patron type and then by last name and first
name. Ensure that all sorting is case insensitive
15. Write a query to display the book number and the number of times each book has
been checked out. Do not include books that have never been checked out. Sort the
results by the number of times checked out in descending order and then by book
number in descending order
16. Write a query to display the author ID, first and last name, book number, and book
title of all books in the subject “Cloud”. Sort the results by book title and then by
author last name
17. Write a query to display the book number, title, author last name, author first
name, patron ID, last name, and patron type for all books currently checked out to a
patron. Sort the results by book title
18. Write a query to display the book number, title, and number of times each book has
been checked out. Include books that have never been checked out. Sort the
results in descending order by the number of times checked out and then by title
19. Write a query to display the book number, title, and number of times each book has
been checked out. Limit the results to books that have been checked out more than
five times. Sort the results in descending order by the number of times checked
out and then by title
20. Write a query to display the author ID, author last name, book title, checkout date,
and patron last name for all the books written by authors with the last name
“Bruer” that have ever been checked out by patrons with the last name “Miles.”
Sort the results by check out date.
21. Write a query to display the patron ID, first and last name of all patrons who have
never checked out any book. Sort the result by patron last name and then first
name .
22. 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
23. Write a query to display the average number of days a book is kept during a
checkout
24. Write a query to display the patron ID and the average number of days that patron
keeps books during a checkout. Limit the results to only patrons who have at least
three checkouts. Sort the results in descending order by the average days the book
is kept, and then in ascending order by patron ID
25. Write a query to display the book number, title, and cost of books that have the
lowest cost of any books in the system. Sort the results by book number