1. Hops are an essential ingredient in beer brewing. They impartaroma, flavour and bitterness, and also act...
Fantastic news! We've Found the answer you've been seeking!
Question:
1. Hops are an essential ingredient in beer brewing. They impartaroma, flavour and bitterness, and also act as a preservative. Somehop varieties are very popular, while others are rarely used.Define a view Q7(hop) that finds the most frequently usedhop variety.
2. The most common beer styles nowadays are IPAs, Lagersand Stouts. Define a view Q8(brewery)that finds breweries thatdo not make any of these common beer styles. Find beer styles thatinclude precisely the string "IPA" or "Lager" or "Stout" somewherein the style name.
Tables:
create type IngredientType as enum ('hop','grain','adjunct');create type ContainerType as enum ('bottle','can','growler','keg');create domain YearValue as integer check (value between 1000 and 2100);create domain MilliLiters as integer check (value > 0);create domain URLvalue as text check (value like '%.%'); -- weak checkcreate domain ABVvalue as real check (value between 0.0 and 100.0);create domain IBUvalue as integer check (value between 0 and 200);-- Tablescreate table Locations ( id integer, -- would normally use serial country text not null, -- must at least know country region text, -- state or shire or ... metro text, -- metroploitan area (e.g. Sydney) town text, -- in metro area => suburb, outside metro => town primary key (id));create table Styles ( id integer, -- would normally use serial name text not null, -- name of style (e.g. lager, IPA) min_abv ABVvalue not null, max_abv ABVvalue not null, primary key (id), constraint minmax check (min_abv <= max_abv));create table Ingredients ( id integer, -- would normally use serial itype IngredientType not null, name text not null, primary key (id));create table Breweries ( id integer, -- would normally use serial name text not null, founded YearValue, website URLvalue, located_in integer not null references Locations(id), primary key (id));create table Beers ( id integer, -- would normally use serial name text not null, brewed YearValue, style integer not null references Styles(id), ABV ABVvalue not null, IBU IBUvalue, sold_in ContainerType, volume MilliLiters, notes text, rating integer not null check (rating between 0 and 10), primary key (id));create table Contains ( beer integer references Beers(id), ingredient integer references Ingredients(id), primary key (beer,ingredient));create table Brewed_by ( beer integer references Beers(id), brewery integer references Breweries(id), primary key (beer,brewery));
Posted Date: