DATA-MANAGEMENT-FOUNDATIONS practice question 1 of 15

Which clause is used to specify the join columns when performing a join in MySQL?

Full set: 60 questions

Domain Data Querying

Answer options
A: AS
B: JOIN
C: ON Correct answer
D: AND
Correct Answer:
C. ON
Explanation

In SQL, specifically within MySQL, the ON clause is used to specify the condition for joining two or more tables. It follows the JOIN clause and defines the logical relationship between the tables, typically by equating the values of a primary key column in one table with a foreign key column in another. This condition acts as a filter, determining which rows from the tables should be combined to form the result set. The ON clause is a fundamental part of the explicit JOIN syntax.

Why Incorrect

A. AS: The AS keyword is used to assign a temporary, alternative name (an alias) to a table or column in a query.
B. JOIN: The JOIN clause specifies the type of join (e.g., INNER JOIN, LEFT JOIN) and the table to be joined, but it does not specify the columns used for the condition.
D. AND: The AND operator is a logical operator used to combine multiple conditions within a WHERE or ON clause, not to introduce the primary join condition itself.

References

1. Official MySQL Documentation:

MySQL 8.0 Reference Manual, Section 15.2.13.2, "JOIN Clause". The official syntax is presented as: tablereference JOIN tablefactor [joinspecification]. The joinspecification is defined as ON searchcondition | USING (joincolumnlist). This explicitly shows ON as the clause for the search condition.

2. University Courseware:

Stanford University, CS 145 (Introduction to Databases), "SQL Joins" course material. The documentation states, "The ON clause specifies the join condition, which is a logical expression used to identify the rows to be joined."

3. Academic Publication (Textbook):

Silberschatz, A., Korth, H. F., & Sudarshan, S. (2020). Database System Concepts (7th ed.). McGraw-Hill. In Chapter 4, "Intermediate SQL," Section 4.1.1, "Join Expressions," the text explains the on condition: "The on condition allows a general predicate over the attributes of the relations appearing in the from clause." (p. 136).

Scroll to Top