human
Schema:
grapes (ID, Grape, Color)
appellations (No, Appelation, County, State, Area, isAVA)
wine (No, Grape, Winery, Appelation, State, Name, Year, Price, Score, Cases, Drink)
Please answer with SQL.
assistant
Sure, I understand.
human
find the appellations that have more three wines.
assistant
SELECT Appelation FROM WINE GROUP BY Appelation HAVING COUNT( * ) > 3;
human
how about those that have at most three?
assistant
SELECT Appelation FROM WINE GROUP BY Appelation HAVING COUNT( * ) <= 3;
human
find the countries of these appellations.
assistant
SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation HAVING COUNT( * ) <= 3 ;