key words: 表連接
內連接
select statement from table1 join table2 on table1.fieled1 = table2.field2
select statement from table1 ,table2 where table1.field1 = table2.field2
左連接
select .....table1 left outer join table2 on table1....= table2.field
select .... table1 ,table2 where table1.field1= table2.field(+)
合并查詢
union:獲得并集,并自動去掉重復行,并且會以第一列的結果進行排序
union all: 獲得并集,但不去掉重復行,也不排序
子查詢:
對于多行子查詢,必須要用多行運算符(IN,NOT IN,EXISTS,NOT EXISTS,ALL,ANY)
內連接
select statement from table1 join table2 on table1.fieled1 = table2.field2
select statement from table1 ,table2 where table1.field1 = table2.field2
左連接
select .....table1 left outer join table2 on table1....= table2.field
select .... table1 ,table2 where table1.field1= table2.field(+)
合并查詢
union:獲得并集,并自動去掉重復行,并且會以第一列的結果進行排序
union all: 獲得并集,但不去掉重復行,也不排序
子查詢:
對于多行子查詢,必須要用多行運算符(IN,NOT IN,EXISTS,NOT EXISTS,ALL,ANY)