This article mainly introduces how to modify the view in mysql data table.
The basic knowledge of mysql views has been introduced in detail in the previous article. Here we will give you a brief introduction to the mysql view.
In layman's terms, a view is a virtual table defined by a query composed of SELECT statements, which is composed of data in one or more tables.
Views are just like mysql basic tables. General operations that can be performed on tables can be applied to views, such as create, query, insert, modify, delete operations, etc.
The creation and query of views have been introduced to you in these two articles. Friends in need can refer to them.
[How to create a view in mysql? 】
【How to query the mysql data table view】
Let’s continue to introduce the modification operation of mysql view with a simple example ##.
In fact, the modification of the view is equivalent to the modification of the SQL statement. First we can connect to the mysql database through the cmd command line tool. Then you can first use the graphic version of Navicat database management tool to view the information of the specified data table my_v1 view more intuitively and conveniently. As shown in the figure above, the my_v1 view contains three fields id, name, and c_id.Modify the syntax of the view:
alter view +视图名 as + 新的select 语句
The example of modifying the syntax of the view is as follows:
alter view my_v1 as select id,name from stu;
Note: Normally, try not to modify the view that has been created to avoid data loss.
mysql video tutorial, everyone is welcome to refer to and learn!
The above is the detailed content of How to modify the view in Mysql data table. For more information, please follow other related articles on the PHP Chinese website!