how to alter column name in sql code example

Example 1: append column sql

ALTER TABLE table_name
ADD column_name datatype;

--example
ALTER TABLE Customers
ADD Email varchar(255);

Example 2: sql rename column

EXEC SP_RENAME 'TABLE_NAME.OLD_COLUMN_NAME','NEW_COLUMN_NAME'

Example 3: cmd to rename a collumn name in sql

ALTER TABLE table_name RENAME COLUMN old_name TO new_name;

Example 4: how to change a collumn name in sql

ALTER TABLE `table_name` 
CHANGE `old_name` `new_name` VARCHAR(10) 
CHARACTER SET utf8 
COLLATE utf8_general_ci NULL 
DEFAULT NULL;

Example 5: how to change column name in sql

ALTER TABLE Student RENAME COLUMN NAME TO FIRST_NAME;
ALTER TABLE `Table Name` MODIFY COLUMN `Column Name` Datatype(Size);

Example 6: alter table name sql

-- Microsoft SQL style
EXEC sp_rename 'TableOldName', 'TableNewName';