Joining More Than Two Tables in SQL
📖 Scenario: You work at a small bookstore that keeps track of books, authors, and sales. The data is stored in three tables: books, authors, and sales. You want to find out which author sold which book and how many copies were sold.
🎯 Goal: Build an SQL query that joins the books, authors, and sales tables to show the book title, author name, and number of copies sold.
📋 What You'll Learn
Create the
books table with columns book_id and title.Create the
authors table with columns author_id and name.Create the
sales table with columns sale_id, book_id, and copies_sold.Add a column
author_id to the books table to link books to authors.Write an SQL query joining all three tables to get
title, name, and copies_sold.💡 Why This Matters
🌍 Real World
Bookstores and many businesses keep data in multiple tables and need to join them to get combined information.
💼 Career
Understanding how to join multiple tables is essential for database querying roles like data analyst, backend developer, and database administrator.
Progress0 / 4 steps