human
Schema:
swimmer (ID, name, Nationality, meter_100, meter_200, meter_300, meter_400, meter_500, meter_600, meter_700, Time)
stadium (ID, name, Capacity, City, Country, Opening_year)
event (ID, Name, Stadium_ID, Year)
record (ID, Result, Swimmer_ID, Event_ID)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the name of the swimmer who has the greatest number of records?
assistant
SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id GROUP BY t2.swimmer_id ORDER BY COUNT( * ) DESC LIMIT 1;
human
What about the least number of records?
assistant
SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id GROUP BY t2.swimmer_id ORDER BY COUNT( * ) ASC LIMIT 1;
human
What are the nationalities of swimmers 'Grant Hackett' and 'Craig Stevens'?
assistant
SELECT nationality FROM swimmer WHERE name = "Grant Hackett" OR name = "Craig Stevens" ;