且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在MySQL中创建外键

更新时间:2022-11-08 19:23:39

The problem is with the quotes (on PC it is located around Enter key). You have used them instead of backticks (on PC it is located under Esc key).

ALTER TABLE `project_course`.`attendance` 
ADD CONSTRAINT `FK_Student`
  FOREIGN KEY (`idStudent`) # Change them here around `idStudent` 
  REFERENCES `project_course`.`student` (`userid`) # and here around `userid` 
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

相关阅读

技术问答最新文章