Changing the type of a primary key column
suggest changeALTER TABLE fish_data.fish DROP PRIMARY KEY;
ALTER TABLE fish_data.fish MODIFY COLUMN fish_id DECIMAL(20,0) NOT NULL PRIMARY KEY;
The MODIFY above includes PRIMARY KEY. Doing that while a primary key still exists raises “Multiple primary key defined”, so drop it first. To change only the type and keep the existing key, omit PRIMARY KEY from the MODIFY.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents