How to delete data in mysql data table view

藏色散人
Release: 2018-10-27 17:13:17
Original
15712 people have browsed it

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.

How to delete data in mysql data 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.

How to delete data in mysql data table view

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.

How to delete data in mysql data table view

#If we want to delete the data in the multi-table view, what will be the result? The operation example is as follows:

How to delete data in mysql data table view

#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!

Related labels:
source:mysql数据表中视图数据的删除操作,可以使用delete语句来执行。并且单表视图数据可删除,多表视图数据不可删除。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!