DS0-001 · Question #12
A business analyst is using a client table and an invoice table to create a database view that shows clients who have not made purchases yet. Which of the following joins is most appropriate for the…
The correct answer is D. LEFT JOIN ON Client.Key = Invoice.Key WHERE BY Invoice.Key IS NULL. To find clients with no purchases, you need a LEFT JOIN from the Client table to the Invoice table, then filter WHERE Invoice.Key IS NULL. The LEFT JOIN returns all rows from Client regardless of whether a matching invoice exists - unmatched clients will have NULL in all…
Question
A business analyst is using a client table and an invoice table to create a database view that shows clients who have not made purchases yet. Which of the following joins is most appropriate for the analyst to use to create this database view?
Options
- AINNER JOIN ON Client.Key = Invoice.Key
- BRIGHT JOIN ON Client.Key = Invoice.Key WHERE BY Client.Key IS NULL
- CLEFT JOIN ON Client.Key = Invoice.Key
- DLEFT JOIN ON Client.Key = Invoice.Key WHERE BY Invoice.Key IS NULL
How the community answered
(34 responses)- A12% (4)
- B3% (1)
- C3% (1)
- D82% (28)
Explanation
To find clients with no purchases, you need a LEFT JOIN from the Client table to the Invoice table, then filter WHERE Invoice.Key IS NULL. The LEFT JOIN returns all rows from Client regardless of whether a matching invoice exists - unmatched clients will have NULL in all Invoice columns. The WHERE Invoice.Key IS NULL clause then filters to show only those unmatched clients (i.e., clients who have never made a purchase). Choice C (LEFT JOIN without the WHERE clause) returns all clients including those who have made purchases. Choice A (INNER JOIN) returns only clients who DO have invoices - the opposite of what is needed. Choice B uses a RIGHT JOIN with the wrong NULL check.
Topics
Community Discussion
No community discussion yet for this question.