In SQL, use the CREATE VIEW statement to create a view. The syntax is: Named view: The view name is followed by AS to define the subquery: The AS keyword is followed by the subquery specified as the basis of the view
Commands to create views in SQL
In SQL, you can use the CREATE VIEW
statement to create a view.
Syntax
##CREATE VIEW View name
AS Subquery
Steps
to specify the name of the view to be created.
keyword. Subqueries can contain SELECT statements as well as other SQL operations.
Example
The following statement creates a view namedcustomer_view that contains the customer names and addresses in the customers table:
<code class="sql">CREATE VIEW customer_view AS SELECT customer_name, address FROM customers;</code>
Note
The above is the detailed content of What command is used to create a view in sql. For more information, please follow other related articles on the PHP Chinese website!