關係代數
relational algebra
演算
和 (union)$ R\cup SR union S
差 (difference)$ R-SR except S
交はり (交差。共通。積。intersection)$ R\cap SR intersect S
直積 (Cartesian product)$ R\times Sselect * from R, S
制限 (restriction、選擇 (selection))$ \sigma_\varphi(R)select * from R where \varphi
射影 (projection)$ \pi_\beta(R)select \beta from R
結合 (join)
內結合 (inner join)$ R\Join_{A\theta B}S
等結合 (equijoin)$ R\Join_{A=B}SR join S on R.A = S.B
自然結合 (natural join)$ R\Join SR natural join S
準結合 (半結合。semijoin)$ R\vartriangleright<Sselect R.* from R join S on R.A = S.B
外結合 (outer join)
左外結合 (left outer join)$ R~{\rm =X}~SR left outer join S
右外結合 (right outer join)$ R~{\rm X=}~SR right outer join S
完全外結合 (full outer join)$ R~{\rm =X=}~SR full outer join S
商 (division)$ R\div S
屬性名變更 (rename)$ \beta_{\lbrack{\rm new}\larr{\rm old}\rbrack}(R)select old as new from R
擴張 (extend) select *, f(R) from R
要約 (summarize) select R.A, f(B) from R group by R.A