Bird
0
0

Consider these tables:

medium📝 Debug Q14 of 15
SQL - INNER JOIN
Consider these tables:
Products(ProductID PK, Name)
Sales(ProductID FK, Quantity)
Why does this query cause an error?
SELECT * FROM Products JOIN Sales ON Products.ID = Sales.ProductID;
AColumn Products.ID does not exist, causing an error
BForeign key cannot be used in JOIN condition
CJOIN syntax is incorrect, missing JOIN type
DSales table must be listed first in FROM clause
Step-by-Step Solution
Solution:
  1. Step 1: Check column names in JOIN condition

    The Products table has ProductID as primary key, not ID.
  2. Step 2: Identify cause of error

    Using Products.ID causes an error because that column does not exist.
  3. Final Answer:

    Column Products.ID does not exist, causing an error -> Option A
  4. Quick Check:

    Wrong column name in JOIN = error [OK]
Quick Trick: Verify column names exactly before joining [OK]
Common Mistakes:
MISTAKES
  • Using wrong or misspelled column names
  • Thinking foreign keys can't be joined
  • Assuming JOIN type is mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes