SNHPS
Quick and easy code snippets
drop-large-column.sql

Drop a column from a large table in a relatively timely manner.

SET unique_checks=0;
SET foreign_key_checks=0;
ALTER TABLE table_name DROP COLUMN column_name, algorithm=inplace;
SET unique_checks=1;
SET foreign_key_checks=1;
rename-column.sql

Rename a column in your MySQL table.

ALTER TABLE table_name RENAME COLUMN old_column_name to new_column_name;

This website is owned and operated by SiteBolts. All the code snippets found here are intended to be a starting point and should not be treated as a perfect solution to every problem. We do not guarantee the performance, reliability, or security of the code found on this website. As always, you should ensure that you have adequate backups before adding, changing, or executing any code.