INNER JOIN with multiple conditions
📖 Scenario: You are managing a small bookstore database. You have two tables: Books and Sales. You want to find the sales details for books that match both the book ID and the store location.
🎯 Goal: Build an SQL query using INNER JOIN with multiple conditions to combine the Books and Sales tables on book_id and store_location.
📋 What You'll Learn
Create a
Books table with columns book_id, title, and store_location.Create a
Sales table with columns sale_id, book_id, store_location, and quantity.Insert the exact data rows provided into both tables.
Write an
INNER JOIN query joining Books and Sales on both book_id and store_location.Select
title, store_location, and quantity from the joined tables.💡 Why This Matters
🌍 Real World
Bookstores and many businesses use databases to track inventory and sales across multiple locations. Joining tables on multiple conditions helps get accurate combined data.
💼 Career
Knowing how to write INNER JOIN queries with multiple conditions is essential for data analysts, database administrators, and backend developers working with relational databases.
Progress0 / 4 steps