Multiple Table JOINs in MySQL
📖 Scenario: You are managing a small online bookstore database. The database has three tables: authors, books, and sales. You want to find out which authors have sold books, and details about those sales.
🎯 Goal: Build a MySQL query that joins the authors, books, and sales tables to list each author's name, the title of their book, and the number of copies sold.
📋 What You'll Learn
Create a table called
authors with columns author_id (INT) and author_name (VARCHAR).Create a table called
books with columns book_id (INT), title (VARCHAR), and author_id (INT).Create a table called
sales with columns sale_id (INT), book_id (INT), and copies_sold (INT).Write a SELECT query that uses JOINs to combine these tables and show
author_name, title, and copies_sold.Use INNER JOINs to only show books that have sales.
💡 Why This Matters
🌍 Real World
Online bookstores and many other businesses use multiple related tables to organize data about products, customers, and sales.
💼 Career
Understanding how to join multiple tables is essential for database querying roles, data analysis, and backend development.
Progress0 / 4 steps