学生表sid,sname,结果表cid,cname,学生成绩表sid,cid,cscore,最高要求的分数输出候补课程专门命名

--1、建表SQL:

--学生表:

-- Createtable

createtable STUDENT

(

SID  
NUMBERnotnull,

SNAME
NVARCHAR2)

)

tablespace CABLESCD

storage

(

maxextentsunlimited

);

--成绩表

-- Createtable

createtable SCORE

(

CID  
NUMBERnotnull,

CNAME
NVARCHAR2)
notnull

)

tablespace CABLESCD

storage

(

maxextentsunlimited

);

--学生成绩表

-- Createtable

createtableSTUDENGSCORE

(

SID   
NUMBERnotnull,

CID   
NUMBERnotnull,

CSCORE
NUMBER)

)

tablespace CABLESCD

storage

(

maxextentsunlimited

);

--2、插入SQL语句:

insert into student

(sid, sname)

values

(001,'ZHAOHY');

insert into student

(sid, sname)

values

(002, 'ZHANGQL');

insert into student

(sid, sname)

values

(003, 'ZHAOHB');

insert into score

(cid, cname)

values

(100, '数电');

insert into score

(cid, cname)

values

(200, '模电');

insert into score

(cid, cname)

values

(300, '英语');

insert into score

(cid, cname)

values

(400, '政治');

select * from score

(001, 100, '60');

insert into studengscore

(sid, cid, cscore)

values

(002, 100, '70');

insert into studengscore

(sid, cid, cscore)

values

(003, 100, '80');

insert into studengscore

(sid, cid, cscore)

values

(003, 200, '90');

insert into studengscore

(sid, cid, cscore)

values

(003, 300, '99');

insert into studengscore

(sid, cid, cscore)

values

(003, 400, '98');

select * from studengscore

--3、查询SQL

select *
fromstudengscore;

select *
from student;

select *
from score;

select cnamefrom score
where cid =(select cid
fromstudengscore
wherecscore=(

selectmax(cscore)
fromstudengscore
));

学生表sid,sname,结果表cid,cname,学生成绩表sid,cid,cscore,最高要求的分数输出候补课程专门命名

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3liZXJ6aGFvaHk=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">

版权声明:本文博主原创文章,博客,未经同意不得转载。

上一篇:2016/04/26 流程 数据库lcdb 四个表 1,用户表users 2,流程表(设定有哪些流程)liucheng 3,流程发起者表(记录谁发起到哪里) 4,流程经过的人员表 flowpath (order排序)


下一篇:hdu 5747(数学,贪心)