l Find coursesthat ran in Fall 2009 or in Spring 2010
(select course_idfrom section where sem = ‘Fall’ and year = 2009)
union
(select course_idfrom section where sem = ‘Spring’ and year = 2010)
l Find coursesthat ran in Fall 2009 and in Spring 2010
(select course_idfrom section where sem = ‘Fall’ and year = 2009)
intersect
(select course_idfrom section where sem = ‘Spring’ and year = 2010)
l Find coursesthat ran in Fall 2009 but not in Spring 2010
(select course_idfrom section where sem = ‘Fall’ and year = 2009)
except
(select course_idfrom section where sem = ‘Spring’ and year = 2010)
并union,交intersect,差except。
空值NULL:
select name
from instructor
where salary is null
判断一个值是否为空值要用is, is not