SQL VIEW (VIEW) and sqlview
Brief description:
A view contains rows and columns, just like a real table.
A field in a view is a field from a real table in one or more databases.
You can add SQL functions, WHERE statements, and JOIN statements to the view, and submit data, just like a single table.
Note: the database design and structure will not be affected by functions, where, or join statements in the view.
Details:
A view is a virtual table whose content is defined by the query. Like a real table, a view contains a series of columns and row data with names. However, a view does not exist in the database as a stored data value set. Rows and columns are used to define tables referenced by View queries and dynamically generate tables when views are referenced. For the referenced basic table, the view function is similar to filtering. The filtering of the definition view can be from one or more tables of the current or other databases, or other views. Distributed queries can also be used to define views that use multiple heterogeneous source data.
A view is an SQL statement stored in a database. It is mainly for two reasons: security reasons. A view can hide some data, such as the Social Insurance Fund table, you can use the view to display only the name and address, but not the social insurance number and wage number. Another reason is that complex queries are easy to understand and use.
View: displays images or documents.
Once defined, the view is stored in the database. The corresponding data is not stored in the database as the table. The data displayed in the view is only stored in the basic table. Operations on a view are the same as those on a table. You can query, modify (with certain restrictions), and delete a view.
When you modify the data seen through the view, the data of the corresponding basic table also needs to change. At the same time, if the data of the basic table changes, this change can also be automatically reflected in the view.
View function:
* Simplicity
What you see is what you need. A view not only simplifies users' understanding of data, but also simplifies their operations. Frequently Used queries can be defined as views, so that you do not have to specify all the conditions for each subsequent operation.
* Security
Users can only query and modify the data they can see through the view. Other data in the database is neither visible nor accessible. Database authorization commands allow each user to restrict the retrieval of a database to a specific database object, but cannot authorize the database to a specific row or column. Through views, users can be restricted to different subsets of data: the permission can be restricted to one subset of another view, or some views and subsets after the merging of the base table.
* Logical Data independence
View helps you avoid the impact of changes in the real table structure.
View Syntax:
Create view view_name as select column_name (s) FROM table_name WHERE condition
Note: The view always displays the latest data. Whenever a user queries a view, the database engine uses SQL statements to recreate the data.