Use of View in SQL
Views are tables whose contents are taken or derived from other tables. View tables don’t contain data. It just acts as a window through which certain contents of a table can be displayed or seen. It also can manipulate the contents of the original table through such views.
The view is created using the CREATE command. It has the following syntax:
CREATE VIEW <VIEW NAME> AS <SELECT STATEMENT>; or REPLACE VIEW <VIEW NAME> AS <SELECT STATEMENT>;
Use of View:
Views are used for the following purposes:
1. 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 showing only that part of the table.
2. Critical data in a table can be easily safeguarded using views.
3. Views allow users to make simple queries to retrieve the required results.
4. Views allow the same data to be seen by different users in different ways.