Ihabe Kaine
Ihabe Kaine

Reputation: 36

#SQL How can i change names of columns on my table?

enter image description here Please i need your help! i have import a table on MySQL Workbench, but i find that the names of the columns are not imputed correctly, they don't have the underscore, and when i try to run a query a have an error message. Exemple " Movie Title " when i try to make by exemple [ SELECT Movie Title From table ] it don't work. How can i add "_" on columns to fix this problem ? Thank you

Ihabe Kaine

I try run this code but it doesn't work !

ALTER TABLE movie_data.movie_data
rename column Movie Title TO Movie Title

I want just add underscore

Upvotes: 1

Views: 45

Answers (1)

Barmar
Barmar

Reputation: 781716

If a column name contains spaces you have to put it in backticks.

ALTER TABLE movie_data.movie_data
RENAME COLUMN `Movie Title` TO Movie_Title;

Upvotes: 1

Related Questions