Views are database objects that are built by the query. Views can be built using a single table or multiple tables by way of join. Their definition is stored permanently in data dictionary but they don’t store copy of the data. Data for the view is built dynamically. A view may contain a subset of rows of the table or a subset of columns of the table. You can use regular SELECT statement to retrieve data from Views. An existing view can be modified using REPLACE VIEW statement. An existing view can be dropped using DROP VIEW statement.

Create/Replace a View

<select query>;

Drop a view

DROP VIEW <view name>;

Advantages of Views

  • Views provide additional level of security by restricting the rows or columns of a table.
  • Users can be given access only to views instead of base tables.
  • Simplifies the use of multiple tables by pre-joining them using Views.


Leave a Reply

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