Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone tell me how to change the column name in SQL?

1 Answer

0 votes
by (119k points)

In MySQL, here is the syntax to rename the column:

ALTER TABLE table_name

change column1 column2 data type;

In Oracle, here is the syntax to rename the column:

ALTER TABLE table_name

RENAME COLUMN column1 to column2;

In MS SQL, we cannot use Alter table statement to change the column name. We use sp_rename to change the column name and here is the syntax to rename the column:

sp_rename ‘previous_table_name’, ‘new_table_name’;

If you want to learn SQL, you can enroll for this SQL course program by Intellipaat.

Related questions

0 votes
1 answer
asked Apr 19, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...