DBMSSQL

Creating Views in SQL

VIEW 

Views are tables whose contents are taken or derived from other tables. View tables do not contain data. They just act as a window through which certain contents of a table can be displayed or seen. We can manipulate contents of original table using such views. View are used to restrict the access to the original table and to restrict the unauthorized person from altering original database or table. We can show data in view table form many related tables simultaneously. 

View can be created using CREATE View command. Syntax for creating View is as :

CREATE VIEW <VIEW NAME> AS <SELECT STATEMENT> FROM <TABLE NAME>;

Here CREATE VIEW is command used to create view ,VIEW NAME is name given to the view, SELECT STATEMENT means columns which you want to show in your view and lastly FROM <TABLE NAME > is source for the view.

Now we have created VIEW it can be treated same like a table. You can retrieve the records in a view using SELECT command, delete the records using DELETE command and update them using the UPDATE command. Views can also joined same as tables.

Some features of using VIEWS are Critical data in a table can be easily safe guarded using views.

VIEWS restrict access to a database. If you want users to see some but not all data of a table, you can create a view.

VIEWS allow users to make simple queries to retrieve the required results.

VIEWS allow the same data to be seen by different users in different ways.

Show More

Related Articles

Leave a Reply

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

Check Also
Close
Back to top button