Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2291043
  • 博文数量: 266
  • 博客积分: 5485
  • 博客等级: 大校
  • 技术积分: 3695
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-20 11:05
个人简介

多读书,多做事,广交朋友,趣味丛生

文章分类

全部博文(266)

分类: 数据库开发技术

2008-08-20 14:55:13

就是sql书上82页那三个表
让查询课程号‘1’的成绩比课程号‘2’的成绩高的学生姓名

student(Sno,Sname,Ssex,Sage。Sdept)
Course(Cno,Cname)
SC(Sno,Cno,Grade)

select student.sname from student,cource,sc where student.sno=sc.sno and cource.cno=sc.cno and

create table sc(
sno int(5),
cno int(5),
grade float(5,2)
)

select student.sname from student,sc,cource
where select sc.grade where cno=1

select sname from student
where sno IN
(select sno from sc where cno=1);
阅读(1632) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2008-08-20 17:38:05

select sname from student where exists (select * from sc where sno = student.sno and cno=1 and grade> (select grade from sc where sno=student.sno and cno=2))