1. 基本的关系操作


<aside> 📖 常用的关系操作

2. 关系代数


<aside> 📖 关系代数

关系代数是一种抽象的查询语言,它用对关系的运算来表达查询

Untitled

<aside> 📖 记号

<aside> 📖 选择 Selection

Untitled

选择(Selection)又称为限制(Restriction)

$$ ⁍ $$

选择运算是从关系R中选取使逻辑表达式F为真的元组,是从行的角度进行的运算

</aside>

<aside> 📖 投影 Projection

Untitled

从R中选择出若干属性列组成新的关系

$$ \Pi_A(R)=\{t[A]|t\in R\} $$

<aside> 📖 连接 Join

Untitled

连接(Join)也称为θ连接

是从两个关系的笛卡尔积中选取属性间满足一定条件的元组

$$ R\underset{A\theta B}\bowtie S = \{\overset{\large\frown}{t_r t_s} | t_r ∈ R∧t_s ∈S∧t_r[A]~θ~t_s[B] \} $$

$$ A\bowtie_\theta B=\sigma_\theta{(A\times B)} $$

Untitled

</aside>

<aside> 📖 悬浮元组(Dangling tuple)

<aside> 📖 外连接(Outer Join)