表的创建
错误案例1:
问题一
第9行:foreign key (Tno) references t (Tno),
出错原因:在写完整个字段定义和索引定义后的最后一行不要加逗号
解决措施:删除逗号
问题二
第2-4行:
Sno char(10) not null primary key comment'学号',
Cno char(10) not null primary key comment'课程号',
Tno char(10) not null primary key comment'教师号',
出错原因:一个表中不能出现多个主码
解决措施:若要将多个字段组成的字段组设为主码,应该在索引定义中写上primary key (<字段一>,<字段二>,~~~,<字段若干>)
例:primary key (Sno,Cno,Tno)
错误案例2:
问题三
出错原因:从表的字符集和与主表的字符集不一样
解决措施:修改字符集使两表的字符集相同