Delete on mysql foreign keys

After a table to create a primary key, when you view the table structure, primary key constraint in the key display this column. When deleting a primary key, key corresponding to the primary key constraint becomes blank. Many students feel that the foreign key should be the same. But the reality is this, key in this column still displays - There are still key in this column display
then we delete the foreign key in the end it? How to make key corresponding to this column is empty?
Suggest that you use show create table table command to view the change before and after the deletion Here Insert Picture Description
as shown above, it is before you delete with constraints, delete the constraint has gone. Therefore, the current foreign key has actually been deleted. key reason why there is value here, because we added in the establishment of foreign key index, the index value is shown here. OCD students if we must get rid of, the following solution:
1: Show index from the table; (index lookup table)
2: drop index index name on table; (delete the index)
3: desc Table;
Figure:
Here Insert Picture Description

Released two original articles · won praise 2 · views 54

Guess you like

Origin blog.csdn.net/Zhaojt_/article/details/104682225