Bird
0
0

Consider tables Products and Sales with columns Products.ID, Sales.ProductID, and Sales.SaleDate. What does this query return?

medium📝 query result Q5 of 15
SQL - INNER JOIN
Consider tables Products and Sales with columns Products.ID, Sales.ProductID, and Sales.SaleDate. What does this query return?
SELECT Products.Name, Sales.SaleDate FROM Products INNER JOIN Sales ON Products.ID = Sales.ProductID AND Sales.SaleDate > '2024-01-01';
AAll products regardless of sale date
BProducts sold after January 1, 2024
CSales before January 1, 2024
DProducts never sold
Step-by-Step Solution
Solution:
  1. Step 1: Understand join conditions

    The join matches product IDs and filters sales with SaleDate after 2024-01-01.
  2. Step 2: Determine output rows

    Only products with sales after that date appear with their sale dates.
  3. Final Answer:

    Products sold after January 1, 2024 -> Option B
  4. Quick Check:

    Join filters sales by date > 2024-01-01 [OK]
Quick Trick: Join conditions can include date filters [OK]
Common Mistakes:
MISTAKES
  • Assuming all products appear
  • Confusing join condition with WHERE clause
  • Ignoring the date filter in join

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes