I created a table and then some views for the table. Now i altered the table to add another column in it.But the views are not updated.It doesn’t have the column that is added in the table.Is there any way to modify view structure automatically?
Advertisement
Answer
You can use alter view
command to modify the view and change the columns.
For example, if your view is view1 and table is table1, you can do something like this:
ALTER VIEW view1 col1, col2, col3, new_col AS select tcol1, tcol2, tcol3, new_tcol from table1
Here is the documentation for the full syntax for mysql.