Oracle 之 SQL 面试题 录(转)
多上网查查 SQL 面试题 2. 数据库 有3个表 teacher表 student表 tea_stu关系表 teacher表 teaID name age student表 stuID name age teacher_student表 teaID stuID 要求用一条sql查询出这样的结果: 1.显示的字段要有老师id age 每个老师所带的学生人数 2.只列出老师age为40以下 学生age为12以上的记录。 select a.teaID,a.age count(*) from teacher a,student b,teacher_student c where a.teaID=c.teaID and b.stuID=c.stuID and a.age>40 and b.age>12 group by a.teaID,a.age; select a.department,count from tA a,tB b where a.id=b.id group by b.id,a,deparment 方法1: select Sname,sum(Ccredit) as totalCredit from Student,Course,SC where Grade>=60 and Student.Sno=SC.Sno and Course.Cno=SC.Cno group by