SQL Change Column Name


Pattern :

ALTER TABLE currentTable CHANGE existingColumn newColumn dataType(length) NULL or NOT NULL DEFAULT defaultValue (you can set NULL);

 

Case :

We have existing table. Table name is "tbl_users". We would like to change column "name" to "fullname".

 

The query would be :

ALTER TABLE tbl_users CHANGE name fullname VARCHAR(100) NULL; (enter)

Comments