I am trying to write some queries and I am confused on exactly what to do. Here are my tables that reference my 3 questions.
Branch
(branch_id, branch_name, street_address, city, state, zipcode, phone, branch_manager, library_id)
FK – library_id > library
Library
(library_id, library_name, street_address, city, state, zipcode, phone, manager_name)
Patron
(patron_id, first_name, last_name, street_address, city, state, zipcode, phone, fee_balance)
Book
(book_id, book_title, publication_date, publisher_id, précis)
FK – publisher_id > publisher
Copy
(copy_id, book_id, cost, branch_id)
FK – Book_id > book
FK – branch_id > branch
Checkout
(checkout_id, copy_id, patron_id, out_date, due_date, return_date)
FK – copy_id > copy
FK – patron_id > patron
Directions:
1. list the books that each patron currently has checked out with the patron number, patron name, phone#, book #, and title.
2. same as #1 except that the list should be for any book the patyron has ever checked out.
3. same as #1 except for all books that are past due along with the past due fee.
I know the format of the syntax
SELECT
FROM
WHERE
however the directions leads me to believe there is a special function I need to put in but I have no idea what it might be. My textbook is pretty bland on giving several examples to help me determine the correct syntax. If you can explain in detail the queries I need I would greatly appreciate it so I can better understand what I am not understanding here. thank you so much in advance to anyone that can help me.
This is what I got so far...its not much because I am lost at the WHERE.
SELECT p.patron_id, p.last_name, p,.first_name, p.phone, b.book_id, b.title
FROM patron p, book b, copy c, checkout co
WHERE
ORDER BY
I am thinking I may need a boolean statement but my book only gives me 1 example of using that function. This seems so easy that it's killing me.