human
Schema:
party (Party_ID, Party_Theme, Location, First_year, Last_year, Number_of_hosts)
host (Host_ID, Name, Nationality, Age)
party_host (Party_ID, Host_ID, Is_Main_in_Charge)
Please answer with SQL.
assistant
Sure, I understand.
human
Show the name and the nationality of the oldest host.
assistant
SELECT Name , Nationality FROM HOST ORDER BY Age DESC LIMIT 1
human
List the themes of parties in ascending order of number of hosts.
assistant
SELECT Party_Theme FROM party ORDER BY Number_of_hosts ASC
human
Show the host names for parties with number of hosts greater than 20.
assistant
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
human
What is the average number of hosts for parties?
assistant
SELECT avg(Number_of_hosts) FROM party
human
What is the location of the party with the most hosts?
assistant
SELECT LOCATION FROM party ORDER BY Number_of_hosts DESC LIMIT 1
human
What are the names of hosts who did not host any party in our record?
assistant
SELECT Name FROM HOST WHERE Host_ID NOT IN ( SELECT Host_ID FROM party_host ) ;