Search code examples
mysqlview

Is it possible to rename a column in a view?


I'm not seeing much regarding this after some searching

Do I need to drop the view and recreate it or is there a way to edit a column name?

I tried ALTER VIEW tableName oldColumnName newColumnName

But got a syntax error


Solution

  • You can use the ALTER keyword instead of CREATE but the syntax is the same.

    This means ALTER VIEW does the same as CREATE VIEW but drops the existing view first. You must specify the complete new query that defines the view.