Database: farm

Question: What are the maximum and minimum number of cows across all farms.
SQL: SELECT max(Cows) ,  min(Cows) FROM farm

Question: List the official name and status of the city with the largest population.
SQL: SELECT Official_Name ,  Status FROM city ORDER BY Population DESC LIMIT 1

Question: Show the official names of the cities that have hosted more than one competition.
SQL: SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID  =  T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*)  >  1

Question: Show the status of the city that has hosted the greatest number of competitions.
SQL: SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID  =  T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1

Question: Please show the themes of competitions with host cities having populations larger than 1000.
SQL: SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID  =  T2.Host_city_ID WHERE T1.Population  >  1000

Question: Please show the different statuses, ordered by the number of cities that have each.
SQL: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC

Question: List the most common type of Status across cities.
SQL: SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1

Question: List the official names of cities that have not held any competition.
SQL: SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition)

Question: Show the status shared by cities with population bigger than 1500 and smaller than 500.
SQL: SELECT Status FROM city WHERE Population  >  1500 INTERSECT SELECT Status FROM city WHERE Population  <  500