Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL view of 7Python all-station road series

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report