我设计了这样的表格:
表1:学生 --------------------- PK 编号 姓名 数字 ... --------------------- 表 2:students_score --------------------- PK FK student_id 数学分数 英语分数 ... ---------------------
问题 1
如果有些学生根本没有分数,那是不是很好的表格设计?
问题2
如果它是好的设计,那么我怎样才能在 MySQL 中将 FK 作为 PK?我不知道怎么做。每次我尝试建立一个像上面 SQLYog 这样的关系时都会说这个错误:Can't create table 'students.#sql-a31_2c8e' (errno: 150)
谢谢
更新
我从这里找到了问题 2 的答案。这只是类型(int,signed int)的问题。