There are a number of scenarios where we have to look for a view as a solution.
• To hide the complexity of the underlying database schema, or customize the data and schema for a set of users.
• To control access to rows and columns of data.
• To aggregate data for performance.
Views are used for security purposes because they provide encapsulation of the name of the table. Data is in the virtual table, not stored permanently. Views display only selected data.
Syntax of a View:
CREATE VIEW view_name AS
SELECT column_name(s) FROM table_name WHERE condition
There are two types of views.
• Simple View
• Complex View