Dataset Viewer
Auto-converted to Parquet Duplicate
messages
listlengths
3
3
system
stringclasses
1 value
user
stringlengths
326
8.38k
assistant
stringlengths
18
577
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT count(*) FROM head WHERE age > 56
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT name , born_state , age FROM head ORDER BY age
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT creation , name , budget_in_billions FROM department
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT max(budget_in_billions) , min(budget_in_billions) FROM department
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT avg(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT name FROM head WHERE born_state != 'California'
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT DISTINCT T1.creation FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T3.born_state = 'Alabama'
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT born_state FROM head GROUP BY born_state HAVING count(*) >= 3
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT creation FROM department GROUP BY creation ORDER BY count(*) DESC LIMIT 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT T1.name , T1.num_employees FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id WHERE T2.temporary_acting = 'Yes'
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT count(DISTINCT temporary_acting) FROM management
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT count(*) FROM department WHERE department_id NOT IN (SELECT department_id FROM management);
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT DISTINCT T1.age FROM management AS T2 JOIN head AS T1 ON T1.head_id = T2.head_id WHERE T2.temporary_acting = 'Yes'
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Treasury' INTERSECT SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.he...
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT T1.department_id , T1.name , count(*) FROM management AS T2 JOIN department AS T1 ON T1.department_id = T2.department_id GROUP BY T1.department_id HAVING count(*) > 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ) CREATE TABLE "head" ( "head_ID" int, "name" text, "born_state" text, "age" real, PRIMARY KEY ("head_ID") ) CREATE TABLE "ma...
SELECT head_id , name FROM head WHERE name LIKE '%Ha%'
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT count(*) FROM farm
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT count(*) FROM farm
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Hosts FROM farm_competition WHERE Theme != 'Aliens'
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Hosts FROM farm_competition WHERE Theme != 'Aliens'
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Theme FROM farm_competition ORDER BY YEAR ASC
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Theme FROM farm_competition ORDER BY YEAR ASC
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT avg(Working_Horses) FROM farm WHERE Total_Horses > 5000
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT avg(Working_Horses) FROM farm WHERE Total_Horses > 5000
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT max(Cows) , min(Cows) FROM farm
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT max(Cows) , min(Cows) FROM farm
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT count(DISTINCT Status) FROM city
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT count(DISTINCT Status) FROM city
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Official_Name FROM city ORDER BY Population DESC
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Official_Name FROM city ORDER BY Population DESC
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Official_Name , Status FROM city ORDER BY Population DESC LIMIT 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Official_Name , Status FROM city ORDER BY Population DESC LIMIT 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT T2.Year , T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT T2.Year , T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Status , avg(Population) FROM city GROUP BY Status
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Status , avg(Population) FROM city GROUP BY Status
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition)
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition)
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Official_Name FROM city WHERE Population > 1500 OR Population < 500
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Official_Name FROM city WHERE Population > 1500 OR Population < 500
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Census_Ranking FROM city WHERE Status != "Village"
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" ...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ) CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bulls" real...
SELECT Census_Ranking FROM city WHERE Status != "Village"
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE Addresses ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle...
SELECT T1.course_name FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_Id GROUP BY T1.course_id ORDER BY count(*) DESC LIMIT 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE Addresses ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle...
SELECT T1.course_name FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_Id GROUP BY T1.course_id ORDER BY count(*) DESC LIMIT 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE Addresses ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle...
SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) LIMIT 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE Addresses ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle...
SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) LIMIT 1
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE Addresses ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle...
SELECT T2.first_name , T2.last_name FROM candidates AS T1 JOIN people AS T2 ON T1.candidate_id = T2.person_id
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE Addresses ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle...
SELECT T2.first_name , T2.last_name FROM candidates AS T1 JOIN people AS T2 ON T1.candidate_id = T2.person_id
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE Addresses ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle...
SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance)
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE Addresses ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle...
SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance)
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE Addresses ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle...
SELECT student_id FROM student_course_attendance
[ { "role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation." }, { "role": "user", "content": "### Database Schema\nCREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_...
You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.
### Database Schema CREATE TABLE Addresses ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE People ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle...
SELECT student_id FROM student_course_attendance
End of preview. Expand in Data Studio

Dataset Card for spider-text2sql-bench

spider-text2sql-bench 是 Spider 1.0 官方訓練集之 OpenAI Messages 格式版本,共 7,000 筆,將原始之 question / schema / sql 重新組裝為 system / user / assistant 三 role 之對話結構。除原生之 messages 欄位外,另拆解出獨立之 system / user / assistant 字串欄位,可作為 Text-to-SQL 模型之 SFT 訓練語料,亦可直接用於 benchmark evaluation pipeline(以 user 作為 prompt,比對模型輸出與 assistant 之標準答案 SQL)。

Dataset Details

Dataset Description

Spider 1.0 為 Yale LILY Group 於 EMNLP 2018 發表之大規模跨領域 Text-to-SQL 標註資料集,涵蓋 200+ 複雜資料庫與 10K+ 問題/SQL pair,長期作為 Text-to-SQL 模型之代表性訓練與評測基準。本資料集為其 train split 之 OpenAI Messages 格式版本,不修改任何原始問題、SQL、或資料庫 schema,僅進行格式重組與欄位拆解:

  • messages:完整之 OpenAI Messages 結構(list of {role, content});
  • system:固定提示語 "You are an expert SQL assistant...";
  • user### Database Schema 區塊(由 Spider 官方 SQLite 資料庫萃取之 CREATE TABLE 語句)+ ### Question 區塊;
  • assistant:對應之標準答案 SQL。

提供拆解後之獨立欄位,方便 benchmark pipeline 直接以 user 為 prompt 餵入模型、以 assistant 為 ground truth 進行 execution accuracy 比對,而無需再次解析 messages 結構。此格式亦能與 HuggingFace 生態之 SFT trainer(TRL、Axolotl、LLaMA-Factory 等)無縫整合,並與 bird-text2sql-bench 搭配作為 Text-to-SQL 訓練與評測之主力語料。

  • Curated by: Liang Hsun Huang
  • Language(s) (NLP): English(SQL / schema / question)
  • License: CC BY-SA 4.0(繼承自 Spider 1.0)

Dataset Sources

Uses

Direct Use

本資料集主要設計用於:

  • Text-to-SQL 模型之 SFT 訓練(以 messages 欄位為訓練目標);
  • Text-to-SQL 模型之 benchmark 評測(以 system + user 組 prompt,對齊 assistant 為 ground truth);
  • 跨領域 schema generalization 能力之建立;
  • 作為 bird-text2sql-bench 搭配訓練/評測,涵蓋中小型資料庫(Spider)與大規模真實資料庫(BIRD);
  • 作為 Text-to-SQL 模型 warm-up 之基礎語料,再接續 RL 或更大規模之合成語料(如 OmniSQL 之 SynSQL-2.5M)。

Out-of-Scope Use

本資料集不適用於下列用途:

  • 作為 Spider 官方評測之測試集,本資料集僅包含 train split;
  • 作為真實商業資料庫之 schema linking 訓練唯一來源,Spider 為教學式資料庫,不完全反映生產環境;
  • 非 SQL 方言之訓練(Spider 使用 SQLite 語法);
  • 作為多輪 SQL 對話之訓練(本資料集為單輪 question→SQL)。

Dataset Structure

{
  "messages": [
    {"role": "system", "content": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation."},
    {"role": "user", "content": "### Database Schema\nCREATE TABLE department (...);\n\n### Question\nHow many heads are older than 56?"},
    {"role": "assistant", "content": "SELECT COUNT(*) FROM head WHERE age > 56"}
  ],
  "system": "You are an expert SQL assistant. Given a database schema and a question, generate the correct SQL query. Output only the SQL query, no explanation.",
  "user": "### Database Schema\nCREATE TABLE department (...);\n\n### Question\nHow many heads are older than 56?",
  "assistant": "SELECT COUNT(*) FROM head WHERE age > 56"
}
欄位 型別 說明
messages list[{role, content}] OpenAI Messages 結構,含 system / user / assistant 三 role
system string 拆解後之 system prompt(同 messages[0].content
user string 拆解後之 user prompt(同 messages[1].content
assistant string 拆解後之 assistant 標準答案 SQL(同 messages[2].content
統計項目 數值
筆數 7,000
來源 split Spider 1.0 train
資料庫數量 166
領域數量 138
SQL 複雜度 easy / medium / hard / extra hard
SQL 方言 SQLite
格式 Parquet

使用此原始資料集之知名模型

模型 機構 使用方式
OmniSQL Renmin University SFT 訓練資料之一
SQLCoder Defog Spider train 為基礎訓練資料
CodeS RUC (SIGMOD 2024) Spider + BIRD train SFT
DAIL-SQL Few-shot prompt 範例來源
Arctic-Text2SQL-R1 Snowflake 透過 OmniSQL checkpoint 間接使用

Dataset Creation

Curation Rationale

原始 Spider 1.0 之 JSON 格式需要額外處理方能餵入當代 SFT pipeline(特別是基於 OpenAI messages 格式之工具鏈)。本資料集直接完成此轉換,確保:

  1. Schema 以 CREATE TABLE 語句之形式提供(與 LLM 預訓練語料中常見之 SQL DDL 分布一致);
  2. System prompt 固定,便於控制實驗變項;
  3. messages 外同時提供拆解後之 system / user / assistant 欄位,讓 benchmark pipeline 可直接取用,無需再解析對話結構;
  4. 單檔 parquet 便於流式讀取與訓練 pipeline 整合。

Source Data

Data Collection and Processing

  1. 從 Spider 官方釋出之 train 資料(train_spider.json + train_others.json)讀取 question/SQL/db_id;
  2. 從 Spider 官方提供之 SQLite 資料庫中以 sqlite_master 萃取對應之 CREATE TABLE 語句作為 schema;
  3. 組裝為 OpenAI Messages 格式;
  4. 另外將每筆對話拆解為獨立之 system / user / assistant 字串欄位;
  5. 儲存為單檔 parquet。

本資料集不修改任何原始 SQL、問題或資料庫結構。

Who are the source data producers?

原始問題與 SQL 由 Yale LILY Group 招募之 CS 學生標註,標註流程詳見 Spider 原始論文。

Annotations

Annotation process

不適用(本資料集不包含額外人工標註)。

Who are the annotators?

不適用。

Personal and Sensitive Information

Spider 1.0 使用之資料庫均為教學用合成或公開資料,不含個人敏感資料。

Bias, Risks, and Limitations

  • 資料庫規模偏小:Spider 之 166 個資料庫多為教學式小型 schema,與真實商業環境(數百張表、極端欄位命名)差異大;
  • SQL 方言限定:僅為 SQLite,MySQL / PostgreSQL / T-SQL 特有語法不在涵蓋範圍;
  • 問題語言為英文:非英文 Text-to-SQL 任務需另外蒐集或翻譯;
  • 系統提示固定:可能導致模型對提示過度擬合,實務訓練時建議混合多種 prompt 變體;
  • 單輪:不涵蓋多輪 clarification 或對話式 Text-to-SQL。

Recommendations

建議使用者:

  • 將本資料集與 bird-text2sql-bench 共同訓練或評測,補足真實大型資料庫之覆蓋;
  • 實務部署前以目標 SQL 方言之範例進行額外微調;
  • 對 system prompt 加以變化以減少過擬合;
  • 遵循原始 Spider 1.0 之 CC BY-SA 4.0 授權規則。

Citation

@inproceedings{yu2018spider,
  title={Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task},
  author={Yu, Tao and Zhang, Rui and Yang, Kai and Yasunaga, Michihiro and Wang, Dongxu and Li, Zifan and Ma, James and Li, Irene and Yao, Qingning and Roman, Shanelle and others},
  booktitle={EMNLP},
  year={2018}
}

@misc{spider-text2sql-bench,
  title        = {spider-text2sql-bench: Spider 1.0 in OpenAI Messages + Split Columns Format for Text-to-SQL SFT and Benchmark},
  author       = {Liang Hsun Huang},
  year         = {2024},
  howpublished = {\url{https://huggingface.co/datasets/lianghsun/spider-text2sql-bench}},
  note         = {Reformatted from xlangai/spider train split (CC BY-SA 4.0) with additional system/user/assistant columns for benchmark pipelines.}
}

Dataset Card Authors

Liang Hsun Huang

Dataset Card Contact

Liang Hsun Huang

Downloads last month
4

Papers for lianghsun/spider-text2sql-bench