full join ,left join ,right join,inner join
一、full join
----- full join SELECT A.*, B.* FROM (SELECT 0 AS T1 FROM DUAL UNION SELECT 1 AS T1 FROM DUAL UNION SELECT 2 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) A FULL JOIN (SELECT 4 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) B ON A.T1 = B.T1
二、left join
---- left join SELECT A.*, B.* FROM (SELECT 0 AS T1 FROM DUAL UNION SELECT 1 AS T1 FROM DUAL UNION SELECT 2 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) A LEFT JOIN (SELECT 4 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) B ON A.T1 = B.T1 ----相当于 SELECT A.*, B.* FROM (SELECT 0 AS T1 FROM DUAL UNION SELECT 1 AS T1 FROM DUAL UNION SELECT 2 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) A, (SELECT 4 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) B WHERE A.T1 = B.T1(+)
三、rightjoin
---- right join SELECT A.*, B.* FROM (SELECT 0 AS T1 FROM DUAL UNION SELECT 1 AS T1 FROM DUAL UNION SELECT 2 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) A RIGHT JOIN (SELECT 4 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) B ON A.T1 = B.T1 ----相当于 SELECT A.*, B.* FROM (SELECT 0 AS T1 FROM DUAL UNION SELECT 1 AS T1 FROM DUAL UNION SELECT 2 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) A, (SELECT 4 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) B WHERE A.T1(+) = B.T1
四、inner join
---- inner join SELECT A.*, B.* FROM (SELECT 0 AS T1 FROM DUAL UNION SELECT 1 AS T1 FROM DUAL UNION SELECT 2 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) A INNER JOIN (SELECT 4 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) B ON A.T1 = B.T1 ----相当于 SELECT A.*, B.* FROM (SELECT 0 AS T1 FROM DUAL UNION SELECT 1 AS T1 FROM DUAL UNION SELECT 2 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) A, (SELECT 4 AS T1 FROM DUAL UNION SELECT 3 AS T1 FROM DUAL) B WHERE A.T1 = B.T1