Dataset Viewer
Auto-converted to Parquet
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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### How many heads of the departments are older than 56 ?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from head where age > 56" } ]
[ { "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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### List the name, born state and age of the heads of departments ordered by age.\nSELECT \n" }, { "role": "assistant", "content": "name , born_state , age from head order by age 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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### List the creation year, name and budget of each department.\nSELECT \n" }, { "role": "assistant", "content": "creation , name , budget_in_billions from department" } ]
[ { "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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### What are the maximum and minimum budget of the departments?\nSELECT \n" }, { "role": "assistant", "content": "max ( budget_in_billions ) , min ( budget_in_billions ) from department" } ]
[ { "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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### What is the average number of employees of the departments whose rank is between 10 and 15?\nSELECT \n" }, { "role": "assistant", "content": "avg ( num_employees ) from department where ranking between 10 and 15" } ]
[ { "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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### What are the names of the heads who are born outside the California state?\nSELECT \n" }, { "role": "assistant", "content": "name from head where born_state != 'California'" } ]
[ { "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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'?\nSELECT \n" }, { "role": "assistant", "content": "distinct department.creation from department join management on department.department_id = management.department_id join head on management.head_id = head.head_id where head.born_state = 'Alabama'" } ]
[ { "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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### What are the names of the states where at least 3 heads were born?\nSELECT \n" }, { "role": "assistant", "content": "born_state from head group by born_state having count ( * ) >= 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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### In which year were most departments established?\nSELECT \n" }, { "role": "assistant", "content": "creation from department group by creation 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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'?\nSELECT \n" }, { "role": "assistant", "content": "department.name , department.num_employees from department join management on department.department_id = management.department_id where management.temporary_acting = 'Yes'" } ]
[ { "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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### How many acting statuses are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct temporary_acting ) from management" } ]
[ { "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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### How many departments are led by heads who are not mentioned?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from department where department_id not in ( select department_id from management )" } ]
[ { "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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### What are the distinct ages of the heads who are acting?\nSELECT \n" }, { "role": "assistant", "content": "distinct head.age from management join head on head.head_id = management.head_id where management.temporary_acting = 'Yes'" } ]
[ { "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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born.\nSELECT \n" }, { "role": "assistant", "content": "head.born_state from department join management on department.department_id = management.department_id join head on management.head_id = head.head_id where department.name = 'Treasury' intersect select head.born_state from department join management on department.department_id = management.department_id join head on management.head_id = head.head_id where department.name = 'Homeland Security'" } ]
[ { "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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### Which department has more than 1 head at a time? List the id, name and the number of heads.\nSELECT \n" }, { "role": "assistant", "content": "department.department_id , department.name , count ( * ) from management join department on department.department_id = management.department_id group by department.department_id having count ( * ) > 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# department ( department_id , name , creation , ranking , budget_in_billions , num_employees )\n# head ( head_id , name , born_state , age )\n# management ( department_id , head_id , temporary_acting )\n# management.head_id = head.head_id\n# management.department_id = department.department_id\n\n#\n### Which head's name has the substring 'Ha'? List the id and name.\nSELECT \n" }, { "role": "assistant", "content": "head_id , name from head where name like '%Ha%'" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### How many farms are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from farm" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Count the number of farms.\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from farm" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### List the total number of horses on farms in ascending order.\nSELECT \n" }, { "role": "assistant", "content": "total_horses from farm order by total_horses 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What is the total horses record for each farm, sorted ascending?\nSELECT \n" }, { "role": "assistant", "content": "total_horses from farm order by total_horses 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What are the hosts of competitions whose theme is not \"Aliens\"?\nSELECT \n" }, { "role": "assistant", "content": "hosts from farm_competition where theme != 'Aliens'" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Return the hosts of competitions for which the theme is not Aliens?\nSELECT \n" }, { "role": "assistant", "content": "hosts from farm_competition where theme != 'Aliens'" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What are the themes of farm competitions sorted by year in ascending order?\nSELECT \n" }, { "role": "assistant", "content": "theme from farm_competition order by year 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Return the themes of farm competitions, sorted by year ascending.\nSELECT \n" }, { "role": "assistant", "content": "theme from farm_competition order by year 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What is the average number of working horses of farms with more than 5000 total number of horses?\nSELECT \n" }, { "role": "assistant", "content": "avg ( working_horses ) from farm where total_horses > 5000" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Give the average number of working horses on farms with more than 5000 total horses.\nSELECT \n" }, { "role": "assistant", "content": "avg ( working_horses ) from farm where total_horses > 5000" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What are the maximum and minimum number of cows across all farms.\nSELECT \n" }, { "role": "assistant", "content": "max ( cows ) , min ( cows ) from farm" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Return the maximum and minimum number of cows across all farms.\nSELECT \n" }, { "role": "assistant", "content": "max ( cows ) , min ( cows ) from farm" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### How many different statuses do cities have?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct status ) from city" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Count the number of different statuses.\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct status ) from city" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### List official names of cities in descending order of population.\nSELECT \n" }, { "role": "assistant", "content": "official_name from city order by population desc" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What are the official names of cities, ordered descending by population?\nSELECT \n" }, { "role": "assistant", "content": "official_name from city order by population desc" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### List the official name and status of the city with the largest population.\nSELECT \n" }, { "role": "assistant", "content": "official_name , status from city order by population 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What is the official name and status of the city with the most residents?\nSELECT \n" }, { "role": "assistant", "content": "official_name , status from city order by population 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Show the years and the official names of the host cities of competitions.\nSELECT \n" }, { "role": "assistant", "content": "farm_competition.year , city.official_name from city join farm_competition on city.city_id = farm_competition.host_city_id" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Give the years and official names of the cities of each competition.\nSELECT \n" }, { "role": "assistant", "content": "farm_competition.year , city.official_name from city join farm_competition on city.city_id = farm_competition.host_city_id" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Show the official names of the cities that have hosted more than one competition.\nSELECT \n" }, { "role": "assistant", "content": "city.official_name from city join farm_competition on city.city_id = farm_competition.host_city_id group by farm_competition.host_city_id having count ( * ) > 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What are the official names of cities that have hosted more than one competition?\nSELECT \n" }, { "role": "assistant", "content": "city.official_name from city join farm_competition on city.city_id = farm_competition.host_city_id group by farm_competition.host_city_id having count ( * ) > 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Show the status of the city that has hosted the greatest number of competitions.\nSELECT \n" }, { "role": "assistant", "content": "city.status from city join farm_competition on city.city_id = farm_competition.host_city_id group by farm_competition.host_city_id 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What is the status of the city that has hosted the most competitions?\nSELECT \n" }, { "role": "assistant", "content": "city.status from city join farm_competition on city.city_id = farm_competition.host_city_id group by farm_competition.host_city_id 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Please show the themes of competitions with host cities having populations larger than 1000.\nSELECT \n" }, { "role": "assistant", "content": "farm_competition.theme from city join farm_competition on city.city_id = farm_competition.host_city_id where city.population > 1000" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What are the themes of competitions that have corresponding host cities with more than 1000 residents?\nSELECT \n" }, { "role": "assistant", "content": "farm_competition.theme from city join farm_competition on city.city_id = farm_competition.host_city_id where city.population > 1000" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Please show the different statuses of cities and the average population of cities with each status.\nSELECT \n" }, { "role": "assistant", "content": "status , avg ( population ) from city group by status" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What are the statuses and average populations of each city?\nSELECT \n" }, { "role": "assistant", "content": "status , avg ( population ) from city group by status" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Please show the different statuses, ordered by the number of cities that have each.\nSELECT \n" }, { "role": "assistant", "content": "status from city group by status order by count ( * ) 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Return the different statuses of cities, ascending by frequency.\nSELECT \n" }, { "role": "assistant", "content": "status from city group by status order by count ( * ) 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### List the most common type of Status across cities.\nSELECT \n" }, { "role": "assistant", "content": "status from city group by status 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What is the most common status across all cities?\nSELECT \n" }, { "role": "assistant", "content": "status from city group by status 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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### List the official names of cities that have not held any competition.\nSELECT \n" }, { "role": "assistant", "content": "official_name from city where city_id not in ( select host_city_id from farm_competition )" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What are the official names of cities that have not hosted a farm competition?\nSELECT \n" }, { "role": "assistant", "content": "official_name from city where city_id not in ( select host_city_id from farm_competition )" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Show the status shared by cities with population bigger than 1500 and smaller than 500.\nSELECT \n" }, { "role": "assistant", "content": "status from city where population > 1500 intersect select status from city where population < 500" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Which statuses correspond to both cities that have a population over 1500 and cities that have a population lower than 500?\nSELECT \n" }, { "role": "assistant", "content": "status from city where population > 1500 intersect select status from city where population < 500" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Find the official names of cities with population bigger than 1500 or smaller than 500.\nSELECT \n" }, { "role": "assistant", "content": "official_name from city where population > 1500 or population < 500" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What are the official names of cities that have population over 1500 or less than 500?\nSELECT \n" }, { "role": "assistant", "content": "official_name from city where population > 1500 or population < 500" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### Show the census ranking of cities whose status are not \"Village\".\nSELECT \n" }, { "role": "assistant", "content": "census_ranking from city where status != 'Village'" } ]
[ { "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# city ( city_id , official_name , status , area_km_2 , population , census_ranking )\n# farm ( farm_id , year , total_horses , working_horses , total_cattle , oxen , bulls , cows , pigs , sheep_and_goats )\n# farm_competition ( competition_id , year , theme , host_city_id , hosts )\n# competition_record ( competition_id , farm_id , rank )\n# farm_competition.host_city_id = city.city_id\n# competition_record.farm_id = farm.farm_id\n# competition_record.competition_id = farm_competition.competition_id\n\n#\n### What are the census rankings of cities that do not have the status \"Village\"?\nSELECT \n" }, { "role": "assistant", "content": "census_ranking from city where status != 'Village'" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### which course has most number of registered students?\nSELECT \n" }, { "role": "assistant", "content": "courses.course_name from courses join student_course_registrations on courses.course_id = student_course_registrations.course_id group by courses.course_id 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What is the name of the course with the most registered students?\nSELECT \n" }, { "role": "assistant", "content": "courses.course_name from courses join student_course_registrations on courses.course_id = student_course_registrations.course_id group by courses.course_id 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### what is id of students who registered some courses but the least number of courses in these students?\nSELECT \n" }, { "role": "assistant", "content": "student_id from student_course_registrations group by student_id 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the ids of the students who registered for some courses but had the least number of courses for all students?\nSELECT \n" }, { "role": "assistant", "content": "student_id from student_course_registrations group by student_id 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### what are the first name and last name of all candidates?\nSELECT \n" }, { "role": "assistant", "content": "people.first_name , people.last_name from candidates join people on candidates.candidate_id = people.person_id" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the first and last names of all the candidates?\nSELECT \n" }, { "role": "assistant", "content": "people.first_name , people.last_name from candidates join people on candidates.candidate_id = people.person_id" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### List the id of students who never attends courses?\nSELECT \n" }, { "role": "assistant", "content": "student_id from students where student_id not in ( select student_id from student_course_attendance )" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the ids of every student who has never attended a course?\nSELECT \n" }, { "role": "assistant", "content": "student_id from students where student_id not in ( select student_id from student_course_attendance )" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### List the id of students who attended some courses?\nSELECT \n" }, { "role": "assistant", "content": "student_id from student_course_attendance" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the ids of all students who have attended at least one course?\nSELECT \n" }, { "role": "assistant", "content": "student_id from student_course_attendance" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the ids of all students for courses and what are the names of those courses?\nSELECT \n" }, { "role": "assistant", "content": "student_course_registrations.student_id , courses.course_name from student_course_registrations join courses on student_course_registrations.course_id = courses.course_id" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What is detail of the student who most recently registered course?\nSELECT \n" }, { "role": "assistant", "content": "students.student_details from student_course_registrations join students on student_course_registrations.student_id = students.student_id order by student_course_registrations.registration_date 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What details do we have on the students who registered for courses most recently?\nSELECT \n" }, { "role": "assistant", "content": "students.student_details from student_course_registrations join students on student_course_registrations.student_id = students.student_id order by student_course_registrations.registration_date 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### How many students attend course English?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from courses join student_course_attendance on courses.course_id = student_course_attendance.course_id where courses.course_name = 'English'" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### How many students are attending English courses?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from courses join student_course_attendance on courses.course_id = student_course_attendance.course_id where courses.course_name = 'English'" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### How many courses do the student whose id is 171 attend?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from courses join student_course_attendance on courses.course_id = student_course_attendance.course_id where student_course_attendance.student_id = 171" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### How many courses does the student with id 171 actually attend?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from courses join student_course_attendance on courses.course_id = student_course_attendance.course_id where student_course_attendance.student_id = 171" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### Find id of the candidate whose email is [email protected]?\nSELECT \n" }, { "role": "assistant", "content": "candidates.candidate_id from people join candidates on people.person_id = candidates.candidate_id where people.email_address = '[email protected]'" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What is the id of the candidate whose email is [email protected]?\nSELECT \n" }, { "role": "assistant", "content": "candidates.candidate_id from people join candidates on people.person_id = candidates.candidate_id where people.email_address = '[email protected]'" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### Find id of the candidate who most recently accessed the course?\nSELECT \n" }, { "role": "assistant", "content": "candidate_id from candidate_assessments order by assessment_date 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What is the id of the candidate who most recently accessed the course?\nSELECT \n" }, { "role": "assistant", "content": "candidate_id from candidate_assessments order by assessment_date 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What is detail of the student who registered the most number of courses?\nSELECT \n" }, { "role": "assistant", "content": "students.student_details from students join student_course_registrations on students.student_id = student_course_registrations.student_id group by students.student_id 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the details of the student who registered for the most number of courses?\nSELECT \n" }, { "role": "assistant", "content": "students.student_details from students join student_course_registrations on students.student_id = student_course_registrations.student_id group by students.student_id 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### List the id of students who registered some courses and the number of their registered courses?\nSELECT \n" }, { "role": "assistant", "content": "students.student_id , count ( * ) from students join student_course_registrations on students.student_id = student_course_registrations.student_id group by students.student_id" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### For every student who is registered for some course, how many courses are they registered for?\nSELECT \n" }, { "role": "assistant", "content": "students.student_id , count ( * ) from students join student_course_registrations on students.student_id = student_course_registrations.student_id group by students.student_id" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### How many registed students do each course have? List course name and the number of their registered students?\nSELECT \n" }, { "role": "assistant", "content": "courses.course_name , count ( * ) from students join student_course_registrations on students.student_id = student_course_registrations.student_id join courses on student_course_registrations.course_id = courses.course_id group by student_course_registrations.course_id" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### For each course id, how many students are registered and what are the course names?\nSELECT \n" }, { "role": "assistant", "content": "courses.course_name , count ( * ) from students join student_course_registrations on students.student_id = student_course_registrations.student_id join courses on student_course_registrations.course_id = courses.course_id group by student_course_registrations.course_id" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### Find id of candidates whose assessment code is \"Pass\"?\nSELECT \n" }, { "role": "assistant", "content": "candidate_id from candidate_assessments where asessment_outcome_code = 'Pass'" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the ids of the candidates that have an outcome code of Pass?\nSELECT \n" }, { "role": "assistant", "content": "candidate_id from candidate_assessments where asessment_outcome_code = 'Pass'" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### Find the cell mobile number of the candidates whose assessment code is \"Fail\"?\nSELECT \n" }, { "role": "assistant", "content": "people.cell_mobile_number from candidates join candidate_assessments on candidates.candidate_id = candidate_assessments.candidate_id join people on candidates.candidate_id = people.person_id where candidate_assessments.asessment_outcome_code = 'Fail'" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the cell phone numbers of the candidates that received an assessment code of \"Fail\"?\nSELECT \n" }, { "role": "assistant", "content": "people.cell_mobile_number from candidates join candidate_assessments on candidates.candidate_id = candidate_assessments.candidate_id join people on candidates.candidate_id = people.person_id where candidate_assessments.asessment_outcome_code = 'Fail'" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the id of students who registered course 301?\nSELECT \n" }, { "role": "assistant", "content": "student_id from student_course_attendance where course_id = 301" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the ids of the students who registered for course 301?\nSELECT \n" }, { "role": "assistant", "content": "student_id from student_course_attendance where course_id = 301" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What is the id of the student who most recently registered course 301?\nSELECT \n" }, { "role": "assistant", "content": "student_id from student_course_attendance where course_id = 301 order by date_of_attendance 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the ids of the students who registered for course 301 most recently?\nSELECT \n" }, { "role": "assistant", "content": "student_id from student_course_attendance where course_id = 301 order by date_of_attendance 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### Find distinct cities of addresses of people?\nSELECT \n" }, { "role": "assistant", "content": "distinct addresses.city from addresses join people_addresses on addresses.address_id = people_addresses.address_id" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the different cities where people live?\nSELECT \n" }, { "role": "assistant", "content": "distinct addresses.city from addresses join people_addresses on addresses.address_id = people_addresses.address_id" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### Find distinct cities of address of students?\nSELECT \n" }, { "role": "assistant", "content": "distinct addresses.city from addresses join people_addresses on addresses.address_id = people_addresses.address_id join students on people_addresses.person_id = students.student_id" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the different cities where students live?\nSELECT \n" }, { "role": "assistant", "content": "distinct addresses.city from addresses join people_addresses on addresses.address_id = people_addresses.address_id join students on people_addresses.person_id = students.student_id" } ]
[ { "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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### List the names of courses in alphabetical order?\nSELECT \n" }, { "role": "assistant", "content": "course_name from courses order by course_name 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the names of the courses in alphabetical order?\nSELECT \n" }, { "role": "assistant", "content": "course_name from courses order by course_name 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### List the first names of people in alphabetical order?\nSELECT \n" }, { "role": "assistant", "content": "first_name from people order by first_name 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the first names of the people in alphabetical order?\nSELECT \n" }, { "role": "assistant", "content": "first_name from people order by first_name 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# addresses ( address_id , line_1 , line_2 , city , zip_postcode , state_province_county , country )\n# people ( person_id , first_name , middle_name , last_name , cell_mobile_number , email_address , login_name , password )\n# students ( student_id , student_details )\n# courses ( course_id , course_name , course_description , other_details )\n# people_addresses ( person_address_id , person_id , address_id , date_from , date_to )\n# student_course_registrations ( student_id , course_id , registration_date )\n# student_course_attendance ( student_id , course_id , date_of_attendance )\n# candidates ( candidate_id , candidate_details )\n# candidate_assessments ( candidate_id , qualification , assessment_date , asessment_outcome_code )\n# students.student_id = people.person_id\n# people_addresses.address_id = addresses.address_id\n# people_addresses.person_id = people.person_id\n# student_course_registrations.course_id = courses.course_id\n# student_course_registrations.student_id = students.student_id\n# student_course_attendance.student_id = student_course_registrations.student_id\n# student_course_attendance.course_id = student_course_registrations.course_id\n# candidates.candidate_id = people.person_id\n# candidate_assessments.candidate_id = candidates.candidate_id\n\n#\n### What are the id of students who registered courses or attended courses?\nSELECT \n" }, { "role": "assistant", "content": "student_id from student_course_registrations union select student_id from student_course_attendance" } ]
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
21