messages
listlengths
3
3
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What are the numbers of the shortest flights?\nSELECT \n" }, { "role": "assistant", "content": "flno from flight order by distance asc limit 3" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What is the average distance and average price for flights from Los Angeles.\nSELECT \n" }, { "role": "assistant", "content": "avg ( distance ) , avg ( price ) from flight where origin = 'Los Angeles'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What is the average distance and price for all flights from LA?\nSELECT \n" }, { "role": "assistant", "content": "avg ( distance ) , avg ( price ) from flight where origin = 'Los Angeles'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show all origins and the number of flights from each origin.\nSELECT \n" }, { "role": "assistant", "content": "origin , count ( * ) from flight group by origin" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### For each origin, how many flights came from there?\nSELECT \n" }, { "role": "assistant", "content": "origin , count ( * ) from flight group by origin" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show all destinations and the number of flights to each destination.\nSELECT \n" }, { "role": "assistant", "content": "destination , count ( * ) from flight group by destination" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What are the destinations and number of flights to each one?\nSELECT \n" }, { "role": "assistant", "content": "destination , count ( * ) from flight group by destination" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Which origin has most number of flights?\nSELECT \n" }, { "role": "assistant", "content": "origin from flight group by origin order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What place has the most flights coming from there?\nSELECT \n" }, { "role": "assistant", "content": "origin from flight group by origin order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Which destination has least number of flights?\nSELECT \n" }, { "role": "assistant", "content": "destination from flight group by destination order by count ( * ) asc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What destination has the fewest number of flights?\nSELECT \n" }, { "role": "assistant", "content": "destination from flight group by destination order by count ( * ) asc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What is the aircraft name for the flight with number 99\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name from flight join aircraft on flight.aid = aircraft.aid where flight.flno = 99" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What is the name of the aircraft that was on flight number 99?\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name from flight join aircraft on flight.aid = aircraft.aid where flight.flno = 99" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show all flight numbers with aircraft Airbus A340-300.\nSELECT \n" }, { "role": "assistant", "content": "flight.flno from flight join aircraft on flight.aid = aircraft.aid where aircraft.name = 'Airbus A340-300'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What are the flight numbers for the aircraft Airbus A340-300?\nSELECT \n" }, { "role": "assistant", "content": "flight.flno from flight join aircraft on flight.aid = aircraft.aid where aircraft.name = 'Airbus A340-300'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show aircraft names and number of flights for each aircraft.\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name , count ( * ) from flight join aircraft on flight.aid = aircraft.aid group by flight.aid" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What is the name of each aircraft and how many flights does each one complete?\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name , count ( * ) from flight join aircraft on flight.aid = aircraft.aid group by flight.aid" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show names for all aircraft with at least two flights.\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name from flight join aircraft on flight.aid = aircraft.aid group by flight.aid having count ( * ) >= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What are the names for all aircrafts with at least 2 flights?\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name from flight join aircraft on flight.aid = aircraft.aid group by flight.aid having count ( * ) >= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### How many employees have certificate.\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct eid ) from certificate" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What is the count of distinct employees with certificates?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct eid ) from certificate" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show ids for all employees who don't have a certificate.\nSELECT \n" }, { "role": "assistant", "content": "eid from employee except select eid from certificate" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What are the ids of all employees that don't have certificates?\nSELECT \n" }, { "role": "assistant", "content": "eid from employee except select eid from certificate" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show names for all aircrafts of which John Williams has certificates.\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where employee.name = 'John Williams'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What are the names of all aircrafts that John Williams have certificates to be able to fly?\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where employee.name = 'John Williams'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show names for all employees who have certificate of Boeing 737-800.\nSELECT \n" }, { "role": "assistant", "content": "employee.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where aircraft.name = 'Boeing 737-800'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What are the names of all employees who have a certificate to fly Boeing 737-800?\nSELECT \n" }, { "role": "assistant", "content": "employee.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where aircraft.name = 'Boeing 737-800'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300.\nSELECT \n" }, { "role": "assistant", "content": "employee.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where aircraft.name = 'Boeing 737-800' intersect select employee.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where aircraft.name = 'Airbus A340-300'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What are the names of all employees who can fly both the Boeing 737-800 and the Airbus A340-300?\nSELECT \n" }, { "role": "assistant", "content": "employee.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where aircraft.name = 'Boeing 737-800' intersect select employee.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where aircraft.name = 'Airbus A340-300'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show names for all employees who do not have certificate of Boeing 737-800.\nSELECT \n" }, { "role": "assistant", "content": "name from employee except select employee.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where aircraft.name = 'Boeing 737-800'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What are the names of all employees who are not certified to fly Boeing 737-800s?\nSELECT \n" }, { "role": "assistant", "content": "name from employee except select employee.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where aircraft.name = 'Boeing 737-800'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show the name of aircraft which fewest people have its certificate.\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name from certificate join aircraft on aircraft.aid = certificate.aid group by certificate.aid order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What are the names of the aircraft that the least people are certified to fly?\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name from certificate join aircraft on aircraft.aid = certificate.aid group by certificate.aid order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people have its certificate.\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name from certificate join aircraft on aircraft.aid = certificate.aid where aircraft.distance > 5000 group by certificate.aid order by count ( * ) >= 5 asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What is the name and distance of every aircraft that can cover a distance of more than 5000 and which at least 5 people can fly?\nSELECT \n" }, { "role": "assistant", "content": "aircraft.name from certificate join aircraft on aircraft.aid = certificate.aid where aircraft.distance > 5000 group by certificate.aid order by count ( * ) >= 5 asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### what is the salary and name of the employee who has the most number of aircraft certificates?\nSELECT \n" }, { "role": "assistant", "content": "employee.name , employee.salary from employee join certificate on employee.eid = certificate.eid group by employee.eid order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What is the salaray and name of the employee that is certified to fly the most planes?\nSELECT \n" }, { "role": "assistant", "content": "employee.name , employee.salary from employee join certificate on employee.eid = certificate.eid group by employee.eid order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000?\nSELECT \n" }, { "role": "assistant", "content": "employee.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where aircraft.distance > 5000 group by employee.eid order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# flight ( flno , origin , destination , distance , departure_date , arrival_date , price , aid )\n# aircraft ( aid , name , distance )\n# employee ( eid , name , salary )\n# certificate ( eid , aid )\n# flight.aid = aircraft.aid\n# certificate.aid = aircraft.aid\n# certificate.eid = employee.eid\n\n#\n### What is the salaray and name of the employee with the most certificates to fly planes more than 5000?\nSELECT \n" }, { "role": "assistant", "content": "employee.name from employee join certificate on employee.eid = certificate.eid join aircraft on aircraft.aid = certificate.aid where aircraft.distance > 5000 group by employee.eid order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many allergies are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct allergy ) from allergy_type" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many allergy entries are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct allergy ) from allergy_type" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many different allergy types exist?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct allergytype ) from allergy_type" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many distinct allergies are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct allergytype ) from allergy_type" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all allergy types.\nSELECT \n" }, { "role": "assistant", "content": "distinct allergytype from allergy_type" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the different allergy types?\nSELECT \n" }, { "role": "assistant", "content": "distinct allergytype from allergy_type" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all allergies and their types.\nSELECT \n" }, { "role": "assistant", "content": "allergy , allergytype from allergy_type" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the allergies and their types?\nSELECT \n" }, { "role": "assistant", "content": "allergy , allergytype from allergy_type" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all allergies with type food.\nSELECT \n" }, { "role": "assistant", "content": "distinct allergy from allergy_type where allergytype = 'food'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are all the different food allergies?\nSELECT \n" }, { "role": "assistant", "content": "distinct allergy from allergy_type where allergytype = 'food'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What is the type of allergy Cat?\nSELECT \n" }, { "role": "assistant", "content": "allergytype from allergy_type where allergy = 'Cat'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What is allergy type of a cat allergy?\nSELECT \n" }, { "role": "assistant", "content": "allergytype from allergy_type where allergy = 'Cat'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many allergies have type animal?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from allergy_type where allergytype = 'animal'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many animal type allergies exist?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from allergy_type where allergytype = 'animal'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all allergy types and the number of allergies in each type.\nSELECT \n" }, { "role": "assistant", "content": "allergytype , count ( * ) from allergy_type group by allergytype" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the allergy types and how many allergies correspond to each one?\nSELECT \n" }, { "role": "assistant", "content": "allergytype , count ( * ) from allergy_type group by allergytype" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Which allergy type has most number of allergies?\nSELECT \n" }, { "role": "assistant", "content": "allergytype from allergy_type group by allergytype order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Which allergy type is most common?\nSELECT \n" }, { "role": "assistant", "content": "allergytype from allergy_type group by allergytype order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Which allergy type has least number of allergies?\nSELECT \n" }, { "role": "assistant", "content": "allergytype from allergy_type group by allergytype order by count ( * ) asc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Which allergy type is the least common?\nSELECT \n" }, { "role": "assistant", "content": "allergytype from allergy_type group by allergytype order by count ( * ) asc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What is the total number of students?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show first name and last name for all students.\nSELECT \n" }, { "role": "assistant", "content": "fname , lname from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the full names of all students\nSELECT \n" }, { "role": "assistant", "content": "fname , lname from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many different advisors are listed?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct advisor ) from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many advisors are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct advisor ) from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all majors.\nSELECT \n" }, { "role": "assistant", "content": "distinct major from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the different majors?\nSELECT \n" }, { "role": "assistant", "content": "distinct major from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all cities where students live.\nSELECT \n" }, { "role": "assistant", "content": "distinct city_code from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What cities do students live in?\nSELECT \n" }, { "role": "assistant", "content": "distinct city_code from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show first name, last name, age for all female students. Their sex is F.\nSELECT \n" }, { "role": "assistant", "content": "fname , lname , age from student where sex = 'F'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the full names and ages for all female students whose sex is F?\nSELECT \n" }, { "role": "assistant", "content": "fname , lname , age from student where sex = 'F'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show student ids for all male students.\nSELECT \n" }, { "role": "assistant", "content": "stuid from student where sex = 'M'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the student ids for all male students?\nSELECT \n" }, { "role": "assistant", "content": "stuid from student where sex = 'M'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students are age 18?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from student where age = 18" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students are 18 years old?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from student where age = 18" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all student ids who are older than 20.\nSELECT \n" }, { "role": "assistant", "content": "stuid from student where age > 20" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the student ids for students over 20 years old?\nSELECT \n" }, { "role": "assistant", "content": "stuid from student where age > 20" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Which city does the student whose last name is \"Kim\" live in?\nSELECT \n" }, { "role": "assistant", "content": "city_code from student where lname = 'Kim'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Give the city that the student whose family name is Kim lives in.\nSELECT \n" }, { "role": "assistant", "content": "city_code from student where lname = 'Kim'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Who is the advisor of student with ID 1004?\nSELECT \n" }, { "role": "assistant", "content": "advisor from student where stuid = 1004" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Who advises student 1004?\nSELECT \n" }, { "role": "assistant", "content": "advisor from student where stuid = 1004" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students live in HKG or CHI?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from student where city_code = 'HKG' or city_code = 'CHI'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Give the number of students living in either HKG or CHI.\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from student where city_code = 'HKG' or city_code = 'CHI'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show the minimum, average, and maximum age of all students.\nSELECT \n" }, { "role": "assistant", "content": "min ( age ) , avg ( age ) , max ( age ) from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What is the minimum, mean, and maximum age across all students?\nSELECT \n" }, { "role": "assistant", "content": "min ( age ) , avg ( age ) , max ( age ) from student" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What is the last name of the youngest student?\nSELECT \n" }, { "role": "assistant", "content": "lname from student where age = ( select min ( age ) from student )" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Provide the last name of the youngest student.\nSELECT \n" }, { "role": "assistant", "content": "lname from student where age = ( select min ( age ) from student )" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show the student id of the oldest student.\nSELECT \n" }, { "role": "assistant", "content": "stuid from student where age = ( select max ( age ) from student )" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What student id corresponds to the oldest student?\nSELECT \n" }, { "role": "assistant", "content": "stuid from student where age = ( select max ( age ) from student )" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all majors and corresponding number of students.\nSELECT \n" }, { "role": "assistant", "content": "major , count ( * ) from student group by major" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students are there for each major?\nSELECT \n" }, { "role": "assistant", "content": "major , count ( * ) from student group by major" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Which major has most number of students?\nSELECT \n" }, { "role": "assistant", "content": "major from student group by major order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What is the largest major?\nSELECT \n" }, { "role": "assistant", "content": "major from student group by major order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all ages and corresponding number of students.\nSELECT \n" }, { "role": "assistant", "content": "age , count ( * ) from student group by age" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How old is each student and how many students are each age?\nSELECT \n" }, { "role": "assistant", "content": "age , count ( * ) from student group by age" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show the average age for male and female students.\nSELECT \n" }, { "role": "assistant", "content": "avg ( age ) , sex from student group by sex" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### What are the average ages for male and female students?\nSELECT \n" }, { "role": "assistant", "content": "avg ( age ) , sex from student group by sex" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all cities and corresponding number of students.\nSELECT \n" }, { "role": "assistant", "content": "city_code , count ( * ) from student group by city_code" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### How many students live in each city?\nSELECT \n" }, { "role": "assistant", "content": "city_code , count ( * ) from student group by city_code" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# allergy_type ( allergy , allergytype )\n# has_allergy ( stuid , allergy )\n# student ( stuid , lname , fname , age , sex , major , advisor , city_code )\n# has_allergy.allergy = allergy_type.allergy\n# has_allergy.stuid = student.stuid\n\n#\n### Show all advisors and corresponding number of students.\nSELECT \n" }, { "role": "assistant", "content": "advisor , count ( * ) from student group by advisor" } ]