Home > Database > Oracle > body text

How to use join on in oracle

下次还敢
Release: 2024-04-30 07:15:23
Original
708 people have browsed it

The JOIN ON operator in Oracle is used to join tables based on common columns. Its syntax is: SELECT ... FROM table name 1 JOIN table name 2 ON table name 1.common column = table name 2.common List. This operator can be used to join multiple tables and supports other comparison operators and AND operators.

How to use join on in oracle

JOIN ON usage in Oracle

The JOIN ON operator is used in Oracle to join two or more Tables are joined based on common columns. The syntax format is as follows:

<code>SELECT 列名1, 列名2, ...
FROM 表名1
JOIN 表名2 ON 表名1.公用列 = 表名2.公用列</code>
Copy after login

Detailed usage explanation

  • ##Table name 1 and Table name 2 are required Joined tables.
  • Common column is the column that connects the two tables and must have the same data type.
  • = is a connection condition, indicating that the values ​​of two common columns are equal.

Example

The following example will

Table1 and Table2 based on column IDConnection:

<code>SELECT *
FROM 表1
JOIN 表2 ON 表1.ID = 表2.ID</code>
Copy after login

Result:

<code>ID | 名称 | 值
----+------+-----
1  | John  | 100
2  | Mary  | 200</code>
Copy after login

Notes

    If the common column is empty, then This row will not be included in the join results.
  • You can join multiple tables by using an ON clause in each join.
  • Other comparison operators can be used, such as >, <, >=, and <=.
  • You can also use the AND operator to specify multiple connection conditions.
  • The JOIN ON operator has the same effect as the INNER JOIN operator, but the syntax is more concise.

The above is the detailed content of How to use join on in oracle. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!