A) -->view is database object. view is nothing but a virtual table.
--->it is saved on the sql quaries.
--->views are does not store data.
advantages:
---> views can be used to reduce complexity of the database schema.
--->views can be used to row and column level security.
----> views can be used to present aggregated data and hide the detailed data.
create a view:
create view view name
As
query
Drop a view:
drop view viewname
example :
create table tb1
id int,
name varchar(25),
address varchar(100)
insert into tb1 values (1,'raju','gnt')
insert into tb1 values (2,'ramu','hyd')
insert into tb1 values (3,'raghu','viz')
id name address
1 raju gnt
2 ramu hyd
3 raghu viz
create view view123
as
select * from tb1
insert into view123 value (4,'vamsi','ppm')
select * from view123
id name address
1 raju gnt
2 ramu hyd
3 raghu viz
4 vamsi ppm
update view123 set name='naidu' where id=4
select * from view123
id name address
1 raju gnt
2 ramu hyd
3 raghu viz
4 naidu ppm
delete from view123 from id=4
select * from view123
id name address
1 raju gnt
2 ramu hyd
3 raghu viz