Question: Scenario: You are working with a bookstore database containing the following tables: - Books: Contains details about books ( BookID , BookName, Price ) .

Scenario: You are working with a bookstore database containing the following tables:
- Books: Contains details about books (BookID, BookName, Price).
- Authors: Contains AuthorID and AuthorName.
- BookAuthors: Links books to their authors (BookID, AuthorID).
- Customers: Contains CustomerID and CustomerName.
- Sales: Contains sales information (SaleID, CustomerID, BookID, SaleDate)
1. Inner Join: Write a query to display the BookName and AuthorName for all books
sold.
SQL/MYSQL CODE:
2. Left Join: Write a query to list all books and their authors, including books that
havent been sold.
SQL/MYSQL CODE:
3. Right Join: Write a query to display all authors and the books theyve written,
including authors who haven't written any books listed in the store.
SQL/MYSQL CODE:
4. Cross Join: Write a query to list every combination of customers and books (even if
they haven't bought the books).
SQL/MYSQL CODE:
5. UNION: Write a query to get a list of all customers and authors, ensuring no
duplicates.
SQL/MYSQL CODE:
6. INTERSECT: Write a query to list customers who have bought books written by a
specific author (look at the table to find a listed author).
SQL/MYSQL CODE:
7. EXCEPT: Write a query to list all books that have not been sold.
SQL/MYSQL CODE:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Programming Questions!