33. 查询成绩比该课程平均成绩低的同学的成绩表. select * from score a where a.degree between 0 and( select avg(degree) from score b where a.cno=b.cno ) 34. 查询所有任课教师的Tname和Depart. select tname,depart from teacher where tno in( select tno from course ) 35 . 查询所有未讲课的教师的Tna
一.SQL语言查询选修了全部课程的学生的学号和姓名. 两种解决途径: 第一种: 我们可以表示为在SC表中某个学生选修的课程数等于C表中课程总数.相应的SQL语言如下: select S#,SNAME from S where S# in (select S# from SC group by S# --根据Sno分组,统计每个学生选修了几门课程.如果等于C表课程的总数,就是我们要找的S# having count(*) = (select count(*) from C))--统计C表中共有几门
解法一: select courseno,stuno,avg(score) '平均分最高值'--这里是求平均,后面的条件是过滤最大值的 from tablename group by courseno,stuno having avg(score) >= all (select avg(score) sco--这里是过滤最大值 from tablename group by courseno) 解法二: select top 1 with ties courseno,avg(score) '平均
select sname from student where not exists (select * from course where not exists (select * from sc where sno =student.sno and cno=course.cno); 最内部的 select * from sc where sno=student.sno and cno = course.cno是查询出所有已经选择过课程的学生及相应课程,select * from cour
Console.WriteLine("请输入学生人数:"); int n=int.Parse(Console.ReadLine()); ArrayList arr= new ArrayList(); ; i <n; i++) { Console.WriteLine(); arr.Add(int.Parse(Console.ReadLine())); } foreach(int a in arr) { Console.Write(a+"\t"); } Conso
import java.util.Scanner;public class TestStudent { public static void main(String[] args) { //从键盘获得数据 Scanner scan = new Scanner(System.in); //输入学生个数 System.out.println("请输入学生个数:"); int maxGrade=0; int count = scan.nextInt(); //确定成绩个数,并用数组保存 in