27、用SQL语句创建简单数据表
设教学管理数据库中有多张数据表,其中学生表Student包括学生编码Sno,学生姓名Sname,学生年龄Sage,学生性别Ssex字段;Sno和Sname为字符型(长度20),Sage为整型,Ssex为位型(0表示女,1表示男)。Sno是主键。
课程表Course包括课程编号Cno,课程名Cname,授课老师Teacher字段;三个字段均为字符型(长度20),Cno是主键。
请用SQL语句创建上面的两张数据表。
28、根据上题,除了上述的2张表,还包括一张成绩表SC,
成绩表SC包括学生编号Sno,课程编号Cno和成绩Grade,其中Grade为数值型(带小数)。请按下列要求,完成查询语言。
(1)找出年龄大于21岁的女学生的学号和姓名
(2)找出至少选修刘红老师讲授的一门课程的学生的姓名。
27、
create table student
{
sno char(20) not null primary key,
sname char(20),
sage int,
ssex char(2)
}
create table course
{
cno char(20) not null primary key,
cname char(20),
teacher char(20)
}
28、
create table SC
{
sno char(20) ,
cno char(20) ,
grade decimal
}
select sno,sname from student
where sage>'21'
select student.sname from student
where course.teacher='刘红'
不知道对不对,你运行下试试,不行再找我。
O(∩_∩)O~
lotus
create table student
{
sno char(20) not null primary key,
sname char(20),
sage int,
ssex char(2)
}
create table course
{
cno char(20) not null primary key,
cname char(20),
teacher char(20)
}
28、
create table SC
{
sno char(20) ,
cno char(20) ,
grade decimal
}
select sno,sname from student
where sage>'21'
select student.sname from student
where course.teacher='刘红'
不知道对不对,你运行下试试,不行再找我。
O(∩_∩)O~
lotus
温馨提示:答案为网友推荐,仅供参考
第1个回答 2012-07-07
kid