SQL CREATE View Statement What is a view?
In SQL, a view is a table of visualizations based on the result set of an SQL statement.
The 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. We can add SQL functions, WHERE, and JOIN statements to the view, and we can also submit the data as if they came from a single table.
Note: The design and structure of a database is not affected by functions, where, or join statements in the view.
SQL CREATE VIEW Syntax
CREATE VIEW view_name asselect column_name (s) from table_namewhere condition
Note: Views always display the most recent data. Each time a user queries the view, the database engine rebuilds the data by using SQL statements.
SQL Update View
You can use the following syntax to update the view:
SQL CREATE or replace view syntaxcreate or replace view view_name Asselect column_name (s) from table_namewhere condition
SQL undo View
You can delete a view by using the drop View command.
SQL DROP View Syntaxdrop View view_name
View actual Application
In the EF framework, the use of views is one of the most effective ways to optimize query speed in a detailed list of multi-table federated queries.
There are two ways to create a new view:
One is the creation of an interface visualization, and one that is created using SQL scripts.
Below I share a CREATE view of the general script, for the new small white, can be saved, in case of a rainy future
Use Wot_inventorygoif EXISTS (SELECT 1 from sys.views WHERE Name = ' Invoicesearchlistview ') DROP VIEW Invoicesearchlis TView; Gocreate View Invoicesearchlistview As--replace the name of the views, write your query here to go
PS: Welcome to scan the QR code below or click on the link, join QQ group
SQL syntax Advanced Application II: View