Bird
0
0

Consider tables:

medium📝 query result Q5 of 15
SQL - INNER JOIN
Consider tables:
Invoices(InvoiceID, ClientID)
Clients(ClientID, ClientName)
What will this query return?
SELECT i.InvoiceID, c.ClientName FROM Invoices i LEFT JOIN Clients c ON i.ClientID = c.ClientID;
AAll invoices with client names where available, NULL if no client matches
BOnly invoices with matching clients
CAll clients with their invoices, NULL if no invoice exists
DAll invoices and clients combined without condition
Step-by-Step Solution
Solution:
  1. Step 1: Understand LEFT JOIN

    LEFT JOIN returns all rows from the left table (Invoices) and matching rows from the right (Clients).
  2. Step 2: Analyze unmatched rows

    If no matching client exists, client columns are NULL.
  3. Final Answer:

    All invoices with client names where available, NULL if no client matches -> Option A
  4. Quick Check:

    LEFT JOIN keeps all left rows, fills NULL for no match [OK]
Quick Trick: LEFT JOIN keeps all left table rows [OK]
Common Mistakes:
MISTAKES
  • Confusing LEFT JOIN with INNER JOIN
  • Expecting all clients regardless of invoices
  • Assuming NULLs never appear

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes