Wednesday, August 20, 2014

VIEW (SQL)

WHAT IS A VIEW

View is a virtual table whose contents are defined by a query.

A view is the result set of a stored query on the data, which the database users can query just as they would in a persistent database collection object.

It is a virtual table computed or collated dynamically from data in the database when access to that view is requested.Changes applied to the data in a relevant underlying table are reflected in the data shown in subsequent invocations of the view.

CREATE VIEW SYNTAX

CREATE VIEW [ViewName]
AS
SELECT statement

Ex :

CREATE VIEW test
AS
SELECT empid,
              empname,
              empaddress
FROM employee

Get Result from view :

SELECT * FROM test

DROP VIEW

DROP VIEW ViewName

Ex: Drop View test

2 comments:

  1. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. Your write up is a fine example of it.
    Oracle Financials Training in Hyderabad

    ReplyDelete