Database: party_host

Question: How many parties are there?
SQL: SELECT count(*) FROM party

Question: List the themes of parties in ascending order of number of hosts.
SQL: SELECT Party_Theme FROM party ORDER BY Number_of_hosts ASC

Question: What are the themes and locations of parties?
SQL: SELECT Party_Theme , LOCATION FROM party

Question: Show the first year and last year of parties with theme "Spring" or "Teqnology".
SQL: SELECT First_year ,  Last_year FROM party WHERE Party_Theme  =  "Spring" OR Party_Theme  =  "Teqnology"

Question: What is the average number of hosts for parties?
SQL: SELECT avg(Number_of_hosts) FROM party

Question: What is the location of the party with the most hosts?
SQL: SELECT LOCATION FROM party ORDER BY Number_of_hosts DESC LIMIT 1

Question: Show different nationalities along with the number of hosts of each nationality.
SQL: SELECT Nationality ,  COUNT(*) FROM HOST GROUP BY Nationality

Question: Show the most common nationality of hosts.
SQL: SELECT Nationality FROM HOST GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1

Question: Show the nations that have both hosts older than 45 and hosts younger than 35.
SQL: SELECT Nationality FROM HOST WHERE Age  >  45 INTERSECT SELECT Nationality FROM HOST WHERE Age  <  35

Question: Show the themes of parties and the names of the party hosts.
SQL: SELECT T3.Party_Theme ,  T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID

Question: Show the locations of parties and the names of the party hosts in ascending order of the age of the host.
SQL: SELECT T3.Location ,  T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID ORDER BY T2.Age

Question: Show the locations of parties with hosts older than 50.
SQL: SELECT T3.Location FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID WHERE T2.Age  >  50

Question: Show the host names for parties with number of hosts greater than 20.
SQL: SELECT T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID WHERE T3.Number_of_hosts  >  20

Question: Show the name and the nationality of the oldest host.
SQL: SELECT Name ,  Nationality FROM HOST ORDER BY Age DESC LIMIT 1