Home >Daily Programming >Mysql Knowledge >How to delete data in mysql data table view
This article mainly introduces to you the deletion operation of view data in mysql data table.
After the previous introduction to the relevant knowledge about mysql views, I believe that all novice friends will have a better understanding of the definition and basic operations of views.
Simply put, a view is a collection of query statements. Once defined, it is stored in the database. However, the corresponding data is not stored in the database like the MySQL base table. , and the data seen through the view is only the data stored in the basic table. The operations on the view are the same as the operations on the MySQL base table. You can query, modify (with certain restrictions), delete and other operations on it.
I have introduced some related operations to you in the previous article. Friends who need it can refer to it.
【How to query the view in the mysql data table】
【How to modify the view in the Mysql data table】
[How to delete views in mysql data table]
Let’s continue to combine some simple examples to explain how to delete data in single table view and multi-table view in mysql data table. Relevant knowledge points.
How to delete data in mysql data table view?
First we can query the data of a single table view through the select statement. My_v1 in the figure below is the single table view.
Here we can see that there are 7 pieces of data in the single table view my_v1. If we delete one of the data, we can do as follows.
As shown in the figure, we successfully deleted the data with ID 7.
Note: The data in the single table view can be deleted, and the corresponding data table data will also be deleted.
Then we query a multi-table view. My_v2 in the figure below is a view based on the association of two tables.
#If we want to delete the data in the multi-table view, what will be the result? The operation example is as follows:
#You can see from the figure that the operation of deleting data in a multi-table view cannot be performed.
Finally we can conclude:
The data in the single-table view can be deleted, and the original data will be affected; in the multi-table view, when the view data is modified, it will Error reported and cannot be modified.
This article is an introduction to the deletion operation of view data in the mysql data table. It is simple and easy to understand. I hope it will be helpful to friends in need!
If you want to know more about mysql, you can follow the PHP Chinese website mysql video tutorial, everyone is welcome to refer to and learn!
The above is the detailed content of How to delete data in mysql data table view. For more information, please follow other related articles on the PHP Chinese website!