-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek3_4.sql
More file actions
50 lines (50 loc) · 1.42 KB
/
Copy pathweek3_4.sql
File metadata and controls
50 lines (50 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- Dropping a view syntax:
Drop view viewname;
--Source Table
--Insert the below table
--ROLLNO NAME MARKS
--501 jyothi 90
--502 sai 95
--504 yamuna 70
--505 padma 60
--503 ravi 80
--Creating View
create view myview as select rollno,name from st1;
view created
--Display Views and Tables in your login
select * from tab;
--Inserting a row in view
insert into myview values(506,'prathisha');
1 row(s) inserted
--Display view
select * from myview;
--Displaying Table
select * from st1;
-- Deleting a row in a view
delete from myview where rollno=506;
1 row(s) deleted
--Display view
select * from myview;
--Displaying Table
select * from st1;
--Change the Structure of the View
create or replace view myview as select * from st1;
view created.
--Creating View when base table doesn’t exist
create or replace force view abc as select * from dummy_table;
--Creating Read only view
create view myview1 as select * from st1 with read only;
view created
--Inserting Data in Read only view
insert into myview1 values(503,'prathisha',80);
update myview1 set name='suma' where rollno=505;
-- Displaying view
select * from myview1;
--Creating View with check option
create view myview2 as select * from st1 where marks<101 with check option;
view created.
--Inserting a row into view
insert into myview2 values(504,'siri',101);
--Dropping view
Drop View myview1;
View dropped