R10-1 查询考试成绩不及格的学生学号
作者 马丰媛 单位 大连东软信息学院
题目描述:本题目要求编写SQL语句,查询考试成绩不及格的学生学号。
提示:请使用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 sno
from sc
where grade<60;
R10-2 查询在2006年1月30日以后出生的学生的姓名、性别和出生日期
作者 马丰媛
单位 大连东软信息学院
题目描述:本题目要求编写SQL语句,查询在2006年1月30日以后出生的学生的姓名、性别和出生日期。
提示:请使用SELECT语句作答。
表结构:
student
表结构:
create table student(
sno char(8) primary key,
sname varchar(10) not null,
gender char(2) check(gender='男' or gender='女'),
birthdate date,
major varchar(20) default '软件工程'
);
表样例
student
表:
输出样例:
请在这里给出输出样例。例如:
select sname,gender,birthdate
from student
where birthdate>'2006-01-30'
R10-3 查询在2、4、6学期开课的课程编号、课程名称和授课学时
作者 马丰媛
单位 大连东软信息学院
题目描述:本题目要求编写SQL语句,
查询在2、4、6学期开课的课程编号、课程名称和授课学时。
提示:请使用SELECT语句作答。
表结构:
course
表结构:
create table course(
cno char(10) primary key,
cname varchar(20) not null,
ccredit int check(ccredit>0), -- 课程学分
semester int check(semester>0), -- 学期
period int check(period>0) -- 总学时
);
表样例
请在这里给出上述表结构对应的表样例。例如
course
表:
输出样例:
请在这里给出输出样例。例如:
select cno,cname,period
from course
where semester in(2,4,6);
R10-4 查询除计算机科学和软件工程专业以外的学生的学号、姓名、性别、出生日期和专业
作者 马丰媛
单位 大连东软信息学院
题目描述:本题目要求编写SQL语句,
查询除计算机科学和软件工程专业以外的学生的学号、姓名、性别、出生日期和专业。
提示:请使用SELECT语句作答。
表结构:
student
表结构:
create table student(
sno char(8) primary key,
sname varchar(10) not null,
gender char(2) check(gender='男' or gender='女'),
birthdate date,
major varchar(20) default '软件工程'
);
表样例
请在这里给出上述表结构对应的表样例。例如
student
表:
输出样例:
请在这里给出输出样例。例如:
select sno,sname,gender,birthdate,major
from student
where major not in(
"计算机科学","软件工程"
)
R10-5 查询不缺少成绩(成绩不为空)的学生的学号,相应的课程号和成绩
作者 马丰媛
单位 大连东软信息学院
题目描述:本题目要求编写SQL语句,
查询不缺少成绩(成绩不为空)的学生的学号,相应的课程号和成绩。
提示:请使用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 sno,cno,grade
from sc
where grade is not null;