drop table likes;
drop table frequents;
drop table serves;

create table likes (drinker char(20), beer char(10));
create table frequents (drinker char(20), bar char(20));
create table serves (bar char(20), beer char(10));

insert into likes (drinker, beer) values ('Bill', 'Bud');
insert into likes (drinker, beer) values ('Tony', 'Miller');
insert into likes (drinker, beer) values ('Mike', 'Coors');
insert into likes (drinker, beer) values ('Mike', 'Bud');
insert into likes (drinker, beer) values ('Steve', 'Strohs');
insert into likes (drinker, beer) values ('Steve', 'Coors');
insert into likes (drinker, beer) values ('Jane', 'Bud');
insert into likes (drinker, beer) values ('Jane', 'Miller');
insert into likes (drinker, beer) values ('Pam', 'Strohs');
insert into likes (drinker, beer) values ('Maggie', 'Coors');
insert into likes (drinker, beer) values ('Ann', 'Bud');
insert into likes (drinker, beer) values ('Ginny', 'Miller');
insert into likes (drinker, beer) values ('Laura', 'Bud');

insert into serves (bar, beer) values ('Left Bank', 'Miller');
insert into serves (bar, beer) values ('Left Bank', 'Bud');
insert into serves (bar, beer) values ('Subway', 'Miller');
insert into serves (bar, beer) values ('Subway', 'Bud');
insert into serves (bar, beer) values ('Subway', 'Coors');
insert into serves (bar, beer) values ('Subway', 'Strohs');
insert into serves (bar, beer) values ('Golden Greeks', 'Bud');
insert into serves (bar, beer) values ('Golden Greeks', 'Coors');
insert into serves (bar, beer) values ('Hotshots', 'Bud');
insert into serves (bar, beer) values ('Hotshots', 'Miller');

insert into frequents (drinker, bar) values ('Bill', 'Left Bank');
insert into frequents (drinker, bar) values ('Bill', 'Subway');
insert into frequents (drinker, bar) values ('Tony', 'Golden Greeks');
insert into frequents (drinker, bar) values ('Mike', 'Hotshots');
insert into frequents (drinker, bar) values ('Mike', 'Golden Greeks');
insert into frequents (drinker, bar) values ('Steve', 'Left Bank');
insert into frequents (drinker, bar) values ('Jane', 'Subway');
insert into frequents (drinker, bar) values ('Jane', 'Golden Greeks');
insert into frequents (drinker, bar) values ('Maggie', 'Hotshots');
insert into frequents (drinker, bar) values ('Ann', 'Left Bank');
insert into frequents (drinker, bar) values ('Ginny', 'Left Bank');
insert into frequents (drinker, bar) values ('Ginny', 'Subway');
insert into frequents (drinker, bar) values ('Ginny', 'Golden Greeks');
insert into frequents (drinker, bar) values ('Ginny', 'Hotshots');
insert into frequents (drinker, bar) values ('Laura', 'Subway');

select drinker, bar from likes, serves where likes.beer = serves.beer;

select distinct likes.drinker, frequents.bar, serves.beer from 
likes, serves, frequents 
where likes.beer = serves.beer and frequents.bar = serves.bar;

select drinker from likes where beer = 'Miller';

select * from frequents;