R10-16 查询教授多门课程的教师编号及教授的课程门数
作者 马丰媛
单位 大连东软信息学院
题目描述:查询教授多门课程的教师编号及教授的课程门数。
提示:请使用SELECT语句作答。
表结构:
SC
表结构:
create table SC( scid int auto_increment primary key, sno char(8) references Student(sno), cno char(10) references Course(cno), tno char(15) references Teacher(tno), grade int check(grade>=0 and grade<=100), gpoint decimal(2,1), memo text(100) );
表样例
请在这里给出上述表结构对应的表样例。例如
SC
表:
输出样例:
请在这里给出输出样例。例如:
select tno,count(distinct cno) as 门数
from SC
group by tno
having count(distinct cno)>=2;
R10-17 查询选修了3门及3门以上课程的学生学号、平均成绩和修课门数,并用中文显示列名
作者 马丰媛
单位 大连东软信息学院
题目描述:查询选修了3门及3门以上课程的学生学号、平均成绩和修课门数,并用中文显示列名。
提示:请使用SELECT语句作答。
表结构:
SC
表结构的SQL语句:
create table SC( scid int auto_increment primary key, sno char(8) references Student(sno), cno char(10) references Course(cno), tno char(15) references Teacher(tno), grade int check(grade>=0 and grade<=100), gpoint decimal(2,1), memo text(100) );
表样例
请在这里给出上述表结构对应的表样例。例如
SC
表:
输出样例:
请在这里给出输出样例。例如:
select sno as 学号,avg(grade) as 平均成绩,count(distinct cno) as 修课门数
from SC
group by sno
having count(distinct cno)>=3;
R10-18 计算21012101号学生的修课总成绩
作者 马丰媛
单位 大连东软信息学院
题目描述:计算21012101号学生的修课总成绩。
提示:请使用SELECT语句作答。
表结构:
SC
表结构的SQL语句:
create table SC( scid int auto_increment primary key, sno char(8) references Student(sno), cno char(10) references Course(cno), tno char(15) references Teacher(tno), grade int check(grade>=0 and grade<=100), gpoint decimal(2,1), memo text(100) );
表样例
请在这里给出上述表结构对应的表样例。例如
SC
表:
输出样例:
请在这里给出输出样例。例如:
select sno,sum(grade) as 总成绩
from SC
where sno=21012101;
R10-19 计算C01号课程学生的考试平均成绩
作者 马丰媛
单位 大连东软信息学院
题目描述:计算C01号课程学生的考试平均成绩。
提示:请使用SELECT语句作答。
表结构:
SC
表结构的SQL语句:
create table SC( scid int auto_increment primary key, sno char(8) references Student(sno), cno char(10) references Course(cno), tno char(15) references Teacher(tno), grade int check(grade>=0 and grade<=100), gpoint decimal(2,1), memo text(100) );
表样例
SC
表:
输出样例:
请在这里给出输出样例。例如:
select avg(grade) as 平均成绩
from SC
where cno='c01';
R10-20 检索部门名为“SLAES”的所有员工工号和姓名
作者 蒋维
单位 浙江树人学院
检索部门名为“SLAES”的所有员工工号和姓名
提示:请使用SELECT语句作答。
表结构:
请在这里写定义表结构的SQL语句。例如:
CREATE TABLE `dept` ( `deptno` decimal(2,0) NOT NULL, `dname` varchar(14) DEFAULT NULL, `loc` varchar(13) DEFAULT NULL, PRIMARY KEY (`deptno`) ) ; CREATE TABLE `emp` ( `empno` decimal(4,0) NOT NULL, `ename` varchar(10) DEFAULT NULL, `job` varchar(9) DEFAULT NULL, `mgr` decimal(4,0) DEFAULT NULL, `hiredate` date DEFAULT NULL, `sal` decimal(7,2) DEFAULT NULL, `comm` decimal(7,2) DEFAULT NULL, `deptno` decimal(2,0) DEFAULT NULL, PRIMARY KEY (`empno`) ) ; CREATE TABLE `salgrade` ( `grade` decimal(10,0) NOT NULL, `losal` decimal(10,0) DEFAULT NULL, `hisal` decimal(10,0) DEFAULT NULL, PRIMARY KEY (`grade`) );
表样例
emp
表:
dept
表:
输出样例:
select empno,ename
from emp,dept
where emp.deptno=dept.deptno
and dname='SALES';