Mysql -- view,
1. view features
When a view comes from multiple basic tables, data cannot be added or deleted.
2. Create a view
Although a view can be viewed as a virtual table, it does not physically exist, that is, the database management system does not have a dedicated location to store data for the view. According to the view concept, we can find that its data comes from the query statement. Therefore, the view creation syntax is:
Create various views
(1) encapsulate the view of query statements Using Aggregate functions (SUM, MIN, MAX, COUNT, etc.
The student table is as follows:
(2) encapsulates the view for implementing the order by query statement.
3. view 1. view with show tables statements
2. DESCRIBE | DESC view View Design Information
4. delete a view
5. Modify VIEW 1. create or replace view statement modify VIEW
2. ALTER statement modification View
6. Use the view to modify basic table 1. Search (query) data
Querying data through a view is exactly the same as querying through a table, but querying through a view is safer, simpler, and easier to use than querying a table. In specific implementation, you only need to replace the table name with the view name.
2. operate basic table data using views
You can not only query data in a view, but also update (add, delete, and update) the view. Because the view is a "virtual table", the index updates the View data. In fact, the basic table data is updated.
When updating View data, pay attention to the following two points:
(1) adding, deleting, and updating View data directly affects basic tables.
(2) When a view comes from multiple basic tables, data cannot be added or deleted.
After execution: