sql练习-S-C-SC建表

use selectpractice;

drop table if exists SC;

create table SC(
sno varchar(200), 
cno varchar(200),
scgrade varchar(200)
);

drop table if exists S;
create table S(
sno varchar(200),
sname varchar(200)
);

drop table if exists C;
create table C(
cno varchar(200),
cname varchar(200),
cteacher varchar(200)
);

insert into C(cno, cname, cteacher) value('1', '语文', '');
insert into C(cno, cname, cteacher) value('2', '政治', '');
insert into C(cno, cname, cteacher) value('3', '英语', '');
insert into C(cno, cname, cteacher) value('4', '数学', '');
insert into C(cno, cname, cteacher) value('5', '物理', '');
commit;


insert into S(sno, sname) values('1', '学生1');
insert into S(sno, sname) values('2', '学生2');
insert into S(sno, sname) values('3', '学生3');
insert into S(sno, sname) values('4', '学生4');
commit;

insert into SC(sno, cno, scgrade) values('1', '1', '40');
insert into SC(sno, cno, scgrade) values('1', '2', '30');
insert into SC(sno, cno, scgrade) values('1', '3', '20');
insert into SC(sno, cno, scgrade) values('1', '4', '80');
insert into SC(sno, cno, scgrade) values('1', '5', '60');
insert into SC(sno, cno, scgrade) values('2', '1', '60');
insert into SC(sno, cno, scgrade) values('2', '2', '60');
insert into SC(sno, cno, scgrade) values('2', '3', '60');
insert into SC(sno, cno, scgrade) values('2', '4', '60');
insert into SC(sno, cno, scgrade) values('2', '5', '60');
insert into SC(sno, cno, scgrade) values('3', '1', '60');
insert into SC(sno, cno, scgrade) values('3', '3', '80');
commit;

 

posted @ 2020-08-27 09:48  上天安排的最大嘛!  阅读(528)  评论(0编辑  收藏  举报