-- Nov 13 In-Class Exercise Thread
Drinker(name, address, favBeer)
Beer(name, manufacturer, category)
I want to find the name, address of the drinkers who favorite a beer made by Anheuser Bush
1. SELECT Drinker.name and Drinker.address FROM Drinker, Beer WHERE drinker.favBeer = Beer.name, manufacturer = 'Anheuser Bush';
2. SELECT Drinker.name and Drinker.address FROM Drinker JOIN Beer ON (drinker.favBeer = Beer.name) WHERE manufacturer = 'Anheuser Bush';
The second query is more effective and readable since we can see the join table before getting the result of the query
Drinker(name, address, favBeer)
Beer(name, manufacturer, category)
I want to find the name, address of the drinkers who favorite a beer made by Anheuser Bush
1. SELECT Drinker.name and Drinker.address FROM Drinker, Beer WHERE drinker.favBeer = Beer.name, manufacturer = 'Anheuser Bush';
2. SELECT Drinker.name and Drinker.address FROM Drinker JOIN Beer ON (drinker.favBeer = Beer.name) WHERE manufacturer = 'Anheuser Bush';
The second query is more effective and readable since we can see the join table before getting the result of the query