sqlcmd.net validated sql reference
beginner ddl MySQL MariaDB SQL Server PostgreSQL SQLite

Rename a Column With ALTER TABLE

Change a column's name in place without dropping or recreating the table or its data.

Docker-validated Not currently validation-green

Rename the fname column to first_name

After the rename, the column is accessible only by its new name first_name. The data (Alice, Bob), the VARCHAR(100) type, and all row values are preserved unchanged. On SQL Server, sp_rename prints a warning that objects referencing the column may need updating — this is expected and does not indicate failure.

MySQL MariaDB PostgreSQL SQLite
Engine-specific syntax
Setup
CREATE TABLE employees (id INT, fname VARCHAR(100), salary INT);

INSERT INTO
  employees
VALUES
  (1, 'Alice', 90000),
  (2, 'Bob', 75000);
SQL
ALTER TABLE employees
RENAME COLUMN fname TO first_name;

SELECT
  id,
  first_name,
  salary
FROM
  employees
ORDER BY
  id;
idfirst_namesalary
1Alice90000
2Bob75000
SQL Server
Engine-specific syntax
Setup
CREATE TABLE employees (id INT, fname VARCHAR(100), salary INT);

INSERT INTO
  employees
VALUES
  (1, 'Alice', 90000),
  (2, 'Bob', 75000);
SQL
EXEC sp_rename 'employees.fname',
'first_name',
'COLUMN';

SELECT
  id,
  first_name,
  salary
FROM
  employees
ORDER BY
  id;
idfirst_namesalary
1Alice90000
2Bob75000

SQL Server uses sp_rename instead of ALTER TABLE … RENAME COLUMN. The resulting table structure and data are identical across all engines.

Where this command helps.

  • correcting a misspelled column name after deployment
  • aligning a column name with a new naming convention without rebuilding the table

What the command is doing.

MySQL (8.0+), MariaDB (10.5.2+), PostgreSQL, and SQLite (3.25+) all support ALTER TABLE … RENAME COLUMN old_name TO new_name. SQL Server does not have this syntax — instead it uses the system stored procedure sp_rename('table.old_name', 'new_name', 'COLUMN'). Renaming a column does not change its data type, default, nullability, or any associated indexes. Views or stored procedures that reference the old column name will need to be updated separately.