How to alter a MySQL table's foreign key using the command line

前端 未结 4 2066
一整个雨季
一整个雨季 2021-02-13 19:49

How to alter an existing table in MySQL, setting foreign key to another table, using the command line?

4条回答
  •  庸人自扰
    2021-02-13 20:03

    I was able to achieve the same thing by :

    ALTER TABLE the_table_name 
        ADD CONSTRAINT the_name_of_column_you_want_to_use_as_foreign_key 
           REFERENCES other_table_primary_id (Column_name )
    

提交回复
热议问题