贵州两天自驾游攻略:给出关系模式如下:

来源:百度文库 编辑:高考问答 时间:2024/04/28 01:50:32
给出关系模式如下:
s(sno,sname,age,sex,sdept),各属性表示学号、姓名、年龄、性别、所在系
sc(sno,cno,g),各属性表示学号、课程编号、成绩
c(cno,cname),各属性表示课程编号、课程名字
写出下列的SQL语句:
1. 查询计算机系(cs)的男生的学号、姓名
2. 查询数据库原理的平均成绩
写出下面SQL语句的意思:
1. Select sno,sname from s where s.sdept not in (select sdept from s where sno=’1001’)

1 select sno,sname from s where sex='男' and sdept='cs'
2 select average(g) as pjcj from sc,c where sc.con=c.cno and c.cname='数据库原理'

3 选择没有学号为1001的学生的系的 所有学生的学号 和姓名