資料庫多對多表關係資料

kmswilliam發表於2020-12-24

create table teacher(id number,name varchar2(10),age number,gender varchar2(10));
insert into teacher values(1,‘張老師’,35,‘男’);
insert into teacher values(2,‘李老師’,34,‘女’);
insert into teacher values(3,‘王老師’,30,‘男’);

create table student(id number,name varchar2(10),age number,gender varchar2(10));
insert into student values(1,‘小明’,15,‘男’);
insert into student values(2,‘小紅’,14,‘女’);
insert into student values(3,‘小萌’,14,‘女’);

create table betwee(id number,stu_id number,tea_id number);
insert into betwee values(1,1,1);
insert into betwee values(2,1,2);
insert into betwee values(3,1,3);
insert into betwee values(4,2,1);
insert into betwee values(5,2,2);
insert into betwee values(6,2,3);
insert into betwee values(7,3,1);
insert into betwee values(8,3,3);

相關文章