Triggers on Views Generally,it is impossible to modify a virtual view,because it doesn't exist. 目 But an INSTEAD OF trigger lets us interpret view modifications in a way that makes sense. Example:View Synergy has (drinker, beer,bar)triples such that the bar serves the beer,the drinker frequents the bar and likes the beer. 11
11 Triggers on Views Generally, it is impossible to modify a virtual view, because it doesn ’t exist. But an INSTEAD OF trigger lets us interpret view modifications in a way that makes sense. Example: View Synergy has (drinker, beer, bar) triples such that the bar serves the beer, the drinker frequents the bar and likes the beer
Example:The View Pick one copy of CREATE VIEW Synergy AS each attribute SELECT Likes.drinker,Likes.beer,Sells.bar FROM Likes,Sells,Frequents WHERE Likes.drinker Frequents.drinker AND Likes.beer Sells.beer AND Sells.bar Frequents.bar; Natural join of Likes, 12 Sells,and Frequents
12 Example: The View CREATE VIEW Synergy AS SELECT Likes.drinker, Likes.beer, Sells.bar FROM Likes, Sells, Frequents WHERE Likes.drinker = Frequents.drinker AND Likes.beer = Sells.beer AND Sells.bar = Frequents.bar; Natural join of Likes, Sells, and Frequents Pick one copy of each attribute