You are on page 1of 2

6th LAB PROGRAM

create table employee01(empno varchar(5)primary key,emp_name varchar(20),dept


varchar(10)salary number(10,3),doj date,branch varchar(20));

select * from employee01;

EMPNO EMP_NAME DEPT SALARY DOJ BRANCH


E101 amit production 45000 12-MAR-00 bangalore
E102 amit HR 70000 03-JUL-02 bangalore
E103 sunita Management 120000 11-JAN-01 mysore
E105 sunita IT 67000 01-AUG-01 mysore
E106 mahesh Civil 145000 20-SEP-03 mumbai

create view s2

as select empno,emp_name,salary from employee01

where emp_name='amit';

View created.
select * from s2;
EMPNO EMP_NAME SALARY
E101 amit 45000
E102 amit 70000

insert into s2 values('E109','vijayalaxmi',89000);


1 row(s) inserted.
select * from s2;
EMPNO EMP_NAME SALARY
E101 amit 45000
E102 amit 70000

create view s4
as select empno,emp_name,salary,doj,branch
from employee01
where branch='mysore' with check option;
View created.

insert into s4 values('E130','vijayalaxmi',89000,'12-


jan-2018','mysore');
select * from s4;
EMPNO EMP_NAME SALARY DOJ BRANCH
E103 sunita 120000 11-JAN-01 mysore
E105 sunita 67000 01-AUG-01 mysore
E130 vijayalaxmi 89000 12-JAN-18 mysore

drop view s4;


View dropped.
select * from s4;
ORA-00942: table or view does not exist

You might also like