四、集合操作

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

posted @ 2012-10-30 16:31  he_qiao_2010  阅读(54)  评论(0)    收藏  举报