human
Schema:
film (Film_ID, Rank_in_series, Number_in_season, Title, Directed_by, Original_air_date, Production_code)
cinema (Cinema_ID, Name, Openning_year, Capacity, Location)
schedule (Cinema_ID, Film_ID, Date, Show_times_per_day, Price)
Please answer with SQL.
assistant
Sure, I understand.
human
Show the cinema name and location for cinemas with capacity above average.
assistant
SELECT name , LOCATION FROM cinema WHERE capacity > (SELECT avg(capacity) FROM cinema)
human
What are all the locations with a cinema?
assistant
SELECT DISTINCT LOCATION FROM cinema
human
What is the location with the most cinemas opened in year 2010 or later?
assistant
SELECT LOCATION FROM cinema WHERE openning_year >= 2010 GROUP BY LOCATION ORDER BY count(*) DESC LIMIT 1
human
What are the name and location of the cinema with the largest capacity?
assistant
SELECT name , LOCATION FROM cinema ORDER BY capacity DESC LIMIT 1
human
Find the locations that have more than one movie theater with capacity above 300.
assistant
SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING count(*) > 1
human
Which locations have 2 or more cinemas with capacity over 300?
assistant
SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING COUNT( * ) >= 2 ;