To change column name in MySQL Table,
For example,to change misspelled column name 'fist_name',
In addition, you can change multiple column names in a query and set languages, default value, etc.
ALTER TABLE table_name CHANGE old_column_name new_column_name DATA_TYPE;
For example,to change misspelled column name 'fist_name',
ALTER TABLE users CHANGE fist_name first_name VARCHAR(64);
In addition, you can change multiple column names in a query and set languages, default value, etc.
ALTER TABLE users CHANGE fist_name first_name VARCHAR( 64 ) NOT NULL,
CHANGE username user_name VARCHAR( 32 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ,
CHANGE gend gender TINYINT( 1 ) NOT NULL DEFAULT 0;
CHANGE username user_name VARCHAR( 32 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ,
CHANGE gend gender TINYINT( 1 ) NOT NULL DEFAULT 0;
Comments
Post a Comment