Get the App
SLTechnology News&Howtos  ›  Database  › 

How to join query in SQL Server

Shulou Source: shulou.com Published: 2022-05-31 19:33:35 09月20日 Update

SQL Server how to join the query, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

What is a join query?

Concept: query data from two or more tables based on the relationship between their columns.

Objective: to realize multiple table query operations.

Once you know the concept of join query, when do you use join query?

It is generally used to associate two or more data tables. It seems a little abstract. For example, let's make two tables: the student table (T_student) and the class table (T_class).

T_student

T_class

Connection standard syntax format:

The join syntax format of the FROM clause defined by the SQL-92 standard is:

FROM join_table join_type join_ table [on (join_condition)]

Where join_table indicates the name of the table participating in the join operation, the join can operate on the same table or multiple tables, and the join on the same table is also called self-join. Join_type indicates the connection type. Join_condition refers to the connection condition.

Connection type:

There are three kinds of connections: inner connection, outer connection and cross connection.

Internal connection (INNER JOIN)

Use the comparison operators (including =, >, =, and!

Tags: Results conditions queries concepts two operators operations full joins clauses data natural Cartesian same product crossover content multiple datasheets methods more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Xiaomi vpn Apple Redmi