MySQL Basics (5)--View

Source: Internet
Author: User

View

Word:View

What is a view:

A view can be thought of as a " table of temporarily stored data "(not a real table), but essentially a select statement. Just make the select statement (usually more complex) a " wrapper "and set a name that can then be used as a table by that name.

If a SELECT statement is complex and needs to be used on multiple pages, it can be made into a view for ease of use.

Also, if some of the fields in a datasheet don't want to be seen (when data is exchanged between companies), but the other needs to be seen, the view can be used at this point.

View Creation form:

Create view name [(column name 1, column name 2,... )] as a complex select statement;

You can rename the columns obtained by the SELECT statement, but you can also do so without renaming, using the given column name in the SELECT statement.

Use of views

is actually used as a query table (usually only for select)

SELECT * from view name where condition order by ..... .

To Modify a view:  

Alter VIEW name [(column name 1, column name 2,... )] as select statement;

To Delete a view:  

Drop view [if exists] views name;

MySQL Basics (5)--View

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.