What is a view

A view is nothing but a window of an existing table by which one can view and can also change the values in tables. The main point aspect of view is views have no storage space. For this reason views are also called as virtual tables. Thus in other words a view is a database object that gives a logical representation of one or more database tables.

As we have seen above views have no data for themselves and they represent values from the exiting table. So one have a query why should one have a view concept when there is already a table existing. There are several reasons for the usage of views. But below are some of the reasons listed namely:

Protection of Data: There may be instance in which a person may like to present only certain data to particular group of employees from a table. In this case the person can create a view from the table having only the needed columns and can make the group of employees have access only to the view created and they by protect the table from unauthorized access.

Ease of Usage:Sometimes presenting only certain columns or data from a complex table would ease the maintenance and presentation of data.

The general format for creating a view is given below:


For example if there is a table named as exforsys having columns as empno, ename, sex, salary, depno and if one wishes to create a view named as e1 having columns namely empno, ename, salary having depno=1000. It is done as follows:

CREATE VIEW e1 AS SELECT empno, ename, salary FROM exforsys WHERE depno=1000;

One of the important things is if the base table is deleted and if one refers to the view then it would obviously result in an error.

Editorial Team at Geekinterview is a team of HR and Career Advice members led by Chandra Vennapoosa.

Editorial Team – who has written posts on Online Learning.

Pin It