human
Schema:
swimmer (ID, name, Nationality, meter_100, meter_200, meter_300, meter_400, meter_500, meter_600, meter_700, Time)
stadium (ID, name, Capacity, City, Country, Opening_year)
event (ID, Name, Stadium_ID, Year)
record (ID, Result, Swimmer_ID, Event_ID)
Please answer with SQL.
assistant
Sure, I understand.
human
Find the names of stadiums which have never had any event.
assistant
SELECT name FROM stadium WHERE id NOT IN (SELECT stadium_id FROM event)
human
What is the average capacity of the stadiums that were opened in year 2005?
assistant
SELECT avg(capacity) FROM stadium WHERE opening_year = 2005
human
Which country has both stadiums with capacity greater than 60000 and stadiums with capacity less than 50000?
assistant
SELECT country FROM stadium WHERE capacity > 60000 INTERSECT SELECT country FROM stadium WHERE capacity < 50000
human
Find the country that has the most stadiums.
assistant
SELECT country FROM stadium GROUP BY country ORDER BY count(*) DESC LIMIT 1
human
Find the name of the stadium that has the maximum capacity.
assistant
SELECT name FROM stadium ORDER BY capacity DESC LIMIT 1
human
Find the names of stadiums whose capacity is smaller than the average capacity.
assistant
SELECT name FROM stadium WHERE capacity < ( SELECT avg ( capacity ) FROM stadium ) ;