How do INNER JOIN and LEFT JOIN and RIGHT JOIN?

xiaoxiao2021-03-06  64

Declare @A Table (CA1 INT, CA2 INT) Declare @B Table (CB1 INT, CB2 INT) INSERT @A Values ​​(1,1) Insert @A Values ​​(2, 2) Insert @B VALUES (1, 1) Insert @B Values ​​(3, 3)

- Left: Select * from @a aa left join = bb.cb1 - Right: Select * from @a aa right join @B bb on aa.ca1 = bb.cb1 - SELECT * from @a aa join @B bb on aa.ca1 = bb.cb1 - Outside: SELECT * from @a aa full join @B bb on aa.ca1 = bb.cb1 - complete select * from @ a, @ B

==============

Cross Join is the number of Cartesian products is a number of rows of tables by another table. A left Join B: Return to a full line of A - "The row satisfied in B and does not satisfy in B (with NULL instead) A Right Join B: Also, it is just AB to change Full Join Returns the line of rows in two tables. LEFT JOIN Right JoinNer Join only returns two table connection columns

转载请注明原文地址:https://www.9cbs.com/read-119530.html

New Post(0)