mysql-views View

Source: Internet
Author: User

Views: A non-real-world table that contains complex queries can also be understood as a result of a query.

Add a concept: Temporal table Query (subquery): Is to nest a query again in the query statement, and set the nested query alias

SELECT    *     from     (SELECT   nid, NAME from      tb1        WHERE    >2as AWHERE     > ' Alex ';

1. Create a view:

1 -- format: CREATE view name  as SQL statement 2CREATEVIEWas3 selet nid,  name   from   A4 WHERE  > 4

2. Delete the view:

1 -- format: DROP view name 2 DROP VIEW v1

3. Modify the View:

1 --format: ALTER view name as SQL statement2 ALTER VIEWV1 as3Selet A.nid, B. NAME fromA4  Left JOINB ona.ID=B.nid5  Left JOINC ona.ID=C.nid6 WHEREa.ID> 2  andC.nid< 5

4. Use the view: Query the view as a table

Select *  from V1

mysql-views View

Related Article

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.