SQL view Action Statement

Source: Internet
Author: User

The structure and choreography of the table are defined in the relational table in the database. However, the SQL language provides another method of data organization through which the user can rearrange the data in the original table according to other organizational forms. This approach is the view. The structure and content of the view are obtained through SQL queries, which have a view name and can be persisted in the database. Using SQL query statements, users can query the data in the view like other common relational tables, as if they were "real tables" in the database. The following is an introduction to the functionality and usage of the SQL statements for the creation and deletion of these two operations.

(1) The creation of a view

The view creation statement provided by the SQL language is create view, which is used in the following format:

CREATE View < view name >

[Column Name list] As (SELCET query statement)

From the creation statement content of the view, you can see that the contents of the view are the result of an SQL query. Column Name list options if present, the columns in the view are determined by it, otherwise the columns included in the query's results are determined.

(2) Deletion of views

The view deletion statement provided by the SQL language is Drop view, which is used in the following format:

DROP View < view name >

[cacade| RESTRICT]

The most important difference between the deletion of a view and the deletion of the general relational table is that the deletion of the view simply deletes the view's organizational structure, and the user will no longer be able to use the view to do so, but the data that makes up the content of the view is not deleted and remains in the original relational table

References: SQL language tutorials SQL language basics

Back to the database basics ABC Directory

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.