In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail what is the method of creating views in the MySQL database. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Syntax:
CREATE VIEW AS
Specifies the name of the view The name must be unique in the database and cannot have the same name as other tables or views.
Specifies the SELECT statement that creates the view, which can be used to query multiple underlying tables or source views
There are the following restrictions on the assignment of SELECT statements in the creation view:
In addition to CREATE VIEW permissions, users also have permissions related to the underlying tables and other views involved in the operation.
SELECT statements cannot refer to system or user variables.
The SELECT statement cannot contain subqueries in the FROM clause.
SELECT statements cannot reference preprocessing statement parameters.
The table or view referenced in the view definition must exist. However, after you create the view, you can delete the table or view that defines the reference. You can use the CHECK TABLE statement to check the view definition for such problems.
ORDER BY statements are allowed in the view definition, but if you select from a specific view that uses its own ORDER BY statement, the ORDER BY in the view definition is ignored.
The TEMPORARY table (temporary table) cannot be referenced in the view definition, and the TEMPORARY view cannot be created.
WITH CHECK OPTION means that when you modify the view, check whether the inserted data meets the conditions set by WHERE.
Create a view named view_menu on the b_menu table, and enter the SQL statement and the execution result as shown below.
Create a view SQL statement:
Create view view_menuas select * from b_menu
View the view SQL statement:
Select * from view_menu
By default, the view created is the same as the fields of the base table, or you can create the view by specifying the name of the view field. (mainly because all the data is used to create the view).
On "what is the method of creating views in the MySQL database" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.