Presentation is loading. Please wait.

Presentation is loading. Please wait.

View Processing & Update. View Processing create view PresSuite as select * from Room where NrBeds = 2 select * from PresSuite p natural join Reservation.

Similar presentations


Presentation on theme: "View Processing & Update. View Processing create view PresSuite as select * from Room where NrBeds = 2 select * from PresSuite p natural join Reservation."— Presentation transcript:

1 View Processing & Update

2 View Processing create view PresSuite as select * from Room where NrBeds = 2 select * from PresSuite p natural join Reservation s where Cost > 85 and ArrivalDate = “10 May” = select * from (select * from Room where NrBeds = 2) p natural join Reservation s where Cost > 85 and ArrivalDate = “10 May”

3 View Processing & Optimization Create view p:  NrBeds = 2 r Query with view:  Cost > 85  ArrivalDate = “10 May” (p |×| s) Optimize:  NrBeds = 2  Cost > 85 r |×|  ArrivalDate = “10 May” s Substitute view:  Cost > 85  ArrivalDate = “10 May” ((  NrBeds = 2 r) |×| s)

4 The View-Update Problem Q is the query that defines view V based on database D. U is the update specification. V is the updated view. T is the translator for U, i.e., the actual update applied to D. D is the updated database. Problem: there may be more than one translator T for a given update specification U. D D V V QQ T U

5 View-Update Problem – Example r = Guest Room s = Room RmView G1 R1 R1 Sea R2 City Guest RmView G1 Sea View Update: update WindowView set RmView = ‘City’ where Guest = ‘G1’ Two Translations (ambiguous): update r set Room = “R2” where Guest = “G1” update s set View = “City” where Room = “R1” Base Relations: View: create view WindowView as select Guest, RmView from r natural join s

6 Updatable Views When appropriately restricted, view updates work. Often overly restricted: typically to just  and  on a single table. create view PresSuite as select * from Room where NrBeds = 2 Then: update PresSuite set Name = “Clinton” where Name = “Nixon” delete from PresSuite where Name = “Kennedy” insert into PresSuite values (6, “Bush”, 2, 100)


Download ppt "View Processing & Update. View Processing create view PresSuite as select * from Room where NrBeds = 2 select * from PresSuite p natural join Reservation."

Similar presentations


Ads by Google