多对多关系 需要建立一张新表存放它们的对应数据

sql语句

 1 create table teacher(
 2     id int primary key,
 3     name varchar(100),
 4     money float(8,2)
 5 );
 6 create table student(
 7     id int primary key,
 8     name varchar(100),
 9     grade varchar(10)
10 );
11 create table teacher_student(
12     t_id int,
13     s_id int,
14     primary key(t_id,s_id),
15     constraint t_id_fk foreign key(t_id) references teacher(id),
16     constraint s_id_fk foreign key(s_id) references student(id)
17 );
View Code

相关文章:

  • 2021-11-19
  • 2021-11-19
  • 2021-11-29
  • 2022-12-23
  • 2021-12-05
  • 2021-12-11
  • 2021-11-19
猜你喜欢
  • 2021-09-11
  • 2022-03-03
  • 2021-06-24
  • 2022-02-07
  • 2022-02-07
  • 2021-10-11
相关资源
相似解决方案