我在MySQLMySQL中的外鍵關係錯誤。
共初學者每當我試圖將一個外鍵添加一個字段它產生這個錯誤:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ADD FOREIGN KEY ID
下面就來添加外鍵代碼:
ALTER TABLE 'table_name'
ADD CONSTRAINT 'FK_FKName'
ADD FOREIGN KEY table_name(column_name)
REFERENCES OtherTable_name(OtherTable_column_name);
請儘量幫助我