union、intersect、except对应于∪、∩、-运算
并运算unionunion自动去除重复,如果想保留所有重复,则用union all代替union
(select course_id from section where semester = 'Fall' and year = 2009) union (select course_id from section where semester = 'Spring' and year = 2010)交运算intersect
intersect自动去除重复,如果想保留所有重复,则用intersect all代替intersect
(select course_id from section where semester = 'Fall' and year = 2009) intersect (select course_id from section where semester = 'Spring' and year = 2010)差运算except
except在操作前自动去除输入重复,如果想保留所有重复,则用except all代替except
(select course_id from section where semester = 'Fall' and year = 2009) except (select course_id from section where semester = 'Spring' and year = 2010)空值
- 算术运算中,如果算术表达式的任一输入为空,则该算术表达式(+、-、*、/)结果为空
- SQL将涉及空值的任何比较运算结果视为unknown,这是true和false之外的第三个逻辑值
- 在and or not布尔运算中,只有true or unknown结果为true,其他涉及unknown的布尔运算结果都为unknown
- 如果where子句计算出false或unknown,都不会被加入到结果集中
- 用is null试空值,结果为true,is not null,则为false
- 某些SQL还允许使用is unknown和is not unknown来测试一个表达式的结果是否为unknown
- 比较两个元组对应属性值时,都是null,那么判断上是相同的,这与比较运算null = null 结果为unknown不一样



