管理学生、班级和教师,一个教师可以教多个班,一个班有多个教师多个学生,不知道数据库表怎么设计

需要管理的数据有三种,学生、教师、班级。学生和教师共有的属性:姓名、年龄;学生独有属性:班级;教师独有属性:职位(如语文教师、数学教师等),教学班级(如1班,二班)。一个教师可以教多个班级,一个班级有多个学生,多个教师。

需要有关联表

create table student(
  id int primary key auto_increment,
  name varchar(20),
);

create teble clazz(
  id int ,
  name varchar(50)
);

create table teacher(
  id int ,
  name varchar(20)
)
-- 班级教师学生关联表
create table clazz_teacher_student_ref(
  id int,
  clazz_id int,
  teacher_id int,
  student_id int,
)

你好,请问关联表中需要设置外键吗