| 關系代數運算符 | 對應sql語句 | ||||||
| 聚合操作 | |||||||
| ∪ (UNION)並 | |||||||
| ∩ (INTERSECTION)交 | |||||||
| - (DIFFERENCE)差 | |||||||
| × (Cartesian PRODUCT)笛卡爾積 | from | ||||||
| 純關系操作 | |||||||
| π (PROJECT)投影 | select | ||||||
| σ (SELECT)選擇 | where | ||||||
| ⋈ (JOIN)鏈接 | JOIN(mysql> SELECT a.age, b.author FROM books a INNER JOIN books2 b ON a.age>25;) | ||||||
| ÷ (DIVISION)除 | exists 和not exists(select * from books A where not exists(select age from books8 B WHERE A.age=B.age);) | ||||||
| > 大於 | |||||||
| >=大於等於 | |||||||
| < 小於 | |||||||
| <=小於等於 | |||||||
| = 等於 | |||||||
| !=不等於 | |||||||
| ∧ 與 | |||||||
| ∨ 或 | |||||||
| ¬ 非 | |||||||
| between 在兩個值范圍內查找 | |||||||
| like 按通配符查找 | |||||||
| regexp 按正則表達式查找 | |||||||
| 組合條件 and, or |
select * from table_name where coll = xxx and col2 = xx or col3 > x; | ||||||
