Database Management Systems (2130703)

BE | Semester-3   Summer-2018 | 05/23/2018

Q1) (a)

Define view. Write syntax to create view. Give an example of view.

View

  • A View is a virtual table based on the result-set of an SQL statement.

Syntax of view is

CREATE VIEW view_name AS
SELECT column1, column2, ...
FROM table_name
WHERE condition;

Example of view is

  • The view "Current Product List" lists all active products (products that are not discontinued) from the "Products" table. The view is created with the following SQL:
CREATE VIEW [Current Product List] AS
SELECT ProductID, ProductName
FROM Products
WHERE Discontinued = No