Frontier
Join is one of the important operations of a relational database system, including common joins in SQL Server: INNER JOIN, outer join, and Cross join.
If we want to get data in two or more tables that match rows from one table to rows in another table, then we should consider using join, because the join specifically joins the table or function to query the attributes
CREATE TABLE structure
CREATE TABLE ta_a (id int,name nvarchar), CREATE TABLE ta_b (id int,name nvarchar); insert into Ta_a VALUES (1, ' Pirate INSERT into ta_a values (2, ' Monkey ') insert to Ta_a values (3, ' Ninja ') insert into ta_a values (4, ' Spaghe ') insert INTO T A_b values (1, ' Nuta ') insert into ta_b values (2, ' Pirate ') inserts into Ta_b values (3, ' Darth ') inserts into Ta_b values (4, ' Ni Nja ')
INNER JOIN (Inner join)
SELECT * from Ta_ainner join Ta_bon Ta_a.name=ta_b.name
All outer joins (full Outer join)
SELECT * from Ta_a full OUTER JOIN ta_bon ta_a.name=ta_b.name
Left OUTER join (Outer join)
SELECT * from Ta_aleft OUTER JOIN Ta_bon ta_a.name=ta_b.name
And look at how to take out a record without a table B, or a left outer join.
SELECT * from Ta_aleft OUTER JOIN ta_bon ta_a.name = Ta_b.namewhere ta_b.id is null
Look at another situation, but also with the full outer join, take out the intersection of a and B data
SELECT * from Ta_afull OUTER JOIN ta_bon ta_a.name=ta_b.namewhere ta_a.id are Nullor ta_b.id is NULL
End
The above is about the SQL join some simple knowledge of the collation, I hope you have a little help!
SQL Join Brief Introduction