Get the App
SLTechnology News&Howtos  ›  Database  › 

MySQL view of 7Python all-station road series

Shulou Source: shulou.com Published: 2022-06-01 15:08:20 10月02日 Update

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

Tags: Views paths names data results queries functions dynamic just that is essence to make users statements only update output the whole site Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Xiaomi Shulou Information MariaDB Docker