-- Oracle, MySQL 8+
ALTER TABLE table_name RENAME COLUMN current_name TO new_name;
-- MySQL < 8:
ALTER TABLE table_name CHANGE current_name new_name datatype(length);
-- SQL Server:
EXEC SP_RENAME 'table_name.current_name' , 'new_name', 'COLUMN'
ALTER TABLE 'table_name'
RENAME 'old_name' TO 'new_name';
EXEC SP_RENAME 'TABLE_NAME.OLD_COLUMN_NAME','NEW_COLUMN_NAME'
SQL SERVER
EXEC sp_RENAME 'TableName.OldColumnName' , 'NewColumnName', 'COLUMN'
EXEC sp_rename 'old_table_name', 'new_table_name'
Code language: SQL (Structured Query Language) (sql)
ALTER TABLE Customers
RENAME COLUMN customer_id TO c_id;
SELECT data.column AS `Label`
SELECT NAME AS "Employee Name" FROM PEOPLE;
SELECT p.NAME AS "Employee Name", s.SALARY AS "Employee Salary"
FROM PEOPLE p
JOIN SALARIES s ON p.ID = s.ID;
EXEC sp_RENAME 'TableName.OldColumnName' , 'NewColumnName', 'COLUMN'