





















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















































Select-From-Where Statements
Multirelation Queries Subqueries
8
Check if Anheuser-Busch
name manf
Bud Anheuser-Busch Include t.name in the result, if so
Tuple-variable t loops over all tuples
SELECT * FROM Beers WHERE manf = ’Anheuser-Busch’;
name manf Bud Anheuser-Busch Bud Lite Anheuser-Busch Michelob Anheuser-Busch
......
11
Now, the result has each of the attributes of Beers.
beer manf
Bud Anheuser-Busch
Bud Lite Anheuser-Busch
Michelob Anheuser-Busch
......
SELECT bar, beer, price*114 AS priceInYen FROM Sells;
SELECT drinker, ’likes Bud’ AS whoLikesBud FROM Likes WHERE beer = ’Bud’;
drinker whoLikesBud
Sally likes Bud
Fred likes Bud
… …
SELECT ’Joe’’s Bar’, beer, price
FROM Menu;