Thursday, September 5, 2013

View advantage and disadvantage ?

                               View in Sql

view is a virtual table based on the result-set of an SQL statement.

syntax :

CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition

What are the advantages and disadvantages of View? 

Advantages of views:

1. View the data without storing the data into the object.
2. Restict the view of a table i.e. can hide some of columns in the tables.
3. Join two or more tables and show it as one object to user.
4. Restict the access of a table so that nobody can insert the rows into the table.

Disadvatages:

1. Can not use DML operations on this.
2. When table is dropped view becomes inactive.. it depends on the table objects.
3. It is an object, so it occupies space.