Database: party_host

CREATE TABLE "party" (
"Party_ID" int,
"Party_Theme" text,
"Location" text,
"First_year" text,
"Last_year" text,
"Number_of_hosts" int,
PRIMARY KEY ("Party_ID")
);
CREATE TABLE "host" (
"Host_ID" int,
"Name" text,
"Nationality" text,
"Age" text,
PRIMARY KEY ("Host_ID")
);
CREATE TABLE "party_host" (
"Party_ID" int,
"Host_ID" int,
"Is_Main_in_Charge" bool,
PRIMARY KEY ("Party_ID","Host_ID"),
FOREIGN KEY ("Host_ID") REFERENCES `host`("Host_ID"),
FOREIGN KEY ("Party_ID") REFERENCES `party`("Party_ID")
);

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

Question: Count the number of parties.
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 of parties ordered by the number of hosts in ascending manner?
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: Give me the theme and location of each party.
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 are the first year and last year of the parties whose theme is "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: Compute 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: Which party had the most hosts? Give me the party location.
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: How many hosts does each nationality have? List the nationality and the count.
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: Which nationality has the most 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: Which nations have both hosts of age above 45 and hosts of age below 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: For each party, return its theme and the name of its host.
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: For each party, find its location and the name of its host. Sort the result 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: Which parties have hosts of age above 50? Give me the party locations.
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: Which parties have more than 20 hosts? Give me the host names for these parties.
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

Question: What are the name and the nationality of the host of the highest age?
SQL: SELECT Name ,  Nationality FROM HOST ORDER BY Age DESC LIMIT 1

Question: List the names of hosts who did not serve as a host of any party in our record.
SQL: SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host)

Question: What are the names of hosts who did not host any party in our record?
SQL: SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host)