数据库原理

来源:互联网 发布:好用用打谱软件 编辑:程序博客网 时间:2024/05/20 02:25

 

1.select sno,sname from student where sage>25 and ssex='女'


2.select sname from student,sc,course
where student.sno=sc.sno and sc.cno=course.cno and cname='数据库'

3.select count(*) from sc where cno='2'


4.select sno from sc group by sno having avg(grade)>=80


5.select sdept,count(sno)from student group by sdept

6.select student.sno,sname from student,sc,course where student.sno=sc.sno and sc.cno=course.cno and grade<60 and cname='数据库'

7.select first.cno,second.ccredit
from course first,course second
where first.cpno=second.cno


8.select * from sc where grade between 60 and 80

9.select * from sc where grade in( 85,86,88)

10.select * from student where sname not like'王%'

11.select * from student order by sdept,sage desc

 

13.select *from student where sname like'_小%'and ssex='女'

14.select top 3 sno,grade from sc order by grade desc

15.select sno,grade from sc order by sno,grade desc


16.select sno,count(sno),avg(grade) from sc group by sno having count(sno)>=2

17.select sno,sname,sage from student where sage>(select sage from student where sname='刘晨')

18.select sno,sname  from student where sno in(select sno from sc group by sno having sum(grade)>150)
  
19.SELECT  a.sname, b.sname,a.sdept FROM student a,student b WHERE a.sno<>b.sno AND a.sdept=b.sdept

20.SELECT X.sno FROM sc X,sc Y WHERE X.sno=Y.sno AND X.cno='1' AND Y.cno='2'

 

 

1)查询年龄大于25岁的女学生的学号和姓名。

2)查询选修了“数据库系统概论”课程的学生姓名。

3)统计选修2号课程的人数。

4)查询平均成绩大于80分的学生的学号。

5)统计每个系的学生人数。

6)查询选修数据库课程并且成绩不及格的学生学号和姓名。

7)查询每门课程先修课的学分。

8)查询成绩在6080之间的所有记录。

9)查询成绩为858688的记录。

10)查询所有不姓的学生记录。

11)以系别和年龄从大到小的顺序查询Student表中的全部记录。

12)统计男女生分别有多少人。

12.select ssex,count(sno) from student group by ssex

13)查询姓名的第二个字为“小”字的女生信息。

14)查询成绩最高的三个学生的学号和成绩。

15)查询学生的成绩信息,先按学号升序排序,再按成绩降序排序。

16)查询至少选修了两门课的学生的学号,选修课程数和选修的平均分数。

17)查询所有比刘晨大的学生的学号,姓名,年龄。

18)求出总分大于150的学生的学号、姓名。

19)列出那些专业相同的学生相应的姓名及专业信息。

20)求至少选修1号课和2号课的学生的学号。

 

原创粉丝点击