Database: concert_singer

Question: How many singers do we have?
SQL: SELECT count(*) FROM singer

Question: Show name, country, age for all singers ordered by age from the oldest to the youngest.
SQL: SELECT name ,  country ,  age FROM singer ORDER BY age DESC

Question: What is the average, minimum, and maximum age of all singers from France?
SQL: SELECT avg(age) ,  min(age) ,  max(age) FROM singer WHERE country  =  'France'

Question: Show the name and the release year of the song by the youngest singer.
SQL: SELECT song_name ,  song_release_year FROM singer ORDER BY age LIMIT 1

Question: What are all distinct countries where singers above age 20 are from?
SQL: SELECT DISTINCT country FROM singer WHERE age  >  20

Question: Show all countries and the number of singers in each country.
SQL: SELECT country ,  count(*) FROM singer GROUP BY country

Question: List all song names by singers above the average age.
SQL: SELECT song_name FROM singer WHERE age  >  (SELECT avg(age) FROM singer)

Question: Show location and name for all stadiums with a capacity between 5000 and 10000.
SQL: SELECT LOCATION ,  name FROM stadium WHERE capacity BETWEEN 5000 AND 10000

Question: What is the average and the maximum capacity of all stadiums?
SQL: SELECT avg(capacity) ,  max(capacity) FROM stadium

Question: What is the name and capacity for the stadium with highest average attendance?
SQL: SELECT name ,  capacity FROM stadium ORDER BY average DESC LIMIT 1

Question: How many concerts are there in year 2014 or 2015?
SQL: SELECT count(*) FROM concert WHERE YEAR  =  2014 OR YEAR  =  2015

Question: Show the stadium name and the number of concerts in each stadium.
SQL: SELECT T2.name ,  count(*) FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id  =  T2.stadium_id GROUP BY T1.stadium_id

Question: Show the stadium name and capacity with most number of concerts in year 2014 or after.
SQL: SELECT T2.name ,  T2.capacity FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id  =  T2.stadium_id WHERE T1.year  >=  2014 GROUP BY T2.stadium_id ORDER BY count(*) DESC LIMIT 1

Question: Which year has most number of concerts?
SQL: SELECT YEAR FROM concert GROUP BY YEAR ORDER BY count(*) DESC LIMIT 1

Question: Show the stadium names without any concert.
SQL: SELECT name FROM stadium WHERE stadium_id NOT IN (SELECT stadium_id FROM concert)

Question: Show countries where a singer above age 40 and a singer below 30 are from.
SQL: SELECT country FROM singer WHERE age  >  40 INTERSECT SELECT country FROM singer WHERE age  <  30

Question: Show names for all stadiums except for stadiums having a concert in year 2014.
SQL: SELECT name FROM stadium EXCEPT SELECT T2.name FROM concert AS T1 JOIN stadium AS T2 ON T1.stadium_id  =  T2.stadium_id WHERE T1.year  =  2014

Question: Show the name and theme for all concerts and the number of singers in each concert.
SQL: SELECT T2.concert_name ,  T2.theme ,  count(*) FROM singer_in_concert AS T1 JOIN concert AS T2 ON T1.concert_id  =  T2.concert_id GROUP BY T2.concert_id