-- Q1: oldest cheesemaker

create or replace view Q1(maker,founded)
as
-- your code here
;

-- Q2: cheese with same name as style

create or replace view Q2(cheese,maker)
as
-- your code here
;

-- Q3: Crumbly cheeses

create or replace view Q3(cheese,maker)
as
-- your code here
;

-- Q4: How many of each hardness level

create or replace view Q4(hardness,ncheeses)
as
-- your code here
;

-- Q5: Most popular cheese style

create or replace view Q5(style)
as
-- your code here
;

-- Q6: Country that makes the most styles of cheese

create or replace view Q6(country)
as
-- your code here
;

-- Q7: Cheeses that are aged outside the "standard" aging period

create or replace view Q7(cheese,maker,aged,min_aging,max_aging)
as
-- your code here
;

-- Q8: Return a list of cheesemakers matching a partial name, and their location

drop function if exists Q8;
drop type if exists MakerPlace;
create type MakerPlace as ( maker text, location text );

create or replace function Q8(partial_name text)
	returns setof MakerPlace
as $$
-- your code here
$$ language plpgsql;

-- Q9: Lists of cheeses for cheesemakers matching a partial name

drop function if exists Q9;
drop type if exists OneCheese;
create type OneCheese as ( maker text, cheese text, style text );

create or replace function Q9(partial_name text)
	returns setof OneCheese
as $$
-- your code here
$$ language plpgsql;
