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
What are the states, enrollment numbers, and names of the first three colleges when listed in alphabetical order by state, with null states appearing last?
soccer_2
select state as c1, enr, cname from college 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": "soccer_2", "sql": "select state as c1, enr, cname from college order by c1 asc nulls last limit 3" }, "style": "rule" }
{ "index": 1086, "split": "train" }
When was the latest tweet made by the user with the highest user ID who posted on or after March 12, 2018, 02:30:30?
twitter_1
select t0.createdate, t0.uid as c2 from tweets as t0, (select max(uid) as c3 from tweets where createdate >= '2018-03-12 02:30:30') 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 createdate >= '2018-03-12 02:30:30') as t1 where c2 = t1.c3" }, "style": "rule" }
{ "index": 3806, "split": "train" }
What are the genders and names of friends who are either named Bob or have a name that includes the letter "a"?
network_2
select t0.gender, t1.friend as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where c0 = 'Bob' or c0 like '%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": "network_2", "sql": "select t0.gender, t1.friend as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where c0 = 'Bob' or c0 like '%a%'" }, "style": "rule" }
{ "index": 351, "split": "train" }
Which customers, identified by their gender and ID, have a total sum of booking numbers, where their payment amounts due are either between 482.26 and 840.06 or above 369.52?
products_for_hire
select t0.gender_mf, t0.customer_id as c1, sum(t1.booking_id) from customers as t0 join payments as t1 on t0.customer_id = t1.customer_id where t1.amount_due between 482.26 and 840.06 or t1.amount_due > 369.52 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": "products_for_hire", "sql": "select t0.gender_mf, t0.customer_id as c1, sum(t1.booking_id) from customers as t0 join payments as t1 on t0.customer_id = t1.customer_id where t1.amount_due between 482.26 and 840.06 or t1.amount_due > 369.52 group by c1" }, "style": "rule" }
{ "index": 2184, "split": "train" }
What are the top 3 highest payment amounts made by customers who have at most five payments, live at addresses with ID 2 or higher, and were born between March 8, 1993, and September 18, 1998?
driving_school
select max(t0.amount_payment) from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.customer_address_id >= 2 and t1.date_of_birth between '1993-03-08 08:48:42' and '1998-09-18 04:45:01' group by t1.customer_id having count(*) <= 5 order by t1.customer_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": "driving_school", "sql": "select max(t0.amount_payment) from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.customer_address_id >= 2 and t1.date_of_birth between '1993-03-08 08:48:42' and '1998-09-18 04:45:01' group by t1.customer_id havin...
{ "index": 2972, "split": "train" }
Which last names have a maximum staff address ID of 12, and among them, what are the top 5 highest staff address IDs sorted alphabetically by last name?
driving_school
select max(staff_address_id) from staff group by last_name having max(staff_address_id) = 12 order by last_name 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": "driving_school", "sql": "select max(staff_address_id) from staff group by last_name having max(staff_address_id) = 12 order by last_name asc nulls last limit 5" }, "style": "rule" }
{ "index": 1947, "split": "train" }
Which `left_office` position, starting from the most recent or latest in reverse alphabetical order, has the highest number of unique party names and total party IDs, and what are these counts?
party_people
select left_office as c2, count(distinct (party_name)), count(party_id) from party group by c2 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": "party_people", "sql": "select left_office as c2, count(distinct (party_name)), count(party_id) from party group by c2 order by c2 desc limit 1" }, "style": "rule" }
{ "index": 2779, "split": "train" }
Which media types, each containing at most two tracks starting with "Knockin' On Heaven's Door," are the most expensive based on their cheapest track, and what are their names and IDs? Only the top three most costly media types should be shown.
store_1
select t0.name, t0.id as c1 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.name like 'Knockin'' On Heaven''s Door%' group by c1 having count(*) <= 2 order by min(t1.unit_price) 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_1", "sql": "select t0.name, t0.id as c1 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.name like 'Knockin'' On Heaven''s Door%' group by c1 having count(*) <= 2 order by min(t1.unit_price) desc limit 3" }, "style": "rule" }
{ "index": 2308, "split": "train" }
Which maintenance contract has the latest end date, and what are its start date, contract company ID, and the last name of an engineer from that company who possesses either the most common or the least common skill description?
assets_maintenance
select t0.contract_end_date as c0, t0.contract_start_date, t0.maintenance_contract_company_id, t2.last_name from maintenance_contracts as t0 join third_party_companies as t1 on t0.maintenance_contract_company_id = t1.company_id join maintenance_engineers as t2 on t1.company_id = t2.company_id join engineer_skills as 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": "assets_maintenance", "sql": "select t0.contract_end_date as c0, t0.contract_start_date, t0.maintenance_contract_company_id, t2.last_name from maintenance_contracts as t0 join third_party_companies as t1 on t0.maintenance_contract_company_id = t1.company_id join maintenance_engine...
{ "index": 721, "split": "train" }
Can you identify the most recent project document whose statement details mention "Projec"? For that document, what is its budget type description and code, along with the project ID and document name, sorted by the document name in descending order?
cre_Docs_and_Epenses
select t0.budget_type_description, t0.budget_type_code, t2.project_id, t2.document_name as c1 from ref_budget_codes as t0 join documents_with_expenses as t1 on t0.budget_type_code = t1.budget_type_code join documents as t2 on t1.document_id = t2.document_id join statements as t3 on t2.document_id = t3.statement_id wher...
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_Docs_and_Epenses", "sql": "select t0.budget_type_description, t0.budget_type_code, t2.project_id, t2.document_name as c1 from ref_budget_codes as t0 join documents_with_expenses as t1 on t0.budget_type_code = t1.budget_type_code join documents as t2 on t1.document_id = t2.doc...
{ "index": 1801, "split": "train" }
List the ages of the ten oldest actors.
musical
select age as c0 from actor 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": "musical", "sql": "select age as c0 from actor order by c0 desc limit 10" }, "style": "rule" }
{ "index": 1051, "split": "train" }
Which genres have both tracks priced at $0.99 or more and a genre ID less than 10? Please specify their genre IDs and names.
chinook_1
select anon_1.c1, anon_1.c0 from (select t0.genreid as c1, t0.name as c0 from genre as t0 join track as t1 on t0.genreid = t1.genreid where t1.unitprice >= 0.99 intersect select t0.genreid as c1, t0.name as c0 from genre as t0 join track as t1 on t0.genreid = t1.genreid where t1.genreid < 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": "chinook_1", "sql": "select anon_1.c1, anon_1.c0 from (select t0.genreid as c1, t0.name as c0 from genre as t0 join track as t1 on t0.genreid = t1.genreid where t1.unitprice >= 0.99 intersect select t0.genreid as c1, t0.name as c0 from genre as t0 join track as t1 on t0.genreid = ...
{ "index": 358, "split": "train" }
Which class sections and professor numbers are associated with departments that have employee numbers greater than 106 and belong to the school that has the most departments?
college_1
select t0.class_section, t0.prof_num from class as t0 join employee as t1 on t0.prof_num = t1.emp_num join department as t2 on t1.emp_num = t2.emp_num, (select school_code as c2 from department group by c2 order by count(*) desc limit 1) as t0 where t2.emp_num > 106 and t2.school_code = t0.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": "college_1", "sql": "select t0.class_section, t0.prof_num from class as t0 join employee as t1 on t0.prof_num = t1.emp_num join department as t2 on t1.emp_num = t2.emp_num, (select school_code as c2 from department group by c2 order by count(*) desc limit 1) as t0 where t2.emp_num...
{ "index": 1833, "split": "train" }
What are the dorm IDs and student capacities for dorms with IDs less than or equal to 117?
dorm_1
select t0.student_capacity from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid where t1.dormid <= 117
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 t0.student_capacity from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid where t1.dormid <= 117" }, "style": "rule" }
{ "index": 2615, "split": "train" }
Who is the staff member with a lesson fee of either exactly 295 dollars or less than 184 dollars, whose middle name comes last alphabetically? Only the top result is needed.
driving_school
select t0.middle_name as c0 from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t1.price = 295.0 or t1.price < 184.0 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": "driving_school", "sql": "select t0.middle_name as c0 from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t1.price = 295.0 or t1.price < 184.0 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 1907, "split": "train" }
What are the locations and attendance numbers of performances, along with the performance and member IDs, for members whose names include "uis Gonz"?
performance_attendance
select t0.location, t0.attendance, t1.performance_id, t1.member_id from performance as t0 join member_attendance as t1 on t0.performance_id = t1.performance_id join member as t2 on t1.member_id = t2.member_id where t2.name like '%uis Gonz%'
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": "performance_attendance", "sql": "select t0.location, t0.attendance, t1.performance_id, t1.member_id from performance as t0 join member_attendance as t1 on t0.performance_id = t1.performance_id join member as t2 on t1.member_id = t2.member_id where t2.name like '%uis Gonz%'" }, ...
{ "index": 246, "split": "train" }
List the student capacity and name of dorms that either have the highest average amenity ID or have dorm ID 117, sorted alphabetically by dorm name.
dorm_1
select t0.student_capacity, t0.dorm_name as c2 from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid, (select dormid as c1 from has_amenity group by c1 order by avg(amenid) desc limit 1) as t0 where t1.dormid = t0.c1 or t1.dormid = 117 order by c2 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": "dorm_1", "sql": "select t0.student_capacity, t0.dorm_name as c2 from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid, (select dormid as c1 from has_amenity group by c1 order by avg(amenid) desc limit 1) as t0 where t1.dormid = t0.c1 or t1.dormid = 117 order by c2 asc n...
{ "index": 1743, "split": "train" }
Among institutions, which one is associated with authors who have the most common last name? For that institution, what is its country, ID, and name, and what are the associated authorship and paper IDs? Show the first such institution when sorted alphabetically by country.
icfp_1
select t0.country as c4, t0.instid, t0.name, t1.instid, t1.paperid from inst as t0 join authorship as t1 on t0.instid = t1.instid join authors as t2 on t1.authid = t2.authid, (select lname as c5 from authors group by c5 order by count(*) desc limit 1) as t0 where t2.lname = t0.c5 order by c4 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": "icfp_1", "sql": "select t0.country as c4, t0.instid, t0.name, t1.instid, t1.paperid from inst as t0 join authorship as t1 on t0.instid = t1.instid join authors as t2 on t1.authid = t2.authid, (select lname as c5 from authors group by c5 order by count(*) desc limit 1) as t0 where...
{ "index": 1302, "split": "train" }
How much does the pages per minute color for product ID 3 differ from 28.0?
store_product
select pages_per_minute_color - 28.0 from product where product_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": "store_product", "sql": "select pages_per_minute_color - 28.0 from product where product_id = 3" }, "style": "rule" }
{ "index": 3255, "split": "train" }
Which operate companies with IDs less than 6 have flights piloted by the most frequently used pilot?
flight_company
select t0.name from operate_company as t0 join flight as t1 on t0.id = t1.company_id, (select pilot as c1 from flight group by c1 order by count(*) desc limit 1) as t0 where t1.company_id < 6 and t1.pilot = t0.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": "flight_company", "sql": "select t0.name from operate_company as t0 join flight as t1 on t0.id = t1.company_id, (select pilot as c1 from flight group by c1 order by count(*) desc limit 1) as t0 where t1.company_id < 6 and t1.pilot = t0.c1" }, "style": "rule" }
{ "index": 1486, "split": "train" }
What is the percent increase or decrease in the number of unique documents stored on March 10, 1997, compared to October 14, 1986?
cre_Doc_Tracking_DB
select (sum(t0.c0) / cast(sum(t1.c0) as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c0 from ref_calendar as t0 join all_documents as t1 on t0.calendar_date = t1.date_stored where t1.date_stored = '1986-10-14 17:53:39' group by t0.calendar_date) as t0, (select count(distinct (t1.document_id)) as 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": "cre_Doc_Tracking_DB", "sql": "select (sum(t0.c0) / cast(sum(t1.c0) as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c0 from ref_calendar as t0 join all_documents as t1 on t0.calendar_date = t1.date_stored where t1.date_stored = '1986-10-14 17:53:39' group by t...
{ "index": 3846, "split": "train" }
How many different years, and which persons with gender containing "ale" and living in a city with "g" in their name, have friendship records?
network_2
select count(distinct (t0.year)), t1.name as c0 from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.gender like '%ale%' and t1.city like '%g%' 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": "network_2", "sql": "select count(distinct (t0.year)), t1.name as c0 from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.gender like '%ale%' and t1.city like '%g%' group by c0" }, "style": "rule" }
{ "index": 2660, "split": "train" }
What is the start date of the booking that includes the product with ID 5?
products_for_hire
select t0.booking_start_date from bookings as t0 join products_booked as t1 on t0.booking_id = t1.booking_id where t1.product_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": "products_for_hire", "sql": "select t0.booking_start_date from bookings as t0 join products_booked as t1 on t0.booking_id = t1.booking_id where t1.product_id = 5" }, "style": "rule" }
{ "index": 1868, "split": "train" }
What are the ten most recent budget type codes for documents with expenses, sorted by the latest document IDs?
cre_Docs_and_Epenses
select budget_type_code from documents_with_expenses order by document_id 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": "cre_Docs_and_Epenses", "sql": "select budget_type_code from documents_with_expenses order by document_id desc limit 10" }, "style": "rule" }
{ "index": 1296, "split": "train" }
How many publications are recorded in the database?
book_2
select count(*) from publication
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 count(*) from publication" }, "style": "rule" }
{ "index": 2566, "split": "train" }
Can you provide the names and countries of all airports and airlines?
flight_4
select anon_1.c1, anon_1.c3 from (select name as c1, country as c3 from airports union select name, country from airlines) 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": "flight_4", "sql": "select anon_1.c1, anon_1.c3 from (select name as c1, country as c3 from airports union select name, country from airlines) as anon_1" }, "style": "rule" }
{ "index": 2201, "split": "train" }
How many employees are in the Staff table, and how many of those have a unique Staff ID, with the results ordered by the total number of staff records?
department_store
select count(*) as c0, count(distinct (staff_id)) from staff 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": "department_store", "sql": "select count(*) as c0, count(distinct (staff_id)) from staff order by c0 asc nulls last" }, "style": "rule" }
{ "index": 1016, "split": "train" }
What are the number of bikes available and the city for stations located at latitudes up to 37.7913?
bike_1
select t0.bikes_available, t1.city from status as t0 join station as t1 on t0.station_id = t1.id where t1.lat <= 37.7913
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.bikes_available, t1.city from status as t0 join station as t1 on t0.station_id = t1.id where t1.lat <= 37.7913" }, "style": "rule" }
{ "index": 2901, "split": "train" }
What are the three city codes for students who have the highest average age, based on the student with the highest average age overall, and list them in descending order of their majors?
game_1
select t0.city_code from student as t0, (select stuid as c1 from student group by c1 order by avg(age) desc limit 1) as t0 where t0.stuid = t0.c1 order by t0.major 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": "game_1", "sql": "select t0.city_code from student as t0, (select stuid as c1 from student group by c1 order by avg(age) desc limit 1) as t0 where t0.stuid = t0.c1 order by t0.major desc limit 3" }, "style": "rule" }
{ "index": 1850, "split": "train" }
Which restaurants have had visits where students spent between 6.53 and 13.2, but no visits occurred after October 9, 2017, at 6:15 PM? What are their addresses and ratings?
restaurant_1
select anon_1.c0, anon_1.c1 from (select t0.address as c0, t0.rating as c1 from restaurant as t0 join visits_restaurant as t1 on t0.resid = t1.resid where t1.spent between 6.53 and 13.2 except select t0.address as c0, t0.rating as c1 from restaurant as t0 join visits_restaurant as t1 on t0.resid = t1.resid where t1.tim...
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": "restaurant_1", "sql": "select anon_1.c0, anon_1.c1 from (select t0.address as c0, t0.rating as c1 from restaurant as t0 join visits_restaurant as t1 on t0.resid = t1.resid where t1.spent between 6.53 and 13.2 except select t0.address as c0, t0.rating as c1 from restaurant as t0 j...
{ "index": 1861, "split": "train" }
What is the name of the activity with activity ID 778?
activity_1
select t0.activity_name from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.actid between 778 and 778
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 from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.actid between 778 and 778" }, "style": "rule" }
{ "index": 1262, "split": "train" }
Who are the owners of programs, listed in order of their origin with entries without a known origin appearing last, and limited to the first five results?
program_share
select owner from program order by origin 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": "program_share", "sql": "select owner from program order by origin asc nulls last limit 5" }, "style": "rule" }
{ "index": 2850, "split": "train" }
Which customers, along with their branch IDs, have taken out both the most frequently available loan type and loans from branches whose IDs end with "1"?
loan_1
select anon_1.c0, anon_1.c1 from (select t0.cust_name as c0, t0.branch_id as c1 from customer as t0 join loan as t1 on t0.cust_id = t1.cust_id, (select loan_type as c2 from loan group by c2 order by count(*) desc limit 1) as t1 where t1.loan_type = t1.c2 intersect select t0.cust_name as c0, t0.branch_id as c1 from cust...
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": "loan_1", "sql": "select anon_1.c0, anon_1.c1 from (select t0.cust_name as c0, t0.branch_id as c1 from customer as t0 join loan as t1 on t0.cust_id = t1.cust_id, (select loan_type as c2 from loan group by c2 order by count(*) desc limit 1) as t1 where t1.loan_type = t1.c2 intersec...
{ "index": 2971, "split": "train" }
What are the first 10 subjects and their smallest course subject IDs for courses created by authors with IDs 5 or less, sorted alphabetically by subject name?
e_learning
select t0.subject_id as c1, min(t1.subject_id) from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.author_id <= 5 group by c1 order by t0.subject_name 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": "e_learning", "sql": "select t0.subject_id as c1, min(t1.subject_id) from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.author_id <= 5 group by c1 order by t0.subject_name asc nulls last limit 10" }, "style": "rule" }
{ "index": 2349, "split": "train" }
Which course titles and credit values are required as prerequisites that either start with "95" or have the course ID 647?
college_2
select t0.title, t0.credits, t1.course_id from course as t0 join prereq as t1 on t0.course_id = t1.prereq_id where t1.prereq_id like '95%' or t1.prereq_id = 647
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.credits, t1.course_id from course as t0 join prereq as t1 on t0.course_id = t1.prereq_id where t1.prereq_id like '95%' or t1.prereq_id = 647" }, "style": "rule" }
{ "index": 1882, "split": "train" }
Which three letter grades have the lowest maximum grade points between 2.7 and 3.7?
college_3
select lettergrade as c0 from gradeconversion group by c0 having max(gradepoint) between 2.7 and 3.7 order by max(gradepoint) 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": "college_3", "sql": "select lettergrade as c0 from gradeconversion group by c0 having max(gradepoint) between 2.7 and 3.7 order by max(gradepoint) asc nulls last limit 3" }, "style": "rule" }
{ "index": 2529, "split": "train" }
Which unique problem IDs are linked to the log entry with the lowest maximum problem ID, or to the log entry with ID 1?
tracking_software_problems
select distinct t0.problem_id from problem_log as t0, (select problem_log_id as c1 from problem_log group by c1 order by max(problem_id) asc nulls last limit 1) as t0 where t0.problem_log_id = t0.c1 or t0.problem_log_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": "tracking_software_problems", "sql": "select distinct t0.problem_id from problem_log as t0, (select problem_log_id as c1 from problem_log group by c1 order by max(problem_id) asc nulls last limit 1) as t0 where t0.problem_log_id = t0.c1 or t0.problem_log_id = 1" }, "style": "r...
{ "index": 512, "split": "train" }
What are the customer ID, order ID, and order details for each order, along with the smallest account ID associated with the related transactions?
customers_and_invoices
select t0.customer_id, t0.order_id as c2, t0.order_details, min(t2.account_id) from orders as t0 join invoices as t1 on t0.order_id = t1.order_id join financial_transactions as t2 on t1.invoice_number = t2.invoice_number 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": "customers_and_invoices", "sql": "select t0.customer_id, t0.order_id as c2, t0.order_details, min(t2.account_id) from orders as t0 join invoices as t1 on t0.order_id = t1.order_id join financial_transactions as t2 on t1.invoice_number = t2.invoice_number group by c2" }, "style...
{ "index": 843, "split": "train" }
For each person, what is their city, name, and the average year of their friendships with friends whose names start with "Da" or friends who are also listed in the database?
network_2
select t0.city, t0.name as c0, avg(t1.year) from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.friend like 'Da%' or t1.friend in (select c0 as c0 from person) 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": "network_2", "sql": "select t0.city, t0.name as c0, avg(t1.year) from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.friend like 'Da%' or t1.friend in (select c0 as c0 from person) group by c0" }, "style": "rule" }
{ "index": 54, "split": "train" }
Which machines, along with their IDs and series, are assigned to technicians who either started in or after 2012, or whose starting year is less than or equal to the combined total of starting years of technicians whose names end with "ell" and who started on or before 2013?
machine_repair
select t0.machine_id, t0.machine_series, t1.technician_id from machine as t0 join repair_assignment as t1 on t0.machine_id = t1.machine_id join technician as t2 on t1.technician_id = t2.technician_id, (select sum(starting_year) as c1 from technician where name like '%ell' and starting_year <= 2013.0) as t0 where t2.sta...
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.machine_id, t0.machine_series, t1.technician_id from machine as t0 join repair_assignment as t1 on t0.machine_id = t1.machine_id join technician as t2 on t1.technician_id = t2.technician_id, (select sum(starting_year) as c1 from technician where...
{ "index": 186, "split": "train" }
What are the activity IDs that student 1010 participates in that student 1028 does not? In other words, what activities are unique to student 1010 compared to student 1028?
activity_1
select t1.c1 - t0.c1 from (select actid as c1 from participates_in where stuid = 1010) as t1, (select actid as c1 from participates_in where stuid = 1028) 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": "activity_1", "sql": "select t1.c1 - t0.c1 from (select actid as c1 from participates_in where stuid = 1010) as t1, (select actid as c1 from participates_in where stuid = 1028) as t0" }, "style": "rule" }
{ "index": 3580, "split": "train" }
Is the highest student address ID associated with address ID 2 less than 15?
behavior_monitoring
select t0.c1 < 15 from (select max(t1.address_id) as c1 from addresses as t0 join students as t1 on t0.address_id = t1.address_id where t0.address_id = 2 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": "behavior_monitoring", "sql": "select t0.c1 < 15 from (select max(t1.address_id) as c1 from addresses as t0 join students as t1 on t0.address_id = t1.address_id where t0.address_id = 2 group by t0.address_id) as t0" }, "style": "rule" }
{ "index": 3329, "split": "train" }
Can you tell me the methods of getting there, attraction type codes, and names of all tourist attractions that tourist with ID 241 has not visited?
cre_Theme_park
select anon_1.c0, anon_1.c1, anon_1.c2 from (select how_to_get_there as c0, attraction_type_code as c1, name as c2 from tourist_attractions except select t0.how_to_get_there as c0, t0.attraction_type_code as c1, t0.name as c2 from tourist_attractions as t0 join visits as t1 on t0.tourist_attraction_id = t1.tourist_attr...
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_Theme_park", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select how_to_get_there as c0, attraction_type_code as c1, name as c2 from tourist_attractions except select t0.how_to_get_there as c0, t0.attraction_type_code as c1, t0.name as c2 from tourist_attractions as t...
{ "index": 1863, "split": "train" }
Can you tell me the attendance, park ID, team ID, and strikeouts for the team that appears most frequently in the database and has a name containing the letter "s"?
baseball_1
select t0.attendance, t0.park_id, t0.team_id, t1.so from home_game as t0 join team as t1 on t0.team_id = t1.team_id, (select team_id_br as c1 from team group by c1 order by count(*) desc limit 1) as t0 where t1.team_id_br = t0.c1 and t1.name like '%s%'
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": "baseball_1", "sql": "select t0.attendance, t0.park_id, t0.team_id, t1.so from home_game as t0 join team as t1 on t0.team_id = t1.team_id, (select team_id_br as c1 from team group by c1 order by count(*) desc limit 1) as t0 where t1.team_id_br = t0.c1 and t1.name like '%s%'" }, ...
{ "index": 1258, "split": "train" }
How many trains arrive at times other than 23:39?
railway
select count(*) from train where arrival != '23:39'
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": "railway", "sql": "select count(*) from train where arrival != '23:39'" }, "style": "rule" }
{ "index": 1038, "split": "train" }
What are the construction years and architect IDs of mills located in places that end with the letter "e"?
architecture
select built_year, architect_id from mill where location like '%e'
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 built_year, architect_id from mill where location like '%e'" }, "style": "rule" }
{ "index": 1416, "split": "train" }
Can you list the top three customer cards, including their card type and card number, where the transaction amount is either less than or equal to the total number of transactions made by account IDs up to 3 with card ID 7, or the transaction amount is exactly 1931.76? Sort the results by card type code, putting any wi...
customers_card_transactions
select t0.card_type_code as c2, t0.card_number from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id, (select count(transaction_amount) as c0 from financial_transactions where account_id <= 3 and card_id between 7 and 7) as t0 where t1.transaction_amount <= t0.c0 or t1.transaction_amou...
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 t0.card_type_code as c2, t0.card_number from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id, (select count(transaction_amount) as c0 from financial_transactions where account_id <= 3 and card_id betw...
{ "index": 2819, "split": "train" }
Where does characteristic ID 8 rank when ordered in descending order among characteristics with IDs between 2 and 11?
products_gen_characteristics
select t1.c5, t1.c0 as c3 from (select row_number() over (order by characteristic_id desc) as c5, product_id as c0 from product_characteristics where characteristic_id between 2 and 11) as t1 where c3 = 8
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 t1.c5, t1.c0 as c3 from (select row_number() over (order by characteristic_id desc) as c5, product_id as c0 from product_characteristics where characteristic_id between 2 and 11) as t1 where c3 = 8" }, "style": "rule" }
{ "index": 3497, "split": "train" }
Can you tell me the top 10 functional areas that have the most associated documents ending with "7"? For each, what are the total number of functional area descriptions, the number of unique functional area codes, and the total count of documents linked to them?
document_management
select count(t0.functional_area_description), count(distinct (t0.functional_area_code)), count(t1.document_code) as c2 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t1.document_code like '%7' order by c2 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": "document_management", "sql": "select count(t0.functional_area_description), count(distinct (t0.functional_area_code)), count(t1.document_code) as c2 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t1.docu...
{ "index": 2789, "split": "train" }
How many different nationalities are there for journalists who are either 43 years old or have ages starting with "2", grouped by their age?
news_report
select age as c1, count(distinct (nationality)) from journalist where c1 = 43 or c1 like '2%' 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": "news_report", "sql": "select age as c1, count(distinct (nationality)) from journalist where c1 = 43 or c1 like '2%' group by c1" }, "style": "rule" }
{ "index": 2654, "split": "train" }
Who are the students living in dorms where their city code either starts with "PH" or is the least common city code among all students? Please include their dorm name, gender, dorm id, and student id.
dorm_1
select t0.dorm_name, t0.gender, t1.dormid, t1.stuid from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid join student as t2 on t1.stuid = t2.stuid, (select city_code as c2 from student group by c2 order by count(*) asc nulls last limit 1) as t0 where t2.city_code like 'PH%' or t2.city_code = t0.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": "dorm_1", "sql": "select t0.dorm_name, t0.gender, t1.dormid, t1.stuid from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid join student as t2 on t1.stuid = t2.stuid, (select city_code as c2 from student group by c2 order by count(*) asc nulls last limit 1) as t0 where t2.c...
{ "index": 2099, "split": "train" }
What are the locations and associated porphyria of enzymes that interact with medicines containing the letter "e" in their names, excluding those enzymes linked to the most common medicine with a trade name ending in "olept"?
medicine_enzyme_interaction
select anon_1.c0, anon_1.c2 from (select t0.location as c0, t0.porphyria as c2 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id join medicine as t2 on t1.medicine_id = t2.id where t2.name like '%e' except select t0.location as c0, t0.porphyria as c2 from enzyme as t0 join medicine_enzyme...
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 anon_1.c0, anon_1.c2 from (select t0.location as c0, t0.porphyria as c2 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id join medicine as t2 on t1.medicine_id = t2.id where t2.name like '%e' except selec...
{ "index": 682, "split": "train" }
Can you tell me the program IDs, program names, broadcast program IDs, and channel IDs for programs aired on channels owned by companies or individuals whose names start with "Sh"?
program_share
select t0.program_id, t0.name, t1.program_id, t1.channel_id from program as t0 join broadcast as t1 on t0.program_id = t1.program_id join channel as t2 on t1.channel_id = t2.channel_id where t2.owner like 'Sh%'
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 t0.program_id, t0.name, t1.program_id, t1.channel_id from program as t0 join broadcast as t1 on t0.program_id = t1.program_id join channel as t2 on t1.channel_id = t2.channel_id where t2.owner like 'Sh%'" }, "style": "rule" }
{ "index": 449, "split": "train" }
How much did the number of unique researchers involved in projects with IDs of 1 or higher change in percentage from October 1981 to January 1991?
tracking_grants_for_research
select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select count(distinct (t1.staff_id)) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'researcher' and t1.date_from = '1981-10-09 21:32:53' and t1.project_id >= 1 group by t0.role_code) as t0, (select t0.role_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": "tracking_grants_for_research", "sql": "select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select count(distinct (t1.staff_id)) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'researcher' and t1.date_from = '1981-10-09 2...
{ "index": 3423, "split": "train" }
What are the three lowest maximum points for constructors with points either exactly 3.0 or more than 147.0, when sorted by their maximum points?
formula_1
select max(points) as c0 from constructorstandings where points = 3.0 or points > 147.0 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": "formula_1", "sql": "select max(points) as c0 from constructorstandings where points = 3.0 or points > 147.0 order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 2135, "split": "train" }
When did the property with the highest property ID have residents move in?
local_govt_and_lot
select t0.date_moved_in, t0.property_id as c0 from customer_events as t0, (select max(property_id) as c1 from customer_events) as t1 where c0 = t1.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": "local_govt_and_lot", "sql": "select t0.date_moved_in, t0.property_id as c0 from customer_events as t0, (select max(property_id) as c1 from customer_events) as t1 where c0 = t1.c1" }, "style": "rule" }
{ "index": 3786, "split": "train" }
How many trust relationships does user 6 have as the source?
epinions_1
select count(*) from trust where source_u_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": "epinions_1", "sql": "select count(*) from trust where source_u_id = 6" }, "style": "rule" }
{ "index": 2442, "split": "train" }
Did the validity period of card 11 start after the validity period of card 2?
customers_card_transactions
select t1.c2 > t0.c2 from (select date_valid_from as c2 from customers_cards where card_id = 11) as t1, (select date_valid_from 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_from as c2 from customers_cards where card_id = 11) as t1, (select date_valid_from as c2 from customers_cards where card_id = 2) as t0" }, "style": "rule" }
{ "index": 3080, "split": "train" }
Which are the three products with the fewest complaints from customers with IDs 118 or higher? Please provide their names and IDs, sorted by the number of complaints in ascending order. This version clearly asks for the products with the least complaints (bottom 3), includes necessary filters (customer IDs ≥ 118), and...
customer_complaints
select t0.product_name, t0.product_id as c1 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.customer_id >= 118 group by c1 order by count(*) 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": "customer_complaints", "sql": "select t0.product_name, t0.product_id as c1 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.customer_id >= 118 group by c1 order by count(*) asc nulls last limit 3" }, "style": "rule" }
{ "index": 546, "split": "train" }
Was the problem reported for problem 7 earlier than the problem reported for problem 9?
tracking_software_problems
select t1.c0 < t0.c0 from (select date_problem_reported as c0 from problems where problem_id = 7) as t1, (select date_problem_reported as c0 from problems where problem_id = 9) 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": "tracking_software_problems", "sql": "select t1.c0 < t0.c0 from (select date_problem_reported as c0 from problems where problem_id = 7) as t1, (select date_problem_reported as c0 from problems where problem_id = 9) as t0" }, "style": "rule" }
{ "index": 3154, "split": "train" }
Can you list the 10 climbers who are associated with the smallest mountain IDs, and for each, show their name, the number of times their name appears, the total number of countries they have climbed from, and the lowest mountain ID they've climbed? Sort the list so that those with the earliest mountain IDs appear first...
climbing
select name as c2, count(distinct (name)), count(country), min(mountain_id) as c3 from climber group by c2 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": "climbing", "sql": "select name as c2, count(distinct (name)), count(country), min(mountain_id) as c3 from climber group by c2 order by c3 asc nulls last limit 10" }, "style": "rule" }
{ "index": 1753, "split": "train" }
Which vehicles are used in both lesson 4 and lesson 10, and what are their details and IDs?
driving_school
select anon_1.c1, anon_1.c0 from (select t0.vehicle_details as c1, t0.vehicle_id as c0 from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id where t1.lesson_id = 4 intersect select t0.vehicle_details as c1, t0.vehicle_id as c0 from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id whe...
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 anon_1.c1, anon_1.c0 from (select t0.vehicle_details as c1, t0.vehicle_id as c0 from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id where t1.lesson_id = 4 intersect select t0.vehicle_details as c1, t0.vehicle_id as c0 from vehic...
{ "index": 2441, "split": "train" }
What are the payout amounts for claim headers with policies numbered 287 or higher and claims with amounts less than 672.06, ordered from smallest to largest payout?
insurance_and_eClaims
select amount_piad as c0 from claim_headers where policy_id >= 287 and amount_claimed < 672.06 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": "insurance_and_eClaims", "sql": "select amount_piad as c0 from claim_headers where policy_id >= 287 and amount_claimed < 672.06 order by c0 asc nulls last" }, "style": "rule" }
{ "index": 2845, "split": "train" }
Which shipment invoice number is the most recent among orders that either do not have any shipments or specifically belong to order number 6?
tracking_orders
select t0.invoice_number as c1 from shipments as t0 join orders as t1 on t0.order_id = t1.order_id where (not t1.order_id in (select t0.order_id as c0 from shipments)) or t1.order_id = 6 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": "tracking_orders", "sql": "select t0.invoice_number as c1 from shipments as t0 join orders as t1 on t0.order_id = t1.order_id where (not t1.order_id in (select t0.order_id as c0 from shipments)) or t1.order_id = 6 order by c1 desc limit 1" }, "style": "rule" }
{ "index": 1473, "split": "train" }
What is the percentage change in the average of the earliest detention record IDs for teachers with IDs less than 14 between the detention ending on February 25, 2018, and the detention ending on March 11, 2018?
behavior_monitoring
select (avg(t0.c1) / cast(avg(t1.c1) as real) - 1) * 100 from (select min(t1.teacher_id) as c1 from teachers as t0 join detention as t1 on t0.teacher_id = t1.teacher_id where t1.datetime_detention_end = '2018-03-11 12:58:40' and t1.teacher_id < 14 group by t0.teacher_id) as t0, (select t0.teacher_id, min(t1.teacher_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": "behavior_monitoring", "sql": "select (avg(t0.c1) / cast(avg(t1.c1) as real) - 1) * 100 from (select min(t1.teacher_id) as c1 from teachers as t0 join detention as t1 on t0.teacher_id = t1.teacher_id where t1.datetime_detention_end = '2018-03-11 12:58:40' and t1.teacher_id < 14 gr...
{ "index": 3004, "split": "train" }
How many days have passed between a customer's date of birth and the date they became a customer, for those with last names starting with "Terr"?
driving_school
select julianday(t1.c1) - julianday(t0.c0) from (select date_became_customer as c1 from customers where last_name like 'Terr%' and last_name like 'Terr%') as t1, (select date_of_birth as c0 from customers) 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": "driving_school", "sql": "select julianday(t1.c1) - julianday(t0.c0) from (select date_became_customer as c1 from customers where last_name like 'Terr%' and last_name like 'Terr%') as t1, (select date_of_birth as c0 from customers) as t0" }, "style": "rule" }
{ "index": 3705, "split": "train" }
Which are the top 10 buildings (by ID descending) including their ID, status, and name, along with the building IDs of offices where companies with assets between 192.8 and 268.5 billion dollars are located?
company_office
select t0.id as c1, t0.status, t0.name, t1.building_id from buildings as t0 join office_locations as t1 on t0.id = t1.building_id join companies as t2 on t1.company_id = t2.id where t2.assets_billion between 192.8 and 268.5 order by c1 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": "company_office", "sql": "select t0.id as c1, t0.status, t0.name, t1.building_id from buildings as t0 join office_locations as t1 on t0.id = t1.building_id join companies as t2 on t1.company_id = t2.id where t2.assets_billion between 192.8 and 268.5 order by c1 desc limit 10" },...
{ "index": 1239, "split": "train" }
According to the highest student ID among grades with points between 1.3 and 3.3, where does the 'D+' grade rank when sorted in ascending order?
college_3
select t1.c4, t1.c3 as c1 from (select row_number() over (order by t0.c0 asc nulls last) as c4, t0.c2 as c3 from (select t0.lettergrade as c2, max(t1.stuid) as c0 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t0.gradepoint between 1.3 and 3.3 group by c2) as t0) as t1 where 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": "college_3", "sql": "select t1.c4, t1.c3 as c1 from (select row_number() over (order by t0.c0 asc nulls last) as c4, t0.c2 as c3 from (select t0.lettergrade as c2, max(t1.stuid) as c0 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t0.gradepoin...
{ "index": 3467, "split": "train" }
Can you tell me the names and IDs of browsers, along with their associated browser IDs, that have been compatible since the most recent year, or later?
browser_web
select t0.name, t0.id, t1.browser_id from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id, (select max(compatible_since_year) as c0 from accelerator_compatible_browser) as t0 where t1.compatible_since_year >= t0.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": "browser_web", "sql": "select t0.name, t0.id, t1.browser_id from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id, (select max(compatible_since_year) as c0 from accelerator_compatible_browser) as t0 where t1.compatible_since_year >= t0.c0" }, "s...
{ "index": 347, "split": "train" }
What are the project IDs, end dates, role codes, and role descriptions for staff members whose role is listed as Project Leader?
tracking_grants_for_research
select distinct t0.project_id, t0.date_to, t0.role_code, t1.role_description as c2 from project_staff as t0 join staff_roles as t1 on t0.role_code = t1.role_code where c2 = 'Project Leader'
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 distinct t0.project_id, t0.date_to, t0.role_code, t1.role_description as c2 from project_staff as t0 join staff_roles as t1 on t0.role_code = t1.role_code where c2 = 'Project Leader'" }, "style": "rule" }
{ "index": 372, "split": "train" }
Retrieve the top three users with the highest minimum tweet IDs, along with their follower counts and user IDs, for users whose partition IDs are greater than the sum of partition IDs between 2 and 10 for user ID 7. List the results ordered by the highest minimum tweet ID.
twitter_1
select min(t0.uid) as c2, t1.followers, t1.uid as c0 from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid, (select sum(partitionid) as c3 from user_profiles where uid = 7 and partitionid between 2 and 10) as t0 where t1.partitionid > t0.c3 group by c0 order by c2 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": "twitter_1", "sql": "select min(t0.uid) as c2, t1.followers, t1.uid as c0 from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid, (select sum(partitionid) as c3 from user_profiles where uid = 7 and partitionid between 2 and 10) as t0 where t1.partitionid > t0.c3 group by c0...
{ "index": 203, "split": "train" }
Is the sum of the founding years of institutions located in building 3 less than 3879.0?
protein_institute
select t0.c1 < 3879.0 from (select sum(t1.founded) as c1 from building as t0 join institution as t1 on t0.building_id = t1.building_id where t0.building_id = 3 group by t0.building_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": "protein_institute", "sql": "select t0.c1 < 3879.0 from (select sum(t1.founded) as c1 from building as t0 join institution as t1 on t0.building_id = t1.building_id where t0.building_id = 3 group by t0.building_id) as t0" }, "style": "rule" }
{ "index": 3347, "split": "train" }
For the department with the lowest ID among those with a ranking of at least 2 or between 9 and 10, what are the Born State and Age of its head?
department_management
select t0.born_state, t0.age, t1.department_id as c2 from head as t0 join management as t1 on t0.head_id = t1.head_id join department as t2 on t1.department_id = t2.department_id where t2.ranking >= 2 or t2.ranking between 9 and 10 order by c2 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_management", "sql": "select t0.born_state, t0.age, t1.department_id as c2 from head as t0 join management as t1 on t0.head_id = t1.head_id join department as t2 on t1.department_id = t2.department_id where t2.ranking >= 2 or t2.ranking between 9 and 10 order by c2 asc ...
{ "index": 2247, "split": "train" }
Which star rating code and description ending with "ar" has the highest combined hotel price range in the park?
cre_Theme_park
select t0.star_rating_code as c0 from ref_hotel_star_ratings as t0 join hotels as t1 on t0.star_rating_code = t1.star_rating_code where t0.star_rating_description like '%ar' group by c0 order by sum(t1.price_range) 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": "cre_Theme_park", "sql": "select t0.star_rating_code as c0 from ref_hotel_star_ratings as t0 join hotels as t1 on t0.star_rating_code = t1.star_rating_code where t0.star_rating_description like '%ar' group by c0 order by sum(t1.price_range) desc limit 1" }, "style": "rule" }
{ "index": 271, "split": "train" }
What are the earliest and latest values of the highest draft pick numbers for players whose positions include the letter "e," grouped by country?
match_season
select min(t0.c1), max(t0.c1) from (select max(t1.draft_pick_number) as c1 from country as t0 join match_season as t1 on t0.country_id = t1.country where t1.position like '%e%' group by t0.country_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": "match_season", "sql": "select min(t0.c1), max(t0.c1) from (select max(t1.draft_pick_number) as c1 from country as t0 join match_season as t1 on t0.country_id = t1.country where t1.position like '%e%' group by t0.country_id) as t0" }, "style": "rule" }
{ "index": 3645, "split": "train" }
Can you tell me the Manufacturer ID, the year they opened, the number of their shops, and the number of factories for manufacturers that produce a 'Billiard table' or furniture with 'ch' somewhere in its name?
manufacturer
select anon_1.c0, anon_1.c2, anon_1.c1, anon_1.c3 from (select t0.manufacturer_id as c0, t0.open_year as c2, t0.num_of_shops as c1, t0.num_of_factories as c3 from manufacturer as t0 join furniture_manufacte as t1 on t0.manufacturer_id = t1.manufacturer_id join furniture as t2 on t1.furniture_id = t2.furniture_id where ...
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": "manufacturer", "sql": "select anon_1.c0, anon_1.c2, anon_1.c1, anon_1.c3 from (select t0.manufacturer_id as c0, t0.open_year as c2, t0.num_of_shops as c1, t0.num_of_factories as c3 from manufacturer as t0 join furniture_manufacte as t1 on t0.manufacturer_id = t1.manufacturer_id j...
{ "index": 2875, "split": "train" }
Which activity is student 1005 participating in?
activity_1
select t0.activity_name from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.stuid = 1005
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 from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.stuid = 1005" }, "style": "rule" }
{ "index": 2988, "split": "train" }
How many journalists have the ID of 8?
news_report
select count(*) from journalist where journalist_id = 8
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": "news_report", "sql": "select count(*) from journalist where journalist_id = 8" }, "style": "rule" }
{ "index": 1724, "split": "train" }
Which individuals born on July 4 have recorded heights, and what is the minimum height for each of them?
body_builder
select people_id as c0, min(height) from people where birth_date like 'July 4%' 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": "body_builder", "sql": "select people_id as c0, min(height) from people where birth_date like 'July 4%' group by c0" }, "style": "rule" }
{ "index": 1563, "split": "train" }
Which buildings, associated with companies having IDs 1 or 2, are characterized by their current status, number of stories, and their unique identifiers?
company_office
select t0.status, t0.stories, t0.id from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where t1.company_id = 1 or t1.company_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": "company_office", "sql": "select t0.status, t0.stories, t0.id from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where t1.company_id = 1 or t1.company_id = 2" }, "style": "rule" }
{ "index": 331, "split": "train" }
Which claim headers with policy IDs of 626 and 626 have an average claimed amount exceeding 789.19? For these claims, list their Claim Header IDs along with the average amount claimed, sorted by the Claim Header ID.
insurance_and_eClaims
select claim_header_id as c0, avg(amount_claimed) from claim_headers where policy_id between 626 and 626 group by c0 having avg(amount_claimed) > 789.19 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": "insurance_and_eClaims", "sql": "select claim_header_id as c0, avg(amount_claimed) from claim_headers where policy_id between 626 and 626 group by c0 having avg(amount_claimed) > 789.19 order by c0 asc nulls last" }, "style": "rule" }
{ "index": 2285, "split": "train" }
Can you tell me the airline IDs, countries, and names of the airlines with IDs 1351 and 4078, sorted from the highest to the lowest airline ID?
flight_4
select alid as c0, country, name from airlines where c0 = 1351 or c0 = 4078 order by c0 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": "flight_4", "sql": "select alid as c0, country, name from airlines where c0 = 1351 or c0 = 4078 order by c0 desc" }, "style": "rule" }
{ "index": 2538, "split": "train" }
Which gymnasts have their highest floor exercise score below 9.412, and what is each of their maximum scores?
gymnast
select gymnast_id as c0, max(floor_exercise_points) from gymnast group by c0 having max(floor_exercise_points) < 9.412
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": "gymnast", "sql": "select gymnast_id as c0, max(floor_exercise_points) from gymnast group by c0 having max(floor_exercise_points) < 9.412" }, "style": "rule" }
{ "index": 1317, "split": "train" }
What is the earliest launch year for each mission fate among ships listed in the database?
ship_mission
select fate as c0, min(launched_year) from mission where ship_id in (select ship_id as c2 from ship) 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": "ship_mission", "sql": "select fate as c0, min(launched_year) from mission where ship_id in (select ship_id as c2 from ship) group by c0" }, "style": "rule" }
{ "index": 1097, "split": "train" }
Which are the five colleges with the smallest enrollments, including their states and names, along with the names of the colleges where players with high school scores of 1200 or less participated, sorted from the lowest enrollment upwards?
soccer_2
select t0.enr as c3, t0.state, t0.cname, t1.cname from college as t0 join tryout as t1 on t0.cname = t1.cname join player as t2 on t1.pid = t2.pid where t2.hs <= 1200 order by c3 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": "soccer_2", "sql": "select t0.enr as c3, t0.state, t0.cname, t1.cname from college as t0 join tryout as t1 on t0.cname = t1.cname join player as t2 on t1.pid = t2.pid where t2.hs <= 1200 order by c3 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2083, "split": "train" }
Who are the three guests with the highest number of kids in their reservations? List their last names along with their maximum number of kids, sorted from the highest to the lowest.
inn_1
select lastname as c1, max(kids) as c0 from reservations group by c1 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": "inn_1", "sql": "select lastname as c1, max(kids) as c0 from reservations group by c1 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 1389, "split": "train" }
What is the maintenance contract ID for the asset with ID 11?
assets_maintenance
select maintenance_contract_id from assets where asset_id = 11
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 maintenance_contract_id from assets where asset_id = 11" }, "style": "rule" }
{ "index": 3355, "split": "train" }
Can you determine how much the total `reported_by_staff_id` for product 5 with problem description `'r'` differs from the highest total reported by staff across any product with `'r'` problems?
tracking_software_problems
select t2.c2 - t0.c3 from (select max(t1.c3) as c2 from (select sum(t1.reported_by_staff_id) as c3 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t1.problem_description = 'r' group by t0.product_id) as t1) as t2, (select t0.product_id, sum(t1.reported_by_staff_id) as c3 from product 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": "tracking_software_problems", "sql": "select t2.c2 - t0.c3 from (select max(t1.c3) as c2 from (select sum(t1.reported_by_staff_id) as c3 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t1.problem_description = 'r' group by t0.product_id) as t1) as t2,...
{ "index": 3179, "split": "train" }
Which five vehicles, along with their details and IDs, are associated with customers who paid using a method starting with "Dire," and what are the last names and birthdates of those customers? The list should be sorted in reverse alphabetical order of the vehicle details.
driving_school
select t0.vehicle_details as c3, t0.vehicle_id, t2.last_name, t2.date_of_birth from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id join customers as t2 on t1.customer_id = t2.customer_id join customer_payments as t3 on t2.customer_id = t3.customer_id where t3.payment_method_code like 'Dire%' order b...
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.vehicle_details as c3, t0.vehicle_id, t2.last_name, t2.date_of_birth from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id join customers as t2 on t1.customer_id = t2.customer_id join customer_payments as t3 on t2.customer_id =...
{ "index": 1178, "split": "train" }
How much does the total grant ID amount for research applications ('APP') sent on June 6, 2000, differ from that on January 28, 2014, when only considering grants with IDs less than 11 on the latter date?
tracking_grants_for_research
select t1.c0 - t0.c0 from (select sum(t1.grant_id) as c0 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'APP' and t1.sent_date = '2000-06-06 01:03:46' group by t0.document_type_code) as t1, (select t0.document_type_code, sum(t1.grant_id) as ...
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 t1.c0 - t0.c0 from (select sum(t1.grant_id) as c0 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'APP' and t1.sent_date = '2000-06-06 01:03:46' group by t0...
{ "index": 3528, "split": "train" }
What are the descriptions, codes, and units of measure for product categories that contain products with colors different from color code 1, but do not have any products with color code 4?
products_gen_characteristics
select anon_1.c3, anon_1.c0, anon_1.c2 from (select t0.product_category_description as c3, t0.product_category_code as c0, t0.unit_of_measure as c2 from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code where (not t1.color_code in (select color_code as c1 from ref_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": "products_gen_characteristics", "sql": "select anon_1.c3, anon_1.c0, anon_1.c2 from (select t0.product_category_description as c3, t0.product_category_code as c0, t0.unit_of_measure as c2 from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.produc...
{ "index": 1344, "split": "train" }
What are the resolution, genre, and country of songs performed by artists whose gender either starts with "Male" or ends with "Female"?
music_1
select t0.resolution, t0.genre_is, t0.country from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where t1.gender like 'Male%' or t1.gender like '%Female'
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.resolution, t0.genre_is, t0.country from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where t1.gender like 'Male%' or t1.gender like '%Female'" }, "style": "rule" }
{ "index": 1820, "split": "train" }
In the Problems table, how many unique problem descriptions are there, how many problem reports have been recorded, and what is the highest staff ID of the staff members who reported these problems?
tracking_software_problems
select count(distinct (problem_description)), count(date_problem_reported), max(reported_by_staff_id) from problems
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_software_problems", "sql": "select count(distinct (problem_description)), count(date_problem_reported), max(reported_by_staff_id) from problems" }, "style": "rule" }
{ "index": 959, "split": "train" }
For department 11, how many unique heads have a "temporary or acting" status starting with "N"? Please list the department ID along with this count, and sort the results by the number of such heads.
department_management
select department_id as c1, count(distinct (head_id)) from management where temporary_acting like 'N%' and c1 = 11 group by c1 order by count(temporary_acting) 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": "department_management", "sql": "select department_id as c1, count(distinct (head_id)) from management where temporary_acting like 'N%' and c1 = 11 group by c1 order by count(temporary_acting) asc nulls last" }, "style": "rule" }
{ "index": 617, "split": "train" }
Is the maximum author ID for author 5 higher than the maximum author ID for author 14 when considering only their courses in subjects with IDs up to 2?
e_learning
select t1.c2 > t0.c2 from (select max(t1.author_id) as c2 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t0.author_id = 14 and t1.subject_id <= 2 group by t0.author_id) as t1, (select t0.author_id, max(t1.author_id) as c2 from course_authors_and_tutors as t0 join courses as...
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 t1.c2 > t0.c2 from (select max(t1.author_id) as c2 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t0.author_id = 14 and t1.subject_id <= 2 group by t0.author_id) as t1, (select t0.author_id, max(t1.author_i...
{ "index": 3998, "split": "train" }
Who are the ten most recent students (by oldest to youngest) who are members of clubs located in the most common club location, and what are their student IDs, ages, and club IDs?
club_1
select t0.stuid, t0.age, t1.clubid as c0 from student as t0 join member_of_club as t1 on t0.stuid = t1.stuid join club as t2 on t1.clubid = t2.clubid, (select clublocation as c2 from club group by c2 order by count(*) desc limit 1) as t0 where t2.clublocation = t0.c2 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": "club_1", "sql": "select t0.stuid, t0.age, t1.clubid as c0 from student as t0 join member_of_club as t1 on t0.stuid = t1.stuid join club as t2 on t1.clubid = t2.clubid, (select clublocation as c2 from club group by c2 order by count(*) desc limit 1) as t0 where t2.clublocation = t...
{ "index": 179, "split": "train" }
What are the total invoice amounts, the average of customer IDs, and the customer IDs for the customers whose last names contain "mos," when grouped by customer, sorted by customer ID with nulls last, and showing only the bottom 3 results?
store_1
select sum(t0.total), avg(t0.customer_id), t1.id as c0 from invoices as t0 join customers as t1 on t0.customer_id = t1.id where t1.last_name like '%mos%' group by c0 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": "store_1", "sql": "select sum(t0.total), avg(t0.customer_id), t1.id as c0 from invoices as t0 join customers as t1 on t0.customer_id = t1.id where t1.last_name like '%mos%' group by c0 order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 2384, "split": "train" }
What are the descriptions, aircraft IDs, and aircraft names for the aircraft linked to airport ID 6, which has a transit passenger count between 50,889 and 156,246?
aircraft
select t0.description, t0.aircraft_id, t0.aircraft from aircraft as t0 join airport_aircraft as t1 on t0.aircraft_id = t1.aircraft_id join airport as t2 on t1.airport_id = t2.airport_id where t2.airport_id = 6 and t2.transit_passengers between 50889.0 and 156246.0
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 t0.description, t0.aircraft_id, t0.aircraft from aircraft as t0 join airport_aircraft as t1 on t0.aircraft_id = t1.aircraft_id join airport as t2 on t1.airport_id = t2.airport_id where t2.airport_id = 6 and t2.transit_passengers between 50889.0 and 15624...
{ "index": 2619, "split": "train" }
What are the total amount and total value of purchases, along with the supplier’s phone number, for the supplier with ID 2 whose phone number includes "83-283-47"?
department_store
select distinct t0.total_amount_purchased, t0.total_value_purchased, t1.supplier_phone as c1 from product_suppliers as t0 join suppliers as t1 on t0.supplier_id = t1.supplier_id where c1 like '%83-283-47%' and t1.supplier_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": "department_store", "sql": "select distinct t0.total_amount_purchased, t0.total_value_purchased, t1.supplier_phone as c1 from product_suppliers as t0 join suppliers as t1 on t0.supplier_id = t1.supplier_id where c1 like '%83-283-47%' and t1.supplier_id = 2" }, "style": "rule" ...
{ "index": 1532, "split": "train" }
Does the percentage change in the number of followers for user ID 1 at exactly 8:00 PM on March 9, 2018, exceed the overall percentage change in followers across all user profiles at that same time?
twitter_1
select t3.c2 > t1.c3 from (select abs((t0.followers / cast(t0.followers as real) - 1) * 100) as c2 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.createdate = '2018-03-09 20:00:14') as t3, (select abs((count(t0.followers) / cast(count(t0.followers) as real) - 1) * 100) 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": "twitter_1", "sql": "select t3.c2 > t1.c3 from (select abs((t0.followers / cast(t0.followers as real) - 1) * 100) as c2 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.createdate = '2018-03-09 20:00:14') as t3, (select abs((count(t0.followers)...
{ "index": 3874, "split": "train" }