2017-02-15 06:09
浏览 142


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?

图片转代码服务由CSDN问答提供 功能建议

我创建了一个表,然后为表创建了一些视图。 现在我更改了表以在其中添加另一列。但是视图没有更新。它没有在表中添加的列。是否有任何方法可以自动修改视图结构? < / DIV>

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • dongwei7245 2017-02-15 07:35

    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:

    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.

    Hope this helps!

    解决 无用
    打赏 举报

相关推荐 更多相似问题