Get the App
SLTechnology News&Howtos  ›  Database  › 

What is the sql left join command

Shulou Source: shulou.com Published: 2022-05-31 17:40:05 09月20日 Update

This article mainly introduces "what is sql left join command". In daily operation, I believe many people have doubts about what is sql left join command. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what is sql left join command"! Next, please follow the editor to study!

Example table a

Aid adate

1 a1

2 a2

3 a3

Table b

Bid bdate

1 b1

2 b2

4 b4

The two tables are connected to each other. To take out the same fields of id

Select * from an inner join b on a.aid = b.bid this is to take out only the matching data.

What is taken out at this time is:

1 a1 b1

2 a2 b2

Then left join refers to:

Select * from a left join b on a.aid = b.bid

First, take out all the data in table a, and then add the data that matches aformab.

What is taken out at this time is:

1 a1 b1

2 a2 b2

3 A3 null character

There is also right join.

It means to take out all the data in table b first, and then add the data that matches aforme b

What is taken out at this time is:

1 a1 b1

2 a2 b2

4 null character b4

LEFT JOIN or LEFT OUTER JOIN.

The result set of the left outer join includes all rows of the left table specified in the LEFT OUTER clause, not just the rows matched by the join column. If a row of the left table does not match in the right table, all select list columns of the right table in the associated result set rows are null.

At this point, the study of "what is the sql left join command" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Data commands learning more null characters results help practical same next not only two center-right middle finger outreach clauses fields articles methods theory Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Xiaomi OPPO Reno Docker MySQL