createtablestudent(student_idsmallintunsignedprimarykey,namevarchar(20)notnull,genderenum('m','f')notnull,birthdaydatenotnull,nationalityvarchar(20)notnull,addressvarchar(50)notnull,major_idsmallintunsignednotnull,foreignkey(major_id)referencesmajor(major_id));createtablemajor(major_idsmallintunsignedprimarykey,major_namevarchar(30)notnull,major_classvarchar(30)notnull,);createtablecourse(course_idsmallintunsignedprimarykey,course_namevarchar(30)notnull,creditdecimal(2,1)notnull,major_idsmallintunsignednotnull,foreignkey(major_id)referencesmajor(major_id));createtablescore(student_idsmallintunsignedprimarykey,course_idsamllintunsignednotnull,scoresamllintunsignednotnull,foreignkey(course_id)referencescourse(course_id)); |