JOIN functions: Basic tasks

Working with JOINS

When working with multiple tables in SQL, we usually use JOIN statements. To learn more about different types of joins in SQL, we highly recommend watching the following YouTube videos:

 

SQL JOINS Tutorial for beginners | Practice SQL Queries using JOINS - Part 1

 

 

SQL JOINS Tutorial for beginners | Practice SQL Queries using JOINS - Part 2

 

 

If you prefer the reading material, we recommend exploring this document.

 

Let's go back to our Bookstore dataset and solve a couple of basic SQL tasks using joins.

Task #1: List Books with Author Names: Display the title of each book along with the name of its author.

This task involves merging information from two different tables: one containing book details and the other containing author names. The goal is to pair each book with its author. If an author’s details are unavailable or missing, the book is still included in the list, but the author's name is left blank. This approach ensures a complete catalog that pairs books with their authors wherever possible.

Objective: Create a comprehensive book catalog that includes the title of each book along with its author's name.

Expected Result: A catalog listing each book with details such as title, genre, and publish date, alongside the name of its author.

Basics of SQL Joins

Data Source: dataacademykz.bookstore.{table_name}

 

Task #2: Analysis of Original Price Versus Sale Price Differences for Books.

In this task, we're delving into the pricing strategies of a bookstore by comparing the listed (original) prices of books with the prices at which they were actually sold in orders. This comparison helps in understanding the store's discounting practices or instances where books might have sold for more than their original price.

Objective: Conduct an analysis to compare the original price of books with their sale price in each order.

Expected Result: A detailed report showing the original and sale prices of books for each order, along with the calculated difference between these prices.

SQL Join Basics

Data Source: dataacademykz.bookstore.{table_name}

 

Task #3: Comprehensive Order Summary with Customer and Book Details.

This task involves compiling a comprehensive summary of book orders from a bookstore. For each order, the report should provide details about who placed the order, what book they bought, and the author of the book. This multi-dimensional view of each order is invaluable for understanding customer preferences and the popularity of different books and authors.

Objective: Create a detailed report for each book order, including information about the customer, the book, and the author.

Expected Result: A detailed summary for each order, including the customer's name, the title of the book ordered, and the name of the author.

SQL Joins Basics

Data Source: dataacademykz.bookstore.{table_name}