A. sql查询三门科目90分以上的学生
select name from table_name where grade>90 group by name having count(*)>2;
B. 从学生选课数据库中查询选修“数据库原理”课并且成绩在90分以上的学生名单,请写出SQL语句.
select sname from student
where sno in(
select a.sno from studentcourse a join course b
on a.cno=b.cno
where b.cname='数据库原理' and a.score>90)
select a.sclass as 班级,count(*) as 不及格人数 from
student a join studentcourse b
on a.sno=b.sno
where b.score<60
group by a.sclass
C. sql查询语句的问题,“列出成绩大于90的所有学生的姓名、专业、课程名称、成绩”这条语句怎么写
可以参考下面的代码:
select s.姓名, s.专业, sc.成绩, c.课程名称
from 学生基本情况表 s, 成绩表 sc, 课程表 c
where s.学号 = sc.学号 and c.课程编号 = sc.课程编号
and sc.成绩 > 90
(3)sql90分以上的语句扩展阅读:
sql语句
删除列:
Alter table table_name drop column column_name--从表中删除一列
添加主键:
Alter table tabname add primary key(col)
平均:
select avg(field1) as avgvalue from table1
最大:
select max(field1) as maxvalue from table1
D. 用SQL语句三种方法查询秋季学期有2门以上课程获90分以上成绩的学生名
方法一:连接
select distinct sname from student,sc,course
where student.sno=sc.sno and course.cno=sc.cno
and grade>=90 and semester='秋'
group by student.sno having count(*)>=2
方法二:嵌套
select sname from student where sno in(
select sno from sc where grade>=90 and cno in(
select cno from course where semester='秋')
group by sno having count(*)>=2)
主要是以上两种方法,其它方法都是用以上两种方法演变过来,这里主要用group by sno 对每个学生进行分组,然后用having count(*)>=2对每组进行筛选.
方法三:
select sname from student,(
select sno from sc where grade>=90 and cno in(
select cno from course where semester='秋')
group by sno having count(*)>=2) t where student.sno=t.sno
方法四:
select sname from student where exists(
select * from sc where (
select count(*) from sc where sno=student.sno and grade>=90 and cno in
(select cno from course where semester='秋'))>=2)
类似的方法有很多,主要是连接法和嵌套法.
E. SQL语句查询查看90分以上学生的成绩.课程名称.学生姓名怎么写
select 成绩,课程名称,姓名 from 成绩,学生基本信息,课程名称 where学生基本信息.学号=成绩.学号 and 成绩.课程编号=课程名称.课程编号 and 成绩>90