Bird
0
0

Which of the following is the correct SQL syntax to perform a FULL OUTER JOIN between tables Invoices and Payments on the column InvoiceID?

easy📝 Syntax Q3 of 15
SQL - Advanced Joins
Which of the following is the correct SQL syntax to perform a FULL OUTER JOIN between tables Invoices and Payments on the column InvoiceID?
ASELECT * FROM Invoices FULL OUTER JOIN Payments ON Invoices.InvoiceID = Payments.InvoiceID;
BSELECT * FROM Invoices INNER JOIN Payments ON Invoices.InvoiceID = Payments.InvoiceID;
CSELECT * FROM Invoices LEFT JOIN Payments ON Invoices.InvoiceID = Payments.InvoiceID;
DSELECT * FROM Invoices RIGHT JOIN Payments ON Invoices.InvoiceID = Payments.InvoiceID;
Step-by-Step Solution
Solution:
  1. Step 1: Identify the join type

    The question asks for a FULL OUTER JOIN, which returns all rows from both tables, matching where possible.
  2. Step 2: Check syntax correctness

    SELECT * FROM Invoices FULL OUTER JOIN Payments ON Invoices.InvoiceID = Payments.InvoiceID; uses FULL OUTER JOIN with the correct ON clause matching InvoiceID columns.
  3. Final Answer:

    SELECT * FROM Invoices FULL OUTER JOIN Payments ON Invoices.InvoiceID = Payments.InvoiceID; -> Option A
  4. Quick Check:

    FULL OUTER JOIN includes all rows from both tables [OK]
Quick Trick: FULL OUTER JOIN returns all rows from both tables [OK]
Common Mistakes:
MISTAKES
  • Confusing FULL OUTER JOIN with INNER JOIN
  • Using LEFT or RIGHT JOIN instead of FULL OUTER JOIN
  • Omitting the ON clause or using incorrect columns

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes