SQL Tutorial – ALTER TABLE- Rename Columns and Table.

You have a table and you want to change the name of a column or want to change the name of the table.

Solution –

Change the name of a column In SQL-

To change the name of a column you can use the ALTER TABLE statement. Let’s change the name of the salary column to christmas_spending in the actors table.

ALTER TABLE actors 
RENAME COLUMN salary TO christmas_spending

Change the name of a Table in SQL –

We can also change the name of a table using the ALTER TABLE statement.

Let’s change the name of the actors table to actors_info


ALTER TABLE actors
RENAME TO actors_info

Rating: 1 out of 5.

Leave a Reply