Question
In SQL, which of the following is the correct syntax for
joining three tables—customers, orders, and products—where orders and products share the column product_id, and customers is linked to orders through customer_id?Solution
The correct query syntax for joining three tables in SQL is Option A, where each join explicitly specifies the tables being linked and the conditions under which they are linked. Here, the INNER JOIN ensures that only rows that match the condition (i.e., customer_id and product_id matches) in all three tables will appear in the result. This is a standard way to retrieve data from related tables, ensuring that all related data is represented. Why Other Options Are Incorrect: • B: While this query uses the correct WHERE clause to specify join conditions, it lacks the clarity of using explicit JOIN syntax, which is recommended for readability and standard SQL practices. • C: This query lacks proper syntax for joining multiple tables. JOIN needs to be explicitly written with conditions for each pair of tables, not just in one statement. • D: The LEFT JOIN is used for customers and orders, which is a valid syntax, but the use of JOIN after a LEFT JOIN without an explicit condition is incorrect and leads to ambiguity in the query. • E: A RIGHT JOIN is used on orders, which is incorrect here since you are primarily interested in customers and their orders. This would potentially omit customers who have no orders.
Who has been appointed as the new coach of the Indian Men's Hockey team?
What is the revised RBI inflation forecast for Q1 of FY26?
- Which country is the top source of Foreign Direct Investment (FDI) into Dubai in 2024?
As of 31 December 2025, the cumulative renewable energy capacity awarded by SECI exceeded:Â
In 2023, which organization launched the UDGAM portal?
Which programme supported domestic participation of MSMEs in the MH‑60R helicopter sustainment ecosystem?
Home Ministry has declared Delhi headquarters of Security Printing and Minting Corporation of India Ltd. (SPMCIL) as a ‘prohibited place’ un...
How many lane kilometres of bituminous concrete road were laid to set one of the records?
The Telangana government and UNESCO have entered into a collaboration to implement which recommendation focused on the ethics of Artificial Intelligence...
How much investment and commitments were at risk due to the revocation of the Chabahar Port waiver?