SQL中的Filter, join, semi-join等概念的釋義

chenfeng發表於2016-03-29

1、semi-join(半連線)(來自:)
半連線返回表中能夠與另一表中連線的記錄(並不執行一次全連線),它並沒有一個明確的語法格式。
A semi-join returns rows from one table that would join with another table without performing a complete join. It doesn't have explicit syntax. 

例子,從表Customers中選擇其ID出現在表Sales中的客戶的ID和Name:
select * 
from Customers C 
where exists ( 
select * 
from Sales S 
where S.Cust_Id = C.Cust_Id 



Cust_Id Cust_Name 
----------- ---------- 
2 John Doe 
3 Jane Doe
來看看這篇文章:http://blog.csdn.net/tiwen818/article/details/7103711,比較詳細的介紹了Oracle中的半連線。慚愧啊,話說這個帖子裡面的這個語句我就沒看懂:
create table table_1
as select
cast(rownum as int) a,
cast(rownum+10 as int) b,
cast(dbms_random.string('i',10) as varchar2(10)) c
from dual connect by level<=500000
看了這篇文章http://yesican.blog.51cto.com/700694/269814和這篇才明白。


2、join(連線)(來自:)
總共有四種連線型別:
內連線:
全連線:
左連線:
右連線:


3、aggregation(聚合)(來自:)
聚合函式對一組值執行計算,並返回單個值。 除了 COUNT 以外,聚合函式都會忽略空值。 聚合函式經常與 SELECT 語句的 GROUP BY 子句一起使用。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2071785/,如需轉載,請註明出處,否則將追究法律責任。

相關文章