Oracle data connection

The query results we have seen can be understood as being stored in a temporary table .

First, the difference between on and where

   (1) on is the condition used when the temporary table is generated , regardless of whether the condition in on is true, it will return all the records in the left (in the left connection) / right (right connection) side table .

   (2) where is a condition used after the temporary table is generated , and it is a condition for filtering the temporary table, and it will be filtered out if the condition is not met .

Second, the syntactic abbreviation of the table connection

                            Full name

                    Abbreviation

 inner join on

join on

 left outer join on

left join on

 right outer join on (right outer join on)

right join on (right join on)

 full outer join on (full outer join on)

full join on

Third, the summary of the table connection

(1) inner join (inner join): when two tables are joined to query, only the exact matching result sets in the two tables are kept .

     PS : Simply select * from a, b is the Cartesian product. For example, there are 3 data in table a and 3 data in table b, then the final result has 3 * 3 = 9 data. If you perform a join query on two tables: select * from a, b where a.id = b.id, (not recommended) is equivalent to: select * from a inner join b on a.id = b.id. Inner connection.

(2) left join (left join): when the two tables are connected and queried, all rows of the left table will be returned (even if there is no matching record in the right table), the rows of the right table that do not match will be in the form of null display.

(3) right join (right join): When the two tables are connected and queried, all rows of the right table will be returned (even if there are no matching records in the left table). Unmatched rows of the left table will be displayed in the form of null.

(4) full join (full join): When the two tables are connected and queried, regardless of whether they match, all data in the left and right tables will be returned . Equivalent to the union of left join and right join. 

Four, the legend shows the result set in the table connection

(1) Internal connection

(2) Left connection: Unmatched data in the right table will be displayed in NUll format

(3) Right connection: Unmatched data in the left table will be displayed in NUll format

(4) Fully connected

Published 77 original articles · 100 likes · 70,000+ views

Guess you like

Origin blog.csdn.net/super_DuoLa/article/details/102933362