MySQL view of 7Python all-station road series
MySQL View of Python full Stack Road Series
View is a virtual table (not real), its essence is to get dynamic data set according to SQL statement and name it. Users only need to use the name to get the result set, and can use it as a table.
Create a view
Create a view named v1 whose function is to query all the data in the color table
CREATE VIEW v1 AS SELECT * FROM color
View view
When using the view, it can be operated as a table. Because the view is a virtual table, it can not be used to create, update and delete the real table, but can only be used for query.
Select * from v1;-- equal to execute SELECT * FROM color
Output result
+-+-+ | nid | title | +-+-+ | 1 | red | | 2 | yellow | +-+-+ 2 rows in set (0.00 sec)
Modify the view
ALTER VIEW v1 AS SELECT * FROM color WHERE nid = 1
Delete View
DROP VIEW v1
# Python full Stack Road