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