The conditions of the JOIN ON clause in SQL are used to merge tables through comparison conditions between columns. The conditional syntax is: JOIN table2 ON table1.column = table2.column, where the columns must have compatible data types. If the connection type is not specified, INNER JOIN is used by default.
Conditions of JOIN ON clause in SQL
What is JOIN ON clause?
The JOIN ON clause is used to merge two or more tables in a SQL query. It specifies the conditions between the columns of the joined tables.
Conditional syntax
The conditional syntax of the JOIN ON clause is as follows:
<code class="sql">JOIN table2 ON table1.column = table2.column</code>
Among them:
table1
and table2
are the two tables to be joined. column
are the two columns to be compared. =
is a comparison operator. Conditional Examples
The following are some examples of JOIN ON clause conditions:
JOIN orders ON customers. id = orders.customer_id
JOIN products ON categories.id = products.category_id
JOIN employees ON departments.id = employees.department_id
Note:
The above is the detailed content of join on followed by conditions in sql. For more information, please follow other related articles on the PHP Chinese website!