班级:软件工程 1班姓名:刘辰欢学号: 2012551413 a. select title from course where dept name =’ Comp. Sci. ’ and credits =3 b. select distinct from ( student join takes using ( ID )) join ( instructor join teaches using ( ID )) using ( course id, sec id, semester , year ) where =’ Einstein ’ As an alternative to th join .. using syntax above the query can be written by enumerating relations in the from clause, and adding the corresponding join predicates on ID, course id, section id, semester , and year to the where clause. Note that using natural join in place of join .. using would result in equating student ID with instructor ID, which is incorrect. c. select max ( salary ) from instructor d. select ID, name from instructor where salary =( select max ( salary ) from instructor ) e. select course id, sec id, count ( ID ) from section natural join takes where semester =’ Autumn ’ and year = 2009 group by course id, sec id select course id, sec id,( select count ( ID ) from takes where = and = and takes . course id= section . course id and takes . section id= section . section id) from section where semester =’ Autumn ’ and year = 2009 f. select max ( enrollment ) from ( select count ( ID ) as enrollment from section natural join takes where semester =’ Autumn ’ and year = 2009 group by course id, sec id) g. w
数据库作业 来自淘豆网www.taodocs.com转载请标明出处.