Home >Database >Mysql Tutorial >Detailed explanation of mysql view instance

Detailed explanation of mysql view instance

小云云
小云云Original
2018-03-15 10:45:421449browse

View: It is a select statement (usually more complex). We give it a name (view name). In the future, it is convenient to use (execute) the select statement: just use the view name. (Similar to the encapsulation and calling of functions)

Create a view

Grammar form:

create  view  视图名 【(字段名1,字段名2,字段名3,....)】   as   select语句;

Example:

Detailed explanation of mysql view instance

Using views

Example:

Usually used as a table

Detailed explanation of mysql view instance

Delete view:

drop  view  【if  exists】 视图名;

Related recommendations:

Introduction to mysql views and why views are used and their rules and restrictions

Detailed explanation of the role of MySQL views (1) -Simplify complex connections and format retrieved data

Detailed explanation of the role of MySQL views (2)-Filter data, calculate fields, and update views

The above is the detailed content of Detailed explanation of mysql view instance. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn