I have 2 queries I have to create but they sound the same.
Note: I am just learning the theory behind SQL and not actually working on a DB at this time
1. Show all the categories for each book with the book number, title, category number, and category name.
2. Show all the books for each category with the categbory number, category name, book number, and book title.
(book_id, book_title, publication_date, publisher_id, précis)
FK book_id > book
FK category_id > category
This is what I got for #1:
SELECT c.category_id, c.category_name, b.book_id, b.book_title
FROM category c, book b, book_category bc
WHERE bc.book_id = b.book_id
AND bc.category_id = c.category_id
ORDER BY c.category_name, b.book_title;
After looking at #2 I am confused and I have no idea if I did this correctly.
Any help would greatly be appreciated. Thanks a bunch!