Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Join Summary in SQL

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The syntax format of SQL in oracle is as follows:

Select table1.column, table2.column

From table1

[natural join table2] |

[join table2 using (column_name)] |

[join table2

On (table1.column_name = table2.column_name)] |

[left | right | full outer join table2

On (table1.column_name = table2.column_name)] |

[cross join table2]

Select table1.column,table2.colunm from table1 natural join table2

Natural join automatically selects all the same fields of table1 table2 to connect, and the selected fields must be of the same type

For the same field column, you cannot add a table prefix, such as table1.column_name. If column_name is a join field, a syntax error will be reported.

Select table1.column_name, table2.column_name from table1 join table2 using column_name

The difference with 1 is that if table1 and table2 have multiple identical fields, if you want to use only one field, use the using clause.

Like 1, fields in the using clause cannot be prefixed.

The on clause is used in cases where field names are different in table1 and table2

Alter join is used to list clauses that do not meet the criteria. Left displays only the left table, right only shows the right table, and full shows

Cross join is equivalent to multiplying two tables.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report