Why Combining Result Sets is Useful
📖 Scenario: You work at a small bookstore that tracks sales in two separate tables: online_sales and store_sales. You want to see all sales together to understand total sales better.
🎯 Goal: Build a combined list of all sales from both online_sales and store_sales tables using SQL UNION to see all sales in one result set.
📋 What You'll Learn
Create two tables:
online_sales and store_sales with columns sale_id and amountInsert exact sales data into both tables
Write a SQL query using
UNION to combine sales from both tablesOrder the combined results by
sale_id💡 Why This Matters
🌍 Real World
Combining sales data from different sources helps businesses get a complete view of their transactions.
💼 Career
Database professionals often combine data from multiple tables or databases to create reports and insights.
Progress0 / 4 steps