Introduction to database SQL Creation View and view

Source: Internet
Author: User
Tags mysql tutorial mysql view

The view Graph English name is a virtual table. For view users, it is basically transparent and the mysql view does not exist in the database, the related data comes from the tables used in the query and is dynamically generated.

What is the mysql tutorial view?

The view Graph English name is a virtual table, which is transparent to users and does not exist in the Database tutorial, the related data comes from the tables used in the query and is dynamically generated.

Okay. Let's take a look.Create Database SQL View

To create a view, we will use the create view permission and have the select permission for query and query. If we use create or replace or alert to modify the view chart, we also need the drop permission.

The syntax for creating a view is as follows:

Create [or replace] [algorithm = {undefined | merge | temptable}]

View view_name [(column_list}]

As selectlist

[With [caseaded | loca] check option]

Now let's look atView CreationInstance

-> Mysql> create or replace view st_list_v as select s. st. finame from stt as s, add as a where s. addressid = as. addressid;

Query OK, 0 rows affected (0.00 sec );

Note: the definition of the mysql view has some restrictions. For example, the from keyword cannot be followed by subqueries, which is different from that of the mssql database. If the view is migrated, some changes may be made,

Database ViewThe updatability of is related to the query definition in the view. The following types of views cannot be updated.

Keyword SQL statements: sum, min, max, count, distinct, group by having, union, and unionall mainly refer to aggregate functions.

The following views cannot be updated.

Mysql-> create or replace view palsum as select tt, sum (id) from pay group by stt;

Query OK, 0 rows affected (0.00 sec );

Well, this database view tutorial focuses on considerations for creating and viewing mysql views.

This site original tutorial reprint Indicate source: http://www.bKjia. c0m/database/database.html

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.