create table s(
id int not null primary key,
name varchar(20)
);
insert into s
select 1,‘jiji‘ from dual
union all
select 2,‘bobo‘ from dual
union
select 3,‘kiki‘ from dual
union all
select 4,‘mimi‘ from dual;
select * from s;
create table c(
id int not null primary key,
cname varchar(20),
cteacher varchar(30)
);
insert into c
select 1,‘Mr.chen‘,‘Chinese‘ from dual
union all
select 2,‘Mrs.liu‘,‘Math‘ from dual
union
select 3,‘Mr.geek‘,‘English‘ from dual
union all
select 4,‘Mr.long‘,‘Natural‘ from dual;
select * from c;
create table sc(
sid int not null,
cid int not null,
cgrade int,
foreign key (sid) references s(id),
foreign key (cid) references c(id)
);
insert into sc
select 1,1,90 from dual
union all
select 2,1,75 from dual
union
select 3,1,54 from dual
union all
select 4,1,10 from dual
union
select 1,2,90 from dual
union all
select 2,2,98 from dual
union
select 3,2,59 from dual
union all
select 4,2,10 from dual
union
select 1,3,59 from dual
union all
select 2,3,78 from dual
union
select 3,3,59 from dual
union all
select 4,3,56 from dual
union all
select 1,4,100 from dual;
select * from sc;