question
stringlengths
1
606
db_id
stringclasses
139 values
external_knowledge
stringclasses
1 value
sql
stringlengths
19
1.35k
data_source
stringclasses
1 value
prompt
listlengths
2
2
ability
stringclasses
1 value
reward_model
dict
extra_info
dict
For each ship fate, how many different launch years are associated with missions having that fate?
ship_mission
select fate as c1, count(distinct (launched_year)) from mission group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "ship_mission", "sql": "select fate as c1, count(distinct (launched_year)) from mission group by c1" }, "style": "rule" }
{ "index": 2903, "split": "train" }
Show the political party, name, and age of the person who supported the affirmative side in debate number 3, listing only the top party when ordered in descending alphabetical order.
debate
select t0.party as c3, t0.name, t0.age, t1.affirmative, t1.debate_id from people as t0 join debate_people as t1 on t0.people_id = t1.affirmative join debate as t2 on t1.debate_id = t2.debate_id where t2.debate_id = 3 order by c3 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "debate", "sql": "select t0.party as c3, t0.name, t0.age, t1.affirmative, t1.debate_id from people as t0 join debate_people as t1 on t0.people_id = t1.affirmative join debate as t2 on t1.debate_id = t2.debate_id where t2.debate_id = 3 order by c3 desc limit 1" }, "style": "rul...
{ "index": 2752, "split": "train" }
What are the cell phone numbers and email addresses of the first five people with candidate ID 151, sorted alphabetically by their email address?
student_assessment
select t0.cell_mobile_number, t0.email_address as c0 from people as t0 join candidates as t1 on t0.person_id = t1.candidate_id where t1.candidate_id = 151 order by c0 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select t0.cell_mobile_number, t0.email_address as c0 from people as t0 join candidates as t1 on t0.person_id = t1.candidate_id where t1.candidate_id = 151 order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 838, "split": "train" }
What are the weights and people IDs of individuals who are linked to candidates with IDs up to 4, but excluding those candidates whose oppose rate exceeds 45%?
candidate_poll
select anon_1.c1, anon_1.c0 from (select t0.weight as c1, t0.people_id as c0 from people as t0 join candidate as t1 on t0.people_id = t1.people_id where t1.people_id <= 4 except select t0.weight as c1, t0.people_id as c0 from people as t0 join candidate as t1 on t0.people_id = t1.people_id where t1.oppose_rate > 0.45) ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "candidate_poll", "sql": "select anon_1.c1, anon_1.c0 from (select t0.weight as c1, t0.people_id as c0 from people as t0 join candidate as t1 on t0.people_id = t1.people_id where t1.people_id <= 4 except select t0.weight as c1, t0.people_id as c0 from people as t0 join candidate a...
{ "index": 2895, "split": "train" }
Is the validity start date of the card with ID 6 after the validity start date of the card with ID 10?
customers_card_transactions
select t1.c2 > t0.c2 from (select date_valid_from as c2 from customers_cards where card_id = 6) as t1, (select date_valid_from as c2 from customers_cards where card_id = 10) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select t1.c2 > t0.c2 from (select date_valid_from as c2 from customers_cards where card_id = 6) as t1, (select date_valid_from as c2 from customers_cards where card_id = 10) as t0" }, "style": "rule" }
{ "index": 3079, "split": "train" }
Show the names and member IDs of members who have participated in rounds with a rank of at least 1, excluding those members who participated in any round where their member ID is 10.
decoration_competition
select anon_1.c0, anon_1.c1 from (select t0.name as c0, t0.member_id as c1 from member as t0 join round as t1 on t0.member_id = t1.member_id where t1.rank_in_round >= 1 except select t0.name as c0, t0.member_id as c1 from member as t0 join round as t1 on t0.member_id = t1.member_id where t1.member_id = 10) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "decoration_competition", "sql": "select anon_1.c0, anon_1.c1 from (select t0.name as c0, t0.member_id as c1 from member as t0 join round as t1 on t0.member_id = t1.member_id where t1.rank_in_round >= 1 except select t0.name as c0, t0.member_id as c1 from member as t0 join round a...
{ "index": 1037, "split": "train" }
Find the names of customers whose names start with "Gran" and the number of their checking account balances, for the first five customers when ordered by customer ID in ascending order.
small_bank_1
select count(t0.balance), t1.name as c1 from checking as t0 join accounts as t1 on t0.custid = t1.custid where c1 like 'Gran%' group by t1.custid order by t1.custid asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select count(t0.balance), t1.name as c1 from checking as t0 join accounts as t1 on t0.custid = t1.custid where c1 like 'Gran%' group by t1.custid order by t1.custid asc nulls last limit 5" }, "style": "rule" }
{ "index": 2414, "split": "train" }
Can you tell me the length, description, and title of all films that belong to categories whose names start with "Dra", along with their category and film IDs?
sakila_1
select t0.length, t0.description, t0.title, t1.category_id, t1.film_id from film as t0 join film_category as t1 on t0.film_id = t1.film_id join category as t2 on t1.category_id = t2.category_id where t2.name like 'Dra%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "sakila_1", "sql": "select t0.length, t0.description, t0.title, t1.category_id, t1.film_id from film as t0 join film_category as t1 on t0.film_id = t1.film_id join category as t2 on t1.category_id = t2.category_id where t2.name like 'Dra%'" }, "style": "rule" }
{ "index": 2583, "split": "train" }
Can you provide the station IDs and their latitude for the ten stations located south of latitude 37.77865 that have fewer than 23 docks, ordered from the southernmost upward?
bike_1
select t0.station_id, t1.lat as c1 from status as t0 join station as t1 on t0.station_id = t1.id where c1 < 37.77865 and t1.dock_count < 23 order by c1 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select t0.station_id, t1.lat as c1 from status as t0 join station as t1 on t0.station_id = t1.id where c1 < 37.77865 and t1.dock_count < 23 order by c1 asc nulls last limit 10" }, "style": "rule" }
{ "index": 2344, "split": "train" }
Which channel names and owners are listed in the database but do not have any programs associated with them?
program_share
select anon_1.c0, anon_1.c2 from (select name as c0, owner as c2 from channel except select name, owner from program) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "program_share", "sql": "select anon_1.c0, anon_1.c2 from (select name as c0, owner as c2 from channel except select name, owner from program) as anon_1" }, "style": "rule" }
{ "index": 900, "split": "train" }
What are the file size, duration, artist name associated with each file, and the song artist name for songs belonging to genres whose ratings include the digit "9"?
music_1
select t0.file_size, t0.duration, t0.artist_name, t1.artist_name from files as t0 join song as t1 on t0.f_id = t1.f_id join genre as t2 on t1.genre_is = t2.g_name where t2.rating like '%9%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t0.file_size, t0.duration, t0.artist_name, t1.artist_name from files as t0 join song as t1 on t0.f_id = t1.f_id join genre as t2 on t1.genre_is = t2.g_name where t2.rating like '%9%'" }, "style": "rule" }
{ "index": 196, "split": "train" }
How many customer address history records belong to customers other than the one with ID 6?
customers_and_products_contacts
select count(*) from customer_address_history where customer_id != 6
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select count(*) from customer_address_history where customer_id != 6" }, "style": "rule" }
{ "index": 2032, "split": "train" }
How many web client accelerators have ID 13?
browser_web
select count(*) from web_client_accelerator where id = 13
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "browser_web", "sql": "select count(*) from web_client_accelerator where id = 13" }, "style": "rule" }
{ "index": 1004, "split": "train" }
How many Cmi Cross Reference IDs are associated with benefits overpayments for council tax ID 8 compared to those for council tax ID 3? Can you also tell me the difference in their IDs?
local_govt_mdm
select t1.c2 - t0.c2 from (select cmi_cross_ref_id as c2 from benefits_overpayments where council_tax_id = 8) as t1, (select cmi_cross_ref_id as c2 from benefits_overpayments where council_tax_id = 3) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_mdm", "sql": "select t1.c2 - t0.c2 from (select cmi_cross_ref_id as c2 from benefits_overpayments where council_tax_id = 8) as t1, (select cmi_cross_ref_id as c2 from benefits_overpayments where council_tax_id = 3) as t0" }, "style": "rule" }
{ "index": 3612, "split": "train" }
What are the calendar date, day number, and the date when documents arrived at their location for documents stored in the most frequently used location description that ends with "x"?
cre_Doc_Tracking_DB
select t0.calendar_date, t0.day_number, t1.date_in_location_from as c2 from ref_calendar as t0 join document_locations as t1 on t0.calendar_date = t1.date_in_locaton_to join ref_locations as t2 on t1.location_code = t2.location_code, (select location_description as c0 from ref_locations where location_code like '%x' gr...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Tracking_DB", "sql": "select t0.calendar_date, t0.day_number, t1.date_in_location_from as c2 from ref_calendar as t0 join document_locations as t1 on t0.calendar_date = t1.date_in_locaton_to join ref_locations as t2 on t1.location_code = t2.location_code, (select location...
{ "index": 2722, "split": "train" }
What is the highest aircraft ID associated with each Airport Aircraft Airport ID?
aircraft
select airport_id as c1, max(id) from airport_aircraft group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "aircraft", "sql": "select airport_id as c1, max(id) from airport_aircraft group by c1" }, "style": "rule" }
{ "index": 1687, "split": "train" }
Which departments have both a course with ID 411 and courses with four or fewer credits, and what are their budgets and department names?
college_2
select anon_1.c1, anon_1.c0 from (select t0.budget as c1, t0.dept_name as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.course_id = 411 intersect select t0.budget as c1, t0.dept_name as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.credits <= 4) ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_2", "sql": "select anon_1.c1, anon_1.c0 from (select t0.budget as c1, t0.dept_name as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.course_id = 411 intersect select t0.budget as c1, t0.dept_name as c0 from department as t0 join course ...
{ "index": 764, "split": "train" }
Can you list the MIDs, directors, and titles of movies that have ratings with IDs from 104 to 107, but not including ratings with IDs 106 and higher?
movie_1
select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.mid as c2, t0.director as c1, t0.title as c0 from movie as t0 join rating as t1 on t0.mid = t1.mid where t1.mid between 104 and 107 except select t0.mid as c2, t0.director as c1, t0.title as c0 from movie as t0 join rating as t1 on t0.mid = t1.mid where t1.mid >= 1...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "movie_1", "sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.mid as c2, t0.director as c1, t0.title as c0 from movie as t0 join rating as t1 on t0.mid = t1.mid where t1.mid between 104 and 107 except select t0.mid as c2, t0.director as c1, t0.title as c0 from movie as...
{ "index": 1214, "split": "train" }
How much more in total bathrooms does building 744 have compared to building 790?
apartment_rentals
select t1.c0 - t0.c0 from (select sum(t1.bathroom_count) as c0 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t0.building_id = 790 group by t0.building_id) as t1, (select t0.building_id, sum(t1.bathroom_count) as c0 from apartment_buildings as t0 join apartments as t1 on t...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select t1.c0 - t0.c0 from (select sum(t1.bathroom_count) as c0 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t0.building_id = 790 group by t0.building_id) as t1, (select t0.building_id, sum(t1.bathroom_co...
{ "index": 3581, "split": "train" }
Which stadium with the largest capacity has the earliest opening year, and what is its capacity, opening year, and the smallest record ID associated with its events?
swimming
select t0.capacity as c1, t0.opening_year, min(t2.id) from stadium as t0 join event as t1 on t0.id = t1.stadium_id join record as t2 on t1.id = t2.event_id group by t0.id order by c1 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "swimming", "sql": "select t0.capacity as c1, t0.opening_year, min(t2.id) from stadium as t0 join event as t1 on t0.id = t1.stadium_id join record as t2 on t1.id = t2.event_id group by t0.id order by c1 desc limit 1" }, "style": "rule" }
{ "index": 2939, "split": "train" }
Which station served by train 3 has the highest number of passengers, and what are its station ID and main services, when sorted by main services in reverse alphabetical order?
train_station
select t0.total_passengers, t0.station_id, t0.main_services as c2 from station as t0 join train_station as t1 on t0.station_id = t1.station_id join train as t2 on t1.train_id = t2.train_id where t2.train_id = 3 order by c2 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "train_station", "sql": "select t0.total_passengers, t0.station_id, t0.main_services as c2 from station as t0 join train_station as t1 on t0.station_id = t1.station_id join train as t2 on t1.train_id = t2.train_id where t2.train_id = 3 order by c2 desc limit 1" }, "style": "ru...
{ "index": 2947, "split": "train" }
Which movies have not been reviewed by Brittany Harris?
movie_1
select anon_1.c2, anon_1.c1, anon_1.c0 from (select mid as c2, year as c1, title as c0 from movie except select t0.mid as c2, t0.year as c1, t0.title as c0 from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid where t2.name = 'Brittany Harris') as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "movie_1", "sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select mid as c2, year as c1, title as c0 from movie except select t0.mid as c2, t0.year as c1, t0.title as c0 from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid where t2.name...
{ "index": 1039, "split": "train" }
Can you list up to three project outcome descriptions that have an outcome code containing "pe"? Please sort the results alphabetically, placing any unspecified descriptions at the end.
tracking_grants_for_research
select t0.outcome_description as c0 from research_outcomes as t0 join project_outcomes as t1 on t0.outcome_code = t1.outcome_code where t1.outcome_code like '%pe%' order by c0 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t0.outcome_description as c0 from research_outcomes as t0 join project_outcomes as t1 on t0.outcome_code = t1.outcome_code where t1.outcome_code like '%pe%' order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 1604, "split": "train" }
Which course enrollment details—specifically, Course ID, enrollment date, student ID, registration ID, and completion date—for students whose family name either begins with "Hodkiew" or is the most common family name in the database?
e_learning
select anon_1.c5, anon_1.c0, anon_1.c4, anon_1.c3, anon_1.c1 from (select t0.course_id as c5, t0.date_of_enrolment as c0, t0.student_id as c4, t0.registration_id as c3, t0.date_of_completion as c1 from student_course_enrolment as t0 join students as t1 on t0.student_id = t1.student_id where t1.family_name like 'Hodkiew...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select anon_1.c5, anon_1.c0, anon_1.c4, anon_1.c3, anon_1.c1 from (select t0.course_id as c5, t0.date_of_enrolment as c0, t0.student_id as c4, t0.registration_id as c3, t0.date_of_completion as c1 from student_course_enrolment as t0 join students as t1 on t0....
{ "index": 1636, "split": "train" }
What are the different facility codes listed in the apartment facilities?
apartment_rentals
select distinct facility_code from apartment_facilities
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select distinct facility_code from apartment_facilities" }, "style": "rule" }
{ "index": 2542, "split": "train" }
Can you tell me the lengths in meters, locations, names, and architect IDs of all bridges designed by American architects whose nationality ends with "rman, American"?
architecture
select anon_1.c2, anon_1.c1, anon_1.c3, anon_1.c0 from (select length_meters as c2, location as c1, name as c3, architect_id as c0 from bridge union select t0.length_meters as c2, t0.location as c1, t0.name as c3, t0.architect_id as c0 from bridge as t0 join architect as t1 on t0.architect_id = t1.id where t1.nationali...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "architecture", "sql": "select anon_1.c2, anon_1.c1, anon_1.c3, anon_1.c0 from (select length_meters as c2, location as c1, name as c3, architect_id as c0 from bridge union select t0.length_meters as c2, t0.location as c1, t0.name as c3, t0.architect_id as c0 from bridge as t0 joi...
{ "index": 469, "split": "train" }
Which engineer, identified by their company ID and last name, is the first to have visited an asset with ID between 5 and 15 after March 21, 2018, at 3:02 PM, when sorted alphabetically by last name?
assets_maintenance
select t0.company_id, t0.last_name as c0 from maintenance_engineers as t0 join engineer_visits as t1 on t0.engineer_id = t1.engineer_id join fault_log as t2 on t1.fault_log_entry_id = t2.fault_log_entry_id where t2.fault_log_entry_datetime >= '2018-03-21 15:02:17' and t2.asset_id between 5 and 15 order by c0 asc nulls ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t0.company_id, t0.last_name as c0 from maintenance_engineers as t0 join engineer_visits as t1 on t0.engineer_id = t1.engineer_id join fault_log as t2 on t1.fault_log_entry_id = t2.fault_log_entry_id where t2.fault_log_entry_datetime >= '2018-03...
{ "index": 1664, "split": "train" }
Among customer policies where the policy type is either "Life" or starts with "Car," which is the last policy type alphabetically, and what are their policy IDs?
insurance_policies
select policy_type_code as c0, policy_id from customer_policies where c0 = 'Life' or c0 like 'Car%' order by c0 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_policies", "sql": "select policy_type_code as c0, policy_id from customer_policies where c0 = 'Life' or c0 like 'Car%' order by c0 desc limit 1" }, "style": "rule" }
{ "index": 615, "split": "train" }
List the names and API IDs of all players whose player API ID is less than 158545.
soccer_1
select t0.player_name, t0.player_api_id from player as t0 join player_attributes as t1 on t0.player_api_id = t1.player_api_id where t1.player_api_id < 158545
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select t0.player_name, t0.player_api_id from player as t0 join player_attributes as t1 on t0.player_api_id = t1.player_api_id where t1.player_api_id < 158545" }, "style": "rule" }
{ "index": 762, "split": "train" }
In which year was the race time at its latest, corresponding to the most recent season in the database?
formula_1
select t0.time, t0.year as c0 from races as t0, (select max(year) as c3 from races) as t1 where c0 = t1.c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "formula_1", "sql": "select t0.time, t0.year as c0 from races as t0, (select max(year) as c3 from races) as t1 where c0 = t1.c3" }, "style": "rule" }
{ "index": 3775, "split": "train" }
Which Document Codes are associated with either functional areas or sections of the documents?
document_management
select anon_1.c1 from (select document_code as c1 from document_functional_areas union select document_code from document_sections) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "document_management", "sql": "select anon_1.c1 from (select document_code as c1 from document_functional_areas union select document_code from document_sections) as anon_1" }, "style": "rule" }
{ "index": 2323, "split": "train" }
What are the names of the three activities with activity IDs of 785 or higher, sorted in reverse alphabetical order?
activity_1
select t0.activity_name as c0 from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.actid >= 785 order by c0 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "activity_1", "sql": "select t0.activity_name as c0 from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.actid >= 785 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 1362, "split": "train" }
Which customers located at address number 7 do not use the most common contact number, and what are their names, IDs, and preferred payment methods?
customers_and_addresses
select anon_1.c1, anon_1.c2, anon_1.c3 from (select t0.customer_name as c1, t0.customer_id as c2, t0.payment_method as c3 from customers as t0 join customer_addresses as t1 on t0.customer_id = t1.customer_id where t1.address_id = 7 except select t0.customer_name as c1, t0.customer_id as c2, t0.payment_method as c3 from...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select anon_1.c1, anon_1.c2, anon_1.c3 from (select t0.customer_name as c1, t0.customer_id as c2, t0.payment_method as c3 from customers as t0 join customer_addresses as t1 on t0.customer_id = t1.customer_id where t1.address_id = 7 except select ...
{ "index": 1495, "split": "train" }
For customers who have fewer than five checking accounts, what are their names and customer IDs, especially for the customer with custid 6?
small_bank_1
select t0.name, t0.custid as c0 from accounts as t0 join checking as t1 on t0.custid = t1.custid where t1.custid = 6 group by c0 having count(*) < 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select t0.name, t0.custid as c0 from accounts as t0 join checking as t1 on t0.custid = t1.custid where t1.custid = 6 group by c0 having count(*) < 5" }, "style": "rule" }
{ "index": 2161, "split": "train" }
Which zip codes and countries are associated with the three customers born either exactly on September 18, 1998, or on or before December 5, 1991, when ordered by country from Z to A?
driving_school
select t0.zip_postcode, t0.country as c0 from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id where t1.date_of_birth = '1998-09-18 04:45:01' or t1.date_of_birth <= '1991-12-05 02:50:15' order by c0 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select t0.zip_postcode, t0.country as c0 from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id where t1.date_of_birth = '1998-09-18 04:45:01' or t1.date_of_birth <= '1991-12-05 02:50:15' order by c0 desc limit 3" }, "styl...
{ "index": 219, "split": "train" }
Which courses have prerequisites ending with "57," and what are their titles, department names, and course IDs, along with the course IDs of the courses that depend on these prerequisites?
college_2
select t0.title, t0.dept_name, t0.course_id, t1.course_id from course as t0 join prereq as t1 on t0.course_id = t1.prereq_id where t1.prereq_id like '%57'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_2", "sql": "select t0.title, t0.dept_name, t0.course_id, t1.course_id from course as t0 join prereq as t1 on t0.course_id = t1.prereq_id where t1.prereq_id like '%57'" }, "style": "rule" }
{ "index": 1846, "split": "train" }
Is the percentage change in the highest student ID involved in NOISE incidents (on March 13, 2018, at 05:18:05, for students with IDs 11 or less) greater than the overall percentage variation across all incident types on that same date?
behavior_monitoring
select abs((t2.c2 / cast(t2.c2 as real) - 1) * 100) > t1.c3 from (select max(t1.student_id) as c2 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t0.incident_type_code = 'NOISE' and t1.date_incident_end = '2018-03-13 05:18:05' and t1.student_id <= 11 grou...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select abs((t2.c2 / cast(t2.c2 as real) - 1) * 100) > t1.c3 from (select max(t1.student_id) as c2 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t0.incident_type_code = 'NOISE' and t1....
{ "index": 3434, "split": "train" }
Which top 10 technicians, including their names, starting years, and IDs, are assigned to machines with value points less than or equal to 171 or greater than 62, sorted alphabetically by their names?
machine_repair
select t0.name as c1, t0.starting_year, t0.technician_id from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id join machine as t2 on t1.machine_id = t2.machine_id where t2.value_points <= 171.0 or t2.value_points > 62.0 order by c1 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "machine_repair", "sql": "select t0.name as c1, t0.starting_year, t0.technician_id from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id join machine as t2 on t1.machine_id = t2.machine_id where t2.value_points <= 171.0 or t2.value_points > 62.0...
{ "index": 1257, "split": "train" }
How many days are there between the hire date and birth date for employees whose last name includes "ing"?
store_1
select julianday(t1.c0) - julianday(t0.c2) from (select hire_date as c0 from employees) as t1, (select birth_date as c2 from employees where last_name like '%ing' and last_name like '%ing') as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select julianday(t1.c0) - julianday(t0.c2) from (select hire_date as c0 from employees) as t1, (select birth_date as c2 from employees where last_name like '%ing' and last_name like '%ing') as t0" }, "style": "rule" }
{ "index": 3937, "split": "train" }
How many days passed between the Asset's acquisition date and its disposal date for assets acquired on October 24, 2017?
assets_maintenance
select julianday(t1.c3) - julianday(t0.c2) from (select asset_acquired_date as c3 from assets) as t1, (select asset_disposed_date as c2 from assets where asset_acquired_date = '2017-10-24 04:29:17' and asset_acquired_date = '2017-10-24 04:29:17') as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select julianday(t1.c3) - julianday(t0.c2) from (select asset_acquired_date as c3 from assets) as t1, (select asset_disposed_date as c2 from assets where asset_acquired_date = '2017-10-24 04:29:17' and asset_acquired_date = '2017-10-24 04:29:17') as t...
{ "index": 3907, "split": "train" }
Is the highest apartment ID associated with apartment 2 less than 11?
apartment_rentals
select t0.c1 < 11 from (select max(t1.apt_id) as c1 from apartments as t0 join view_unit_status as t1 on t0.apt_id = t1.apt_id where t0.apt_id = 2 group by t0.apt_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select t0.c1 < 11 from (select max(t1.apt_id) as c1 from apartments as t0 join view_unit_status as t1 on t0.apt_id = t1.apt_id where t0.apt_id = 2 group by t0.apt_id) as t0" }, "style": "rule" }
{ "index": 3327, "split": "train" }
Which storms were active in the most frequently affected region and also in the region with ID 3? Specifically, what are their active dates and storm IDs?
storm_record
select anon_1.c0, anon_1.c1 from (select t0.dates_active as c0, t0.storm_id as c1 from storm as t0 join affected_region as t1 on t0.storm_id = t1.storm_id join region as t2 on t1.region_id = t2.region_id, (select region_code as c2 from region group by c2 order by count(*) desc limit 1) as t1 where t2.region_code = t1.c...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "storm_record", "sql": "select anon_1.c0, anon_1.c1 from (select t0.dates_active as c0, t0.storm_id as c1 from storm as t0 join affected_region as t1 on t0.storm_id = t1.storm_id join region as t2 on t1.region_id = t2.region_id, (select region_code as c2 from region group by c2 or...
{ "index": 1916, "split": "train" }
What are the most recent five mills' built years and their types, where the mills were built by architects who designed bridges either at Dinosaur National Monument in Colorado or at the most common bridge location, sorted by mill type in reverse alphabetical order?
architecture
select t0.built_year, t0.type as c2 from mill as t0 join architect as t1 on t0.architect_id = t1.id join bridge as t2 on t1.id = t2.architect_id, (select location as c1 from bridge group by c1 order by count(*) asc nulls last limit 1) as t0 where t2.location = 'Dinosaur National Monument , Colorado , USA' or t2.locatio...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "architecture", "sql": "select t0.built_year, t0.type as c2 from mill as t0 join architect as t1 on t0.architect_id = t1.id join bridge as t2 on t1.id = t2.architect_id, (select location as c1 from bridge group by c1 order by count(*) asc nulls last limit 1) as t0 where t2.locatio...
{ "index": 1305, "split": "train" }
Can you tell me the lowest value of the highest product ID from all orders placed on or before February 10, 2018, at 3:44:48 PM?
department_store
select max(t0.product_id) as c0 from order_items as t0 join customer_orders as t1 on t0.order_id = t1.order_id where t1.order_date = '2018-02-10 15:44:48' or t1.order_date < '2018-02-10 15:44:48' order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select max(t0.product_id) as c0 from order_items as t0 join customer_orders as t1 on t0.order_id = t1.order_id where t1.order_date = '2018-02-10 15:44:48' or t1.order_date < '2018-02-10 15:44:48' order by c0 asc nulls last limit 1" }, "style": "rule...
{ "index": 805, "split": "train" }
Who is the guest with the lowest guest ID among those who have booked apartments that have either eight rooms or a number of rooms that includes a five?
apartment_rentals
select t0.guest_id as c0 from apartment_bookings as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.room_count like '%8' or t1.room_count like '%5%' order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select t0.guest_id as c0 from apartment_bookings as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.room_count like '%8' or t1.room_count like '%5%' order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 1245, "split": "train" }
Which medicines have a trade name listed and are involved in interactions that are classified as inhibitors or have interaction descriptions that include the word "hibitor"?
medicine_enzyme_interaction
select t0.trade_name from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.interaction_type = 'inhibitor' or t1.interaction_type like '%hibitor%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select t0.trade_name from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.interaction_type = 'inhibitor' or t1.interaction_type like '%hibitor%'" }, "style": "rule" }
{ "index": 1778, "split": "train" }
What are the mobile phone numbers and student IDs of students who have fewer than five addresses in total, and among those addresses, have an address with ID 19?
behavior_monitoring
select t0.cell_mobile_number, t0.student_id as c1 from students as t0 join student_addresses as t1 on t0.student_id = t1.student_id where t1.address_id = 19 group by c1 having count(*) < 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select t0.cell_mobile_number, t0.student_id as c1 from students as t0 join student_addresses as t1 on t0.student_id = t1.student_id where t1.address_id = 19 group by c1 having count(*) < 5" }, "style": "rule" }
{ "index": 400, "split": "train" }
Which are the three students with the lowest student IDs, along with the average of their student IDs, who have had behavior incidents starting on or after August 27, 2017, sorted by their address IDs?
behavior_monitoring
select t0.student_id as c1, avg(t1.student_id) from students as t0 join behavior_incident as t1 on t0.student_id = t1.student_id where t1.date_incident_start >= '2017-08-27 03:21:30' group by c1 order by t0.address_id asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select t0.student_id as c1, avg(t1.student_id) from students as t0 join behavior_incident as t1 on t0.student_id = t1.student_id where t1.date_incident_start >= '2017-08-27 03:21:30' group by c1 order by t0.address_id asc nulls last limit 3" }, "...
{ "index": 2463, "split": "train" }
What is the difference in bike IDs between trip 911381 and trip 905799?
bike_1
select t1.c2 - t0.c2 from (select bike_id as c2 from trip where id = 905799) as t1, (select bike_id as c2 from trip where id = 911381) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select t1.c2 - t0.c2 from (select bike_id as c2 from trip where id = 905799) as t1, (select bike_id as c2 from trip where id = 911381) as t0" }, "style": "rule" }
{ "index": 3586, "split": "train" }
What are the top 10 persons, including their gender, city, and name, along with the most recent year they were friends with someone whose name ends with or contains "h," sorted alphabetically by gender?
network_2
select t0.gender as c3, t0.city, t0.name as c0, max(t1.year) from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like '%h' or t1.name like '%h%' group by c0 order by c3 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select t0.gender as c3, t0.city, t0.name as c0, max(t1.year) from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like '%h' or t1.name like '%h%' group by c0 order by c3 asc nulls last limit 10" }, "style": "rule" }
{ "index": 319, "split": "train" }
Show the details of the top 3 markets—specifically their IDs, number of shops, and rankings—and the associated phone IDs and market IDs for iPhones with phone ID 4 and names starting with "IPhone," sorted by the most recent (highest) market ID.
phone_market
select t0.market_id as c4, t0.num_of_shops, t0.ranking, t1.phone_id, t1.market_id from market as t0 join phone_market as t1 on t0.market_id = t1.market_id join phone as t2 on t1.phone_id = t2.phone_id where t2.phone_id = 4 and t2.name like 'IPhone%' order by c4 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "phone_market", "sql": "select t0.market_id as c4, t0.num_of_shops, t0.ranking, t1.phone_id, t1.market_id from market as t0 join phone_market as t1 on t0.market_id = t1.market_id join phone as t2 on t1.phone_id = t2.phone_id where t2.phone_id = 4 and t2.name like 'IPhone%' order b...
{ "index": 985, "split": "train" }
Which products have unique stock numbers and belong to catalog levels whose names start with "Catego"?
product_catalog
select distinct t0.product_stock_number, t0.catalog_level_number from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_level_name like 'Catego%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select distinct t0.product_stock_number, t0.catalog_level_number from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_level_name like 'Catego%'" }, "style": "rule" }
{ "index": 2944, "split": "train" }
Can you tell me the personal names and student IDs of students whose course completion date was either exactly on March 2nd, 2018 at 2:38:49 PM or later than March 22nd, 2018 at 6:04:54 PM?
e_learning
select t0.personal_name, t1.student_id from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_completion between '2018-03-02 14:38:49' and '2018-03-02 14:38:49' or t1.date_of_completion > '2018-03-22 18:04:54'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.personal_name, t1.student_id from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_completion between '2018-03-02 14:38:49' and '2018-03-02 14:38:49' or t1.date_of_completion > '2018-03-22 18:04:54...
{ "index": 628, "split": "train" }
How does the total sum of coupon IDs for male customers with coupon 12 compare to that for those with coupon 1?
products_for_hire
select t1.c0 - t0.c0 from (select sum(t1.coupon_id) as c0 from discount_coupons as t0 join customers as t1 on t0.coupon_id = t1.coupon_id where t0.coupon_id = 12 and t1.gender_mf = 1 group by t0.coupon_id) as t1, (select t0.coupon_id, sum(t1.coupon_id) as c0 from discount_coupons as t0 join customers as t1 on t0.coupon...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select t1.c0 - t0.c0 from (select sum(t1.coupon_id) as c0 from discount_coupons as t0 join customers as t1 on t0.coupon_id = t1.coupon_id where t0.coupon_id = 12 and t1.gender_mf = 1 group by t0.coupon_id) as t1, (select t0.coupon_id, sum(t1.coupon_id)...
{ "index": 3618, "split": "train" }
What are the different combinations of gender, age, and names among the people in the database?
wedding
select distinct is_male, age, name from people
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "wedding", "sql": "select distinct is_male, age, name from people" }, "style": "rule" }
{ "index": 971, "split": "train" }
When was the tweet by the user with ID 6 created?
twitter_1
select t0.createdate, t0.uid as c2 from tweets as t0, (select max(uid) as c3 from tweets where id = 6) as t1 where c2 = t1.c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "twitter_1", "sql": "select t0.createdate, t0.uid as c2 from tweets as t0, (select max(uid) as c3 from tweets where id = 6) as t1 where c2 = t1.c3" }, "style": "rule" }
{ "index": 3807, "split": "train" }
What are the booking start dates, refund amounts, and booking IDs for the bookings involving products with IDs between 2 and 5 that are currently available?
products_for_hire
select t0.booking_start_date, t0.amount_of_refund, t0.booking_id from bookings as t0 join products_booked as t1 on t0.booking_id = t1.booking_id join products_for_hire as t2 on t1.product_id = t2.product_id join view_product_availability as t3 on t2.product_id = t3.product_id where t3.product_id between 2 and 5 and t3....
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select t0.booking_start_date, t0.amount_of_refund, t0.booking_id from bookings as t0 join products_booked as t1 on t0.booking_id = t1.booking_id join products_for_hire as t2 on t1.product_id = t2.product_id join view_product_availability as t3 on t2.pr...
{ "index": 1232, "split": "train" }
Is the highest low temperature at station 10 on days with "da" lower than the highest low temperature recorded at station 3?
station_weather
select t1.c2 < t0.c2 from (select max(t1.low_temperature) as c2 from station as t0 join weekly_weather as t1 on t0.id = t1.station_id where t0.id = 10 and t1.day_of_week like '%da%' group by t0.id) as t1, (select t0.id, max(t1.low_temperature) as c2 from station as t0 join weekly_weather as t1 on t0.id = t1.station_id ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select t1.c2 < t0.c2 from (select max(t1.low_temperature) as c2 from station as t0 join weekly_weather as t1 on t0.id = t1.station_id where t0.id = 10 and t1.day_of_week like '%da%' group by t0.id) as t1, (select t0.id, max(t1.low_temperature) as c2 from...
{ "index": 3575, "split": "train" }
What are the last names, majors, and allergies of students who have the most common allergy type, with the list sorted in reverse alphabetical order of allergies, showing only the top 10 results?
allergy_1
select t0.lname, t0.major, t1.allergy as c0 from student as t0 join has_allergy as t1 on t0.stuid = t1.stuid join allergy_type as t2 on t1.allergy = t2.allergy, (select allergy as c1 from allergy_type group by c1 order by count(*) desc limit 1) as t0 where t2.allergy = t0.c1 order by c0 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "allergy_1", "sql": "select t0.lname, t0.major, t1.allergy as c0 from student as t0 join has_allergy as t1 on t0.stuid = t1.stuid join allergy_type as t2 on t1.allergy = t2.allergy, (select allergy as c1 from allergy_type group by c1 order by count(*) desc limit 1) as t0 where t2....
{ "index": 937, "split": "train" }
What are the birth states, ages, IDs, and names of heads who are both listed in the head table and are associated with departments that have a ranking below 5?
department_management
select anon_1.c1, anon_1.c2, anon_1.c0, anon_1.c3 from (select born_state as c1, age as c2, head_id as c0, name as c3 from head intersect select t0.born_state as c1, t0.age as c2, t0.head_id as c0, t0.name as c3 from head as t0 join management as t1 on t0.head_id = t1.head_id join department as t2 on t1.department_id =...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_management", "sql": "select anon_1.c1, anon_1.c2, anon_1.c0, anon_1.c3 from (select born_state as c1, age as c2, head_id as c0, name as c3 from head intersect select t0.born_state as c1, t0.age as c2, t0.head_id as c0, t0.name as c3 from head as t0 join management as t...
{ "index": 1951, "split": "train" }
Which shipping agents are listed in the system, excluding those associated with documents that were marked as mailed late?
cre_Doc_Control_Systems
select anon_1.c0, anon_1.c1 from (select shipping_agent_code as c0, shipping_agent_name as c1 from ref_shipping_agents except select t0.shipping_agent_code as c0, t0.shipping_agent_name as c1 from ref_shipping_agents as t0 join documents as t1 on t0.shipping_agent_code = t1.shipping_agent_code join ref_document_status ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Control_Systems", "sql": "select anon_1.c0, anon_1.c1 from (select shipping_agent_code as c0, shipping_agent_name as c1 from ref_shipping_agents except select t0.shipping_agent_code as c0, t0.shipping_agent_name as c1 from ref_shipping_agents as t0 join documents as t1 on...
{ "index": 822, "split": "train" }
Find the three most recent products, including their IDs, names, maximum page sizes, store IDs, and store types, from stores located in district 11, and sort them by product ID in descending order.
store_product
select t0.product_id as c4, t0.product, t0.max_page_size, t2.store_id, t2.type from product as t0 join store_product as t1 on t0.product_id = t1.product_id join store as t2 on t1.store_id = t2.store_id join store_district as t3 on t2.store_id = t3.store_id where t3.district_id = 11 order by c4 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select t0.product_id as c4, t0.product, t0.max_page_size, t2.store_id, t2.type from product as t0 join store_product as t1 on t0.product_id = t1.product_id join store as t2 on t1.store_id = t2.store_id join store_district as t3 on t2.store_id = t3.store_id...
{ "index": 881, "split": "train" }
Can you list the IDs, names, and types of schools that are either linked to drivers from the most common political party or have drivers whose home city contains the letter "l"?
school_bus
select anon_1.c1, anon_1.c3, anon_1.c0 from (select t0.school_id as c1, t0.school as c3, t0.type as c0 from school as t0 join school_bus as t1 on t0.school_id = t1.school_id join driver as t2 on t1.driver_id = t2.driver_id, (select party as c2 from driver group by c2 order by count(*) desc limit 1) as t1 where t2.party...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "school_bus", "sql": "select anon_1.c1, anon_1.c3, anon_1.c0 from (select t0.school_id as c1, t0.school as c3, t0.type as c0 from school as t0 join school_bus as t1 on t0.school_id = t1.school_id join driver as t2 on t1.driver_id = t2.driver_id, (select party as c2 from driver gro...
{ "index": 368, "split": "train" }
What are the details of all mountains located in the country of Ethiopia?
mountain_photos
select * from mountain where country = 'Ethiopia'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "mountain_photos", "sql": "select * from mountain where country = 'Ethiopia'" }, "style": "rule" }
{ "index": 1796, "split": "train" }
On the date when the staff member who recorded the fault with the description "failed parts" was most recently involved, what was the date of that fault log entry?
assets_maintenance
select t0.fault_log_entry_datetime, t0.recorded_by_staff_id as c2 from fault_log as t0, (select max(recorded_by_staff_id) as c0 from fault_log where fault_description = 'failed parts') as t1 where c2 = t1.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t0.fault_log_entry_datetime, t0.recorded_by_staff_id as c2 from fault_log as t0, (select max(recorded_by_staff_id) as c0 from fault_log where fault_description = 'failed parts') as t1 where c2 = t1.c0" }, "style": "rule" }
{ "index": 3747, "split": "train" }
Is the average unit price of tracks on album 136 less than the combined total of average track prices for all albums that have tracks priced between 99 cents and 1.99 dollars?
store_1
select t2.c0 < t1.c3 from (select avg(t1.unit_price) as c0 from albums as t0 join tracks as t1 on t0.id = t1.album_id where t0.id = 136 group by t0.id) as t2, (select sum(t0.c0) as c3 from (select avg(t1.unit_price) as c0 from albums as t0 join tracks as t1 on t0.id = t1.album_id where t1.unit_price between 0.99 and 1....
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t2.c0 < t1.c3 from (select avg(t1.unit_price) as c0 from albums as t0 join tracks as t1 on t0.id = t1.album_id where t0.id = 136 group by t0.id) as t2, (select sum(t0.c0) as c3 from (select avg(t1.unit_price) as c0 from albums as t0 join tracks as t1 on t...
{ "index": 3863, "split": "train" }
What are the annual entry and exit numbers and total passenger counts for stations that are served by train stations with station ID 3, but not by those with station ID 5?
train_station
select anon_1.c1, anon_1.c0 from (select t0.annual_entry_exit as c1, t0.total_passengers as c0 from station as t0 join train_station as t1 on t0.station_id = t1.station_id where t1.station_id = 3 except select t0.annual_entry_exit as c1, t0.total_passengers as c0 from station as t0 join train_station as t1 on t0.statio...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "train_station", "sql": "select anon_1.c1, anon_1.c0 from (select t0.annual_entry_exit as c1, t0.total_passengers as c0 from station as t0 join train_station as t1 on t0.station_id = t1.station_id where t1.station_id = 3 except select t0.annual_entry_exit as c1, t0.total_passenger...
{ "index": 972, "split": "train" }
Who are the three youngest students, and what are their ages and student IDs?
dorm_1
select age as c1, stuid from student order by c1 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select age as c1, stuid from student order by c1 asc nulls last limit 3" }, "style": "rule" }
{ "index": 825, "split": "train" }
What are the temperatures in March and July, along with the regional population, for cities that hosted matches in 2009, sorted by their regional population?
city_record
select t0.mar, t0.jul, t1.regional_population as c1 from temperature as t0 join city as t1 on t0.city_id = t1.city_id join hosting_city as t2 on t1.city_id = t2.host_city where t2.year = 2009 order by c1 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "city_record", "sql": "select t0.mar, t0.jul, t1.regional_population as c1 from temperature as t0 join city as t1 on t0.city_id = t1.city_id join hosting_city as t2 on t1.city_id = t2.host_city where t2.year = 2009 order by c1 asc nulls last" }, "style": "rule" }
{ "index": 1124, "split": "train" }
What is the number of companies in the main industry that has the lowest minimum assets?
gas_company
select main_industry as c0, count(*) from company group by c0 order by min(assets_billion) asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "gas_company", "sql": "select main_industry as c0, count(*) from company group by c0 order by min(assets_billion) asc nulls last limit 1" }, "style": "rule" }
{ "index": 1375, "split": "train" }
Which location code has the fewest total records, and how many unique documents and date entries are associated with that location?
cre_Doc_Tracking_DB
select location_code as c1, count(distinct (document_id)), count(date_in_location_from) from document_locations group by c1 order by count(*) asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Tracking_DB", "sql": "select location_code as c1, count(distinct (document_id)), count(date_in_location_from) from document_locations group by c1 order by count(*) asc nulls last limit 1" }, "style": "rule" }
{ "index": 1240, "split": "train" }
Is the catalog level for the entry with ID 5 higher than 1?
product_catalog
select catalog_level_number > 1 from catalog_contents_additional_attributes where catalog_entry_id = 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select catalog_level_number > 1 from catalog_contents_additional_attributes where catalog_entry_id = 5" }, "style": "rule" }
{ "index": 3298, "split": "train" }
Can you tell me the order date, order ID, customer ID, and invoice number for orders where the invoice date is on or after September 3, 1989, at 4:03 PM, and the invoice details include the letter "o"?
tracking_orders
select t0.date_order_placed, t0.order_id, t0.customer_id, t1.invoice_number from orders as t0 join shipments as t1 on t0.order_id = t1.order_id join invoices as t2 on t1.invoice_number = t2.invoice_number where t2.invoice_date >= '1989-09-03 16:03:05' and t2.invoice_details like '%o%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.date_order_placed, t0.order_id, t0.customer_id, t1.invoice_number from orders as t0 join shipments as t1 on t0.order_id = t1.order_id join invoices as t2 on t1.invoice_number = t2.invoice_number where t2.invoice_date >= '1989-09-03 16:03:05' an...
{ "index": 2979, "split": "train" }
Which are the top 5 election committees that have the highest average party number, considering only parties numbered between 3 and 7 or less than the maximum party number? Please list them in reverse alphabetical order by their committee names.
election
select t0.committee as c0, avg(t0.party) from election as t0, (select max(party) as c1 from election) as t0 where t0.party between 3 and 7 or t0.party < t0.c1 group by c0 order by c0 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "election", "sql": "select t0.committee as c0, avg(t0.party) from election as t0, (select max(party) as c1 from election) as t0 where t0.party between 3 and 7 or t0.party < t0.c1 group by c0 order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2391, "split": "train" }
What are the catalog level numbers in the catalog contents that are associated with catalogs having IDs of 1 or higher?
product_catalog
select t0.catalog_level_number from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_id >= 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select t0.catalog_level_number from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_id >= 1" }, "style": "rule" }
{ "index": 1045, "split": "train" }
Which artist IDs and issue dates are linked to volumes that took part in music festivals with a volume number less than 3, excluding those festivals with ID 5?
music_4
select anon_1.c1, anon_1.c0 from (select t0.artist_id as c1, t0.issue_date as c0 from volume as t0 join music_festival as t1 on t0.volume_id = t1.volume where t1.volume < 3 except select t0.artist_id as c1, t0.issue_date as c0 from volume as t0 join music_festival as t1 on t0.volume_id = t1.volume where t1.id = 5) as a...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_4", "sql": "select anon_1.c1, anon_1.c0 from (select t0.artist_id as c1, t0.issue_date as c0 from volume as t0 join music_festival as t1 on t0.volume_id = t1.volume where t1.volume < 3 except select t0.artist_id as c1, t0.issue_date as c0 from volume as t0 join music_festiv...
{ "index": 1644, "split": "train" }
What are the titles and item IDs of reviews, along with the user IDs, for reviews made by user accounts that have the most common name or a name containing "k"?
epinions_1
select t0.title, t0.i_id, t1.u_id from item as t0 join review as t1 on t0.i_id = t1.i_id join useracct as t2 on t1.u_id = t2.u_id, (select name as c0 from useracct group by c0 order by count(*) desc limit 1) as t0 where t2.name = t0.c0 or t2.name like '%k%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "epinions_1", "sql": "select t0.title, t0.i_id, t1.u_id from item as t0 join review as t1 on t0.i_id = t1.i_id join useracct as t2 on t1.u_id = t2.u_id, (select name as c0 from useracct group by c0 order by count(*) desc limit 1) as t0 where t2.name = t0.c0 or t2.name like '%k%'" ...
{ "index": 2594, "split": "train" }
How much taller is the building with id 8 compared to the shortest building whose status indicates it is on hold?
company_office
select t2.c1 - t0.c2 from (select min(height) as c1 from buildings where status like '%on-hold') as t2, (select height as c2 from buildings where id = 8) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select t2.c1 - t0.c2 from (select min(height) as c1 from buildings where status like '%on-hold') as t2, (select height as c2 from buildings where id = 8) as t0" }, "style": "rule" }
{ "index": 3184, "split": "train" }
For the book with ID 9, what is each writer's name and the smallest number of issues for their book?
book_2
select writer as c0, min(issues) from book where book_id = 9 group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "book_2", "sql": "select writer as c0, min(issues) from book where book_id = 9 group by c0" }, "style": "rule" }
{ "index": 540, "split": "train" }
How many unique staff members have handled complaints for products whose names include the letter "e," and what are the product category codes and product IDs for those products?
customer_complaints
select count(distinct (t0.staff_id)), t1.product_category_code, t1.product_id as c2 from complaints as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_name like '%e%' group by c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_complaints", "sql": "select count(distinct (t0.staff_id)), t1.product_category_code, t1.product_id as c2 from complaints as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_name like '%e%' group by c2" }, "style": "rule" }
{ "index": 62, "split": "train" }
What is the smallest savings balance and the customer ID for each customer whose name starts with "W," ordered by customer ID from the highest to the lowest?
small_bank_1
select min(t0.balance), t1.custid as c1 from savings as t0 join accounts as t1 on t0.custid = t1.custid where t1.name like 'W%' group by c1 order by c1 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select min(t0.balance), t1.custid as c1 from savings as t0 join accounts as t1 on t0.custid = t1.custid where t1.name like 'W%' group by c1 order by c1 desc" }, "style": "rule" }
{ "index": 1671, "split": "train" }
Is the average address ID for address 82 greater than 5.0?
student_assessment
select t0.c0 > 5.0 from (select avg(t1.address_id) as c0 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where t0.address_id = 82 group by t0.address_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select t0.c0 > 5.0 from (select avg(t1.address_id) as c0 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where t0.address_id = 82 group by t0.address_id) as t0" }, "style": "rule" }
{ "index": 3302, "split": "train" }
How many units apart is the OMIM number for enzyme with ID 3 from 121300?
medicine_enzyme_interaction
select omim - 121300 from enzyme where id = 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select omim - 121300 from enzyme where id = 3" }, "style": "rule" }
{ "index": 3242, "split": "train" }
Find the first device and its ID from devices available at shops that opened in or before 2013, sorted alphabetically by device name.
device
select t0.device as c0, t0.device_id from device as t0 join stock as t1 on t0.device_id = t1.device_id join shop as t2 on t1.shop_id = t2.shop_id where t2.open_year <= 2013 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "device", "sql": "select t0.device as c0, t0.device_id from device as t0 join stock as t1 on t0.device_id = t1.device_id join shop as t2 on t1.shop_id = t2.shop_id where t2.open_year <= 2013 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 50, "split": "train" }
Among students with IDs from 1003 to 1010, who has the highest gradepoint, and what are their gradepoint, letter grade, and grade?
college_3
select t0.gradepoint as c2, t0.lettergrade, t1.grade from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t1.stuid between 1003 and 1010 order by c2 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_3", "sql": "select t0.gradepoint as c2, t0.lettergrade, t1.grade from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t1.stuid between 1003 and 1010 order by c2 desc limit 1" }, "style": "rule" }
{ "index": 2485, "split": "train" }
Did the fault log entry for ID 2 occur after the fault log entry for ID 13?
assets_maintenance
select t1.c2 > t0.c2 from (select fault_log_entry_datetime as c2 from fault_log where fault_log_entry_id = 2) as t1, (select fault_log_entry_datetime as c2 from fault_log where fault_log_entry_id = 13) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t1.c2 > t0.c2 from (select fault_log_entry_datetime as c2 from fault_log where fault_log_entry_id = 2) as t1, (select fault_log_entry_datetime as c2 from fault_log where fault_log_entry_id = 13) as t0" }, "style": "rule" }
{ "index": 3069, "split": "train" }
Is the validity period for the card with ID 14 set to end before the validity period for the card with ID 2?
customers_card_transactions
select t1.c2 < t0.c2 from (select date_valid_to as c2 from customers_cards where card_id = 14) as t1, (select date_valid_to as c2 from customers_cards where card_id = 2) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select t1.c2 < t0.c2 from (select date_valid_to as c2 from customers_cards where card_id = 14) as t1, (select date_valid_to as c2 from customers_cards where card_id = 2) as t0" }, "style": "rule" }
{ "index": 3128, "split": "train" }
What is the address ID of the person whose cell mobile number ends with "03-110-0647"?
student_assessment
select t0.address_id from people_addresses as t0 join people as t1 on t0.person_id = t1.person_id where t1.cell_mobile_number like '%03-110-0647'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select t0.address_id from people_addresses as t0 join people as t1 on t0.person_id = t1.person_id where t1.cell_mobile_number like '%03-110-0647'" }, "style": "rule" }
{ "index": 2692, "split": "train" }
Which stadiums with IDs greater than 2 that hosted game 12 have how many home games, what their IDs are, and in how many different seasons did these games take place?
game_injury
select t0.home_games, t0.id as c1, count(distinct (t1.season)) from stadium as t0 join game as t1 on t0.id = t1.stadium_id where t1.stadium_id > 2 and t1.id = 12 group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_injury", "sql": "select t0.home_games, t0.id as c1, count(distinct (t1.season)) from stadium as t0 join game as t1 on t0.id = t1.stadium_id where t1.stadium_id > 2 and t1.id = 12 group by c1" }, "style": "rule" }
{ "index": 2074, "split": "train" }
Which students with registration ID 10 have their login names listed alphabetically, placing any NULL login names at the end?
e_learning
select t0.login_name as c0 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.registration_id = 10 order by c0 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.login_name as c0 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.registration_id = 10 order by c0 asc nulls last" }, "style": "rule" }
{ "index": 2228, "split": "train" }
List the first five repair order names in alphabetical order, placing any null values at the end.
machine_repair
select name as c0 from repair order by c0 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "machine_repair", "sql": "select name as c0 from repair order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 1855, "split": "train" }
Show me the first 10 genders and names of people whose names start with "Alice," sorted by gender, from the database of friends in Network 2.
network_2
select t0.gender as c1, t0.name from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like 'Alice%' order by c1 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select t0.gender as c1, t0.name from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like 'Alice%' order by c1 asc nulls last limit 10" }, "style": "rule" }
{ "index": 2519, "split": "train" }
Which are the top 10 positions and countries, along with team IDs and team names, for players who participated in seasons with years playing "03" or "11)", sorted in descending order by their positions?
match_season
select t0.position as c0, t0.country, t1.team_id, t1.name from match_season as t0 join team as t1 on t0.team = t1.team_id join player as t2 on t1.team_id = t2.team where t2.years_played like '%03%' or t2.years_played like '%11)%' order by c0 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "match_season", "sql": "select t0.position as c0, t0.country, t1.team_id, t1.name from match_season as t0 join team as t1 on t0.team = t1.team_id join player as t2 on t1.team_id = t2.team where t2.years_played like '%03%' or t2.years_played like '%11)%' order by c0 desc limit 10" ...
{ "index": 1268, "split": "train" }
What is the average product ID, along with the customer and order IDs, for each order placed after March 19th, 2018, that has the note "Second time" in its order details?
customers_and_addresses
select avg(t0.product_id), t1.customer_id, t1.order_id as c1 from order_items as t0 join customer_orders as t1 on t0.order_id = t1.order_id where t1.order_date > '2018-03-19 18:05:50' and t1.order_details = 'Second time' group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select avg(t0.product_id), t1.customer_id, t1.order_id as c1 from order_items as t0 join customer_orders as t1 on t0.order_id = t1.order_id where t1.order_date > '2018-03-19 18:05:50' and t1.order_details = 'Second time' group by c1" }, "styl...
{ "index": 1969, "split": "train" }
Which subjects have the same name and ID as those linked to the course that has the lowest maximum author ID among courses with subject ID less than or equal to 1 and subject ID less than 2?
e_learning
select t0.subject_name, t0.subject_id from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id, (select course_description as c0 from courses where subject_id <= 1 group by c0 order by max(author_id) asc nulls last limit 1) as t0 where t1.course_description = t0.c0 and t1.subject_id < 2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.subject_name, t0.subject_id from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id, (select course_description as c0 from courses where subject_id <= 1 group by c0 order by max(author_id) asc nulls last limit 1) as t0 where t1.cours...
{ "index": 2037, "split": "train" }
What is the total number of products booked and the corresponding booking ID for each booking that ended on or before the evening of February 19, 2018, and which had an exact refund amount of 135.94?
products_for_hire
select sum(t0.booked_count), t1.booking_id as c0 from products_booked as t0 join bookings as t1 on t0.booking_id = t1.booking_id where t1.booking_end_date <= '2018-02-19 21:53:31' and t1.amount_of_refund = 135.94 group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select sum(t0.booked_count), t1.booking_id as c0 from products_booked as t0 join bookings as t1 on t0.booking_id = t1.booking_id where t1.booking_end_date <= '2018-02-19 21:53:31' and t1.amount_of_refund = 135.94 group by c0" }, "style": "rule" }
{ "index": 690, "split": "train" }
How many days elapsed between the start and end dates for the 'SA_MAN' job entries?
hr_1
select julianday(t1.c3) - julianday(t0.c1) from (select end_date as c3 from job_history) as t1, (select start_date as c1 from job_history where job_id = 'SA_MAN' and job_id = 'SA_MAN') as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "hr_1", "sql": "select julianday(t1.c3) - julianday(t0.c1) from (select end_date as c3 from job_history) as t1, (select start_date as c1 from job_history where job_id = 'SA_MAN' and job_id = 'SA_MAN') as t0" }, "style": "rule" }
{ "index": 3923, "split": "train" }
Which customers, who have canceled lessons with ID 10, became customers on what date, how much do they owe now, what is their customer ID, and how many canceled lessons with that ID have they had?
driving_school
select t0.date_became_customer, t0.amount_outstanding, t0.customer_id as c3, count(t1.price) from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t1.lesson_status_code like '%Cancelled' and t1.lesson_id = 10 group by c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select t0.date_became_customer, t0.amount_outstanding, t0.customer_id as c3, count(t1.price) from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t1.lesson_status_code like '%Cancelled' and t1.lesson_id = 10 group by c3" }, ...
{ "index": 514, "split": "train" }
For each main service offered at train stations with exactly 15 platforms, how many locations are served?
train_station
select main_services as c1, count(location) from station where number_of_platforms = 15 group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "train_station", "sql": "select main_services as c1, count(location) from station where number_of_platforms = 15 group by c1" }, "style": "rule" }
{ "index": 784, "split": "train" }
Which characteristic data type has the least number of unique other characteristic details, and what is that number?
products_gen_characteristics
select characteristic_data_type as c1, count(distinct (other_characteristic_details)) as c0 from characteristics group by c1 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select characteristic_data_type as c1, count(distinct (other_characteristic_details)) as c0 from characteristics group by c1 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 11, "split": "train" }