DBMS

Friday, April 10, 2020

Introduction to Views

Views are the objects of the database which allows to access part of the entire logical model. Depending upon the requirement, access permission and authentication of the user, the views are created. Since, typically, views are actual relation stored in database i.e. views are typically not belong to the conceptual model. View allows to showcase only specific rows depending upon condition corresponding to specific attributes belonging to same or different tables

A view is defined using create view statement and uses one or more existing table.

The generic statement for creating view is as follows:

     create view view_name as query_expression

Here, we are taking an example of table t1 and creating a view v_t1 based on table single table t1.


We can see using show table command that view is listed with other existing tables.

Describe View


The logical schema of the newly created view using following command:

desc v_t1;       OR 

describe v_t1;

Drop View

The view can be permanently drop existing view definition by using following command:

drop view v_t1;

Insert Data through View

Whenever a user need to insert data through views so data will be updated in the original table (if certain condition satisfy). The condition is view must be insertable (will discuss later in detail).

No comments:

Post a Comment