Mysql 健身班预订系统的数据库模式

Mysql 健身班预订系统的数据库模式,mysql,database-design,schema,Mysql,Database Design,Schema,我需要健身课程的模式 预订系统需要存储可容纳的最大学生人数、预订加入课堂的学生人数、学生ID、日期时间等 学生桌需要存储他/她预订的课程。但如果我将学生ID存储在类表中,则可能不需要这样做 我希望得到一些好主意 提前感谢。*我不是mySql专家,我通常使用w/MS SQL,但我想你会明白的。您可能需要在mySql文档中挖掘一些内容,以找到与我建议的数据类型相匹配的适当数据类型。另外,我只是简单解释了一些类型,以澄清它们的用途,因为这是mySql而不是MS SQL Student: ID, Nam

我需要健身课程的模式

预订系统需要存储可容纳的最大学生人数、预订加入课堂的学生人数、学生ID、日期时间等

学生桌需要存储他/她预订的课程。但如果我将学生ID存储在类表中,则可能不需要这样做

我希望得到一些好主意


提前感谢。

*我不是mySql专家,我通常使用w/MS SQL,但我想你会明白的。您可能需要在mySql文档中挖掘一些内容,以找到与我建议的数据类型相匹配的适当数据类型。另外,我只是简单解释了一些类型,以澄清它们的用途,因为这是mySql而不是MS SQL

Student: ID, Name, ...
Class: ID, Name, MaxStudents, ...
Student_in_Class: STUDENT_ID, CLASS_ID, DATE_ENROLL
班级注册-存储每个学生注册的班级
  • 在class_id和student_id上放置唯一的约束索引以防止重复
类-存储您的类 学生-存储您的学生
  • 在FNEY、LNED和出生日期上设置一个唯一的约束索引以消除重复(可能有两个John Smiths',但两个John-SmithsW/完全相同的出生日期在同一个数据库中是不可能的,除非它是一个非常大的数据库。否则,请考虑使用名字、姓氏和电话作为唯一的约束)
Class_Enrollment_ID INT IDENTITY PK ("identity is made specifically
    to serve as an id and it's a field that the system will manage 
    on its own.  It automatically gets updated when a new record is
    created.  I would try to find something similar in mySql")
Class_ID INT FK
Student_ID INT FK
Date_Time smalldatetime ("smalldatetime just stores the date as a
    smaller range of years than datetime + time up to minutes")
Class_ID INT IDENTITY PK
Name VARCHAR('size') UNIQUE CONSTRAINT INDEX ("UNIQUE CONSTRAINT INDEX is
    like a PK, but you can have more than one in a table")
Max_Enrollment INT ("unless you have a different max for different sessions
    of the same class, then you only need to define max enrollment once per
    class, so it belongs in the class table, not the Class_Enrollment table")
Student_ID INT IDENTITY PK
First_Name VARCHAR('size')
Last_Name VARCHAR('size')
Date_of_Birth smalldatetime ("smalldatetime can store just the date,
    will automatically put 0's for the time, works fine")