VIEW in SQL


VIEW (view) in SQL is a virtual table, through which we can see a piece of data from one or more tables. VIEW does not contain any data, and is used to restrict database access or to hide complex data. To learn more about VIEW in SQL, read the following article of Taimienphi.vn.


In the previous articles, Taimienphi.vn introduced you to SQL commands, including CREATE, DELETE, INSERT, … The following article Taimienphi.vn will introduce you more about VIEW in SQL.

VIEW (views) in SQL are stored as SELECT statements in a database. DML operations in VIEW such as INSERT, UPDATE, DELETE affect the data in the original table.

Syntax creating VIEW in SQL

The syntax for creating VIEW in SQL is:

CREATE VIEW view_name

AS

SELECT column_list

FROM table_name [WHERE condition];

Inside:

view_name is the name of VIEW.

– The SELECT statement is used to identify the columns and rows you want to display on VIEW.

Example VIEW in SQL

To create VIEW in the product table, the SQL query is written as follows:

CREATE VIEW view_product

AS

SELECT product_id, product_name

FROM product;

https://thuthuat.taimienphi.vn/view-trong-sql-33415n.aspx
Above is the information about VIEW in SQL. In addition to the basic commands that Taimienphi.vn introduced earlier, to learn more about the commands that grant and revoke privileges, permissions in SQL, or other commands such as Index in SQL To delete data, readers can find out the latest SQL articles on Taimienphi.vn.

.

Add a Comment

Your email address will not be published. Required fields are marked *