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 is the change in the minimum teacher ID for teacher 3 between the same timestamp of April 15, 1978, at 4:49:18 AM?
behavior_monitoring
select t0.c1 - t0.c1 from (select min(t1.teacher_id) as c1 from teachers as t0 join assessment_notes as t1 on t0.teacher_id = t1.teacher_id where t0.teacher_id = 3 and t1.date_of_notes = '1978-04-15 04:49:18' group by t0.teacher_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 - t0.c1 from (select min(t1.teacher_id) as c1 from teachers as t0 join assessment_notes as t1 on t0.teacher_id = t1.teacher_id where t0.teacher_id = 3 and t1.date_of_notes = '1978-04-15 04:49:18' group by t0.teacher_id) as t0" }, "st...
{ "index": 3512, "split": "train" }
What are the age and starting year of the technician with ID 5?
machine_repair
select t0.age, t0.starting_year from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id where t1.technician_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": "machine_repair", "sql": "select t0.age, t0.starting_year from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id where t1.technician_id = 5" }, "style": "rule" }
{ "index": 2130, "split": "train" }
What are the campus, degree type, and year for degrees awarded at campuses with fees recorded before 2003?
csu_1
select t0.campus, t0.degrees, t0.year from degrees as t0 join campuses as t1 on t0.campus = t1.id join csu_fees as t2 on t1.id = t2.campus where t2.year < 2003
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": "csu_1", "sql": "select t0.campus, t0.degrees, t0.year from degrees as t0 join campuses as t1 on t0.campus = t1.id join csu_fees as t2 on t1.id = t2.campus where t2.year < 2003" }, "style": "rule" }
{ "index": 2085, "split": "train" }
What is the maximum price range among hotels with star rating 1 that have a price less than or equal to approximately 5,526,556.64?
cre_Theme_park
select t0.c2 from (select max(t1.price_range) as c2 from ref_hotel_star_ratings as t0 join hotels as t1 on t0.star_rating_code = t1.star_rating_code where t0.star_rating_code = 1 and t1.price_range <= 5526556.6412 group by t0.star_rating_code) 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": "cre_Theme_park", "sql": "select t0.c2 from (select max(t1.price_range) as c2 from ref_hotel_star_ratings as t0 join hotels as t1 on t0.star_rating_code = t1.star_rating_code where t0.star_rating_code = 1 and t1.price_range <= 5526556.6412 group by t0.star_rating_code) as t0" },...
{ "index": 3982, "split": "train" }
What are the top three operating companies, showing their type and id, along with their flight's company id and flight id, for flights arriving at airports located in cities ending with "ston" or exactly "Akureyri"? Please list the results sorted by company type in reverse alphabetical order.
flight_company
select t0.type as c1, t0.id, t1.company_id, t1.id from operate_company as t0 join flight as t1 on t0.id = t1.company_id join airport as t2 on t1.airport_id = t2.id where t2.city like '%ston' or t2.city = 'Akureyri' order by c1 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": "flight_company", "sql": "select t0.type as c1, t0.id, t1.company_id, t1.id from operate_company as t0 join flight as t1 on t0.id = t1.company_id join airport as t2 on t1.airport_id = t2.id where t2.city like '%ston' or t2.city = 'Akureyri' order by c1 desc limit 3" }, "style"...
{ "index": 2017, "split": "train" }
Which five log entry descriptions have an average assigned-to-staff ID greater than 10? List these descriptions along with their average assigned-to-staff IDs, sorted from the highest to the lowest.
tracking_software_problems
select log_entry_description as c1, avg(assigned_to_staff_id) as c0 from problem_log group by c1 having avg(assigned_to_staff_id) > 10 order by c0 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select log_entry_description as c1, avg(assigned_to_staff_id) as c0 from problem_log group by c1 having avg(assigned_to_staff_id) > 10 order by c0 desc limit 5" }, "style": "rule" }
{ "index": 1194, "split": "train" }
Which city and `y` value belong to the airport with the highest `y` among those whose routes start with "K" or end with "Z"?
flight_4
select t0.city, t0.y as c0 from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.src_ap like 'K%' or t1.src_ap like '%Z' 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": "flight_4", "sql": "select t0.city, t0.y as c0 from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.src_ap like 'K%' or t1.src_ap like '%Z' order by c0 desc limit 1" }, "style": "rule" }
{ "index": 2805, "split": "train" }
What are the first three products in the list, showing their Product IDs and names, ordered by Product ID?
tracking_software_problems
select product_id as c0, product_name from product order by c0 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select product_id as c0, product_name from product order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 1403, "split": "train" }
Show the submission IDs along with the count of distinct scores for each submission, where the college name includes the letter "a".
workshop_paper
select submission_id as c1, count(distinct (scores)) from submission where college like '%a%' 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": "workshop_paper", "sql": "select submission_id as c1, count(distinct (scores)) from submission where college like '%a%' group by c1" }, "style": "rule" }
{ "index": 96, "split": "train" }
What are the course IDs and names of courses that student 111 is enrolled in and that are also course 301?
student_assessment
select anon_1.c0, anon_1.c1 from (select t0.course_id as c0, t0.course_name as c1 from courses as t0 join student_course_registrations as t1 on t0.course_id = t1.course_id where t1.student_id = 111 intersect select t0.course_id as c0, t0.course_name as c1 from courses as t0 join student_course_registrations as t1 on t0...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select anon_1.c0, anon_1.c1 from (select t0.course_id as c0, t0.course_name as c1 from courses as t0 join student_course_registrations as t1 on t0.course_id = t1.course_id where t1.student_id = 111 intersect select t0.course_id as c0, t0.course_name a...
{ "index": 1126, "split": "train" }
Which colleges and their enrollment numbers are associated with the tryouts of player 50005 who has a high school score above 300? Also, what are the corresponding tryout college names and player IDs?
soccer_2
select t0.cname, t0.enr, t1.cname, t1.pid 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 > 300 and t2.pid = 50005
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.cname, t0.enr, t1.cname, t1.pid 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 > 300 and t2.pid = 50005" }, "style": "rule" }
{ "index": 1675, "split": "train" }
How many days passed between a student's enrollment date and their course completion date when the course was completed on March 4th, 2018 at 1:24:56 AM?
e_learning
select julianday(t1.c2) - julianday(t0.c1) from (select date_of_enrolment as c2 from student_course_enrolment where date_of_completion = '2018-03-04 01:24:56' and date_of_completion = '2018-03-04 01:24:56') as t1, (select date_of_completion as c1 from student_course_enrolment) 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": "e_learning", "sql": "select julianday(t1.c2) - julianday(t0.c1) from (select date_of_enrolment as c2 from student_course_enrolment where date_of_completion = '2018-03-04 01:24:56' and date_of_completion = '2018-03-04 01:24:56') as t1, (select date_of_completion as c1 from student...
{ "index": 3710, "split": "train" }
What is the address ID associated with customer 11?
customers_and_addresses
select address_id from customer_addresses where customer_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": "customers_and_addresses", "sql": "select address_id from customer_addresses where customer_id = 11" }, "style": "rule" }
{ "index": 3369, "split": "train" }
Which customers' names, the dates they became customers, and their IDs, along with the count of unique products they have ordered?
customers_and_addresses
select t0.customer_name, t0.date_became_customer, t0.customer_id as c3, count(distinct (t2.product_id)) from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id group by c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t0.customer_name, t0.date_became_customer, t0.customer_id as c3, count(distinct (t2.product_id)) from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id group b...
{ "index": 2171, "split": "train" }
Which activities involve students with IDs 1004 or 1017, and for each, what is its name, activity ID, and the smallest activity ID among those participations?
activity_1
select t0.activity_name, t0.actid as c2, min(t1.actid) from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.stuid = 1004 or t1.stuid = 1017 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": "activity_1", "sql": "select t0.activity_name, t0.actid as c2, min(t1.actid) from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.stuid = 1004 or t1.stuid = 1017 group by c2" }, "style": "rule" }
{ "index": 2867, "split": "train" }
Which active airline has the highest number of routes ending in airports with codes containing "E" or ending with "D", among those that have exactly five such routes? For that airline, what are its active status, name, airline ID, and the count of unique route IDs?
flight_4
select t0.active, t0.name, t0.alid as c3, count(distinct (t1.alid)) as c0 from airlines as t0 join routes as t1 on t0.alid = t1.alid where t1.dst_ap like '%E%' or t1.dst_ap like '%D' group by c3 having count(*) = 5 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": "flight_4", "sql": "select t0.active, t0.name, t0.alid as c3, count(distinct (t1.alid)) as c0 from airlines as t0 join routes as t1 on t0.alid = t1.alid where t1.dst_ap like '%E%' or t1.dst_ap like '%D' group by c3 having count(*) = 5 order by c0 desc limit 1" }, "style": "rul...
{ "index": 1547, "split": "train" }
For students whose last name ends with "el" and who have an email address containing a period, what is the total number of behavior incidents they have had, along with their student IDs?
behavior_monitoring
select sum(t0.student_id), t1.student_id as c0 from behavior_incident as t0 join students as t1 on t0.student_id = t1.student_id where t1.last_name like '%el' and t1.email_address like '%.%' 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": "behavior_monitoring", "sql": "select sum(t0.student_id), t1.student_id as c0 from behavior_incident as t0 join students as t1 on t0.student_id = t1.student_id where t1.last_name like '%el' and t1.email_address like '%.%' group by c0" }, "style": "rule" }
{ "index": 457, "split": "train" }
Which amenities are associated with dorms that currently have no amenities listed, and what amenities does dorm 109 have?
dorm_1
select anon_1.c0, anon_1.c2 from (select t0.amenid as c0, t0.amenity_name as c2 from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid join dorm as t2 on t1.dormid = t2.dormid join lives_in as t3 on t2.dormid = t3.dormid where (not t3.dormid in (select dormid from has_amenity)) union select t0.amenid 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": "dorm_1", "sql": "select anon_1.c0, anon_1.c2 from (select t0.amenid as c0, t0.amenity_name as c2 from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid join dorm as t2 on t1.dormid = t2.dormid join lives_in as t3 on t2.dormid = t3.dormid where (not t3.dormid in (...
{ "index": 1390, "split": "train" }
How many days passed between the date an asset was acquired (specifically for asset models containing "94 kg") and the date it was disposed?
assets_maintenance
select julianday(t1.c0) - julianday(t0.c1) from (select asset_disposed_date as c0 from assets) as t1, (select asset_acquired_date as c1 from assets where asset_model like '%94 kg' and asset_model like '%94 kg') as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select julianday(t1.c0) - julianday(t0.c1) from (select asset_disposed_date as c0 from assets) as t1, (select asset_acquired_date as c1 from assets where asset_model like '%94 kg' and asset_model like '%94 kg') as t0" }, "style": "rule" }
{ "index": 3673, "split": "train" }
Show the first three editors (by their ID), along with the number of work entries of type 'Title' they have contributed and how many unique editor IDs are associated with work type 'Title' for each.
journal_committee
select editor_id as c1, count(*), count(distinct (editor_id)) from journal_committee where work_type = 'Title' group by c1 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": "journal_committee", "sql": "select editor_id as c1, count(*), count(distinct (editor_id)) from journal_committee where work_type = 'Title' group by c1 order by c1 asc nulls last limit 3" }, "style": "rule" }
{ "index": 2860, "split": "train" }
Which drivers associated with schools having IDs 4 or 7, along with their political parties, driver IDs, the number of years they've been working with those schools, and the school IDs?
school_bus
select t0.party, t0.driver_id, t1.years_working, t1.school_id from driver as t0 join school_bus as t1 on t0.driver_id = t1.driver_id join school as t2 on t1.school_id = t2.school_id where t2.school_id = 4 or t2.school_id = 7
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "school_bus", "sql": "select t0.party, t0.driver_id, t1.years_working, t1.school_id from driver as t0 join school_bus as t1 on t0.driver_id = t1.driver_id join school as t2 on t1.school_id = t2.school_id where t2.school_id = 4 or t2.school_id = 7" }, "style": "rule" }
{ "index": 2543, "split": "train" }
What are the top three campus fees, campus names, and years, along with their locations, for campuses with faculty members valued at 670.9 and years up to 2004, sorted by location in reverse alphabetical order?
csu_1
select t0.campusfee, t0.campus, t0.year, t1.location as c3 from csu_fees as t0 join campuses as t1 on t0.campus = t1.id join faculty as t2 on t1.id = t2.campus where t2.faculty = 670.9 and t2.year <= 2004 order by c3 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": "csu_1", "sql": "select t0.campusfee, t0.campus, t0.year, t1.location as c3 from csu_fees as t0 join campuses as t1 on t0.campus = t1.id join faculty as t2 on t1.id = t2.campus where t2.faculty = 670.9 and t2.year <= 2004 order by c3 desc limit 3" }, "style": "rule" }
{ "index": 1727, "split": "train" }
Who is the employee assigned as support representative for the customer whose phone number is either +44 020 7707 0707 or ends with 7000, and what is that customer's country? Please provide the result for the most recent country in reverse alphabetical order.
store_1
select t0.title, t1.country as c1 from employees as t0 join customers as t1 on t0.id = t1.support_rep_id where t1.phone = '+44 020 7707 0707' or t1.phone like '%7000' 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": "store_1", "sql": "select t0.title, t1.country as c1 from employees as t0 join customers as t1 on t0.id = t1.support_rep_id where t1.phone = '+44 020 7707 0707' or t1.phone like '%7000' order by c1 desc limit 1" }, "style": "rule" }
{ "index": 996, "split": "train" }
Does customer 2's active from date come before customer 13's active from date?
customers_and_addresses
select t1.c2 < t0.c2 from (select active_from_date as c2 from customer_contact_channels where customer_id = 2) as t1, (select active_from_date as c2 from customer_contact_channels where customer_id = 13) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t1.c2 < t0.c2 from (select active_from_date as c2 from customer_contact_channels where customer_id = 2) as t1, (select active_from_date as c2 from customer_contact_channels where customer_id = 13) as t0" }, "style": "rule" }
{ "index": 3123, "split": "train" }
What are the unique individual IDs and the most recent dates they contacted organizations, according to the contact records?
e_government
select distinct individual_id, date_contact_to from organization_contact_individuals
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_government", "sql": "select distinct individual_id, date_contact_to from organization_contact_individuals" }, "style": "rule" }
{ "index": 1848, "split": "train" }
What is the smallest service ID for the service with ID 6 among customers with IDs less than 12?
e_government
select t0.c2 from (select min(t1.service_id) as c2 from services as t0 join party_services as t1 on t0.service_id = t1.service_id where t0.service_id = 6 and t1.customer_id < 12 group by t0.service_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": "e_government", "sql": "select t0.c2 from (select min(t1.service_id) as c2 from services as t0 join party_services as t1 on t0.service_id = t1.service_id where t0.service_id = 6 and t1.customer_id < 12 group by t0.service_id) as t0" }, "style": "rule" }
{ "index": 3971, "split": "train" }
Are the CMI cross-reference IDs associated with council tax ID 10 greater than those associated with council tax ID 9?
local_govt_mdm
select t1.c1 > t0.c1 from (select cmi_cross_ref_id as c1 from parking_fines where council_tax_id = 10) as t1, (select cmi_cross_ref_id as c1 from parking_fines where council_tax_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": "local_govt_mdm", "sql": "select t1.c1 > t0.c1 from (select cmi_cross_ref_id as c1 from parking_fines where council_tax_id = 10) as t1, (select cmi_cross_ref_id as c1 from parking_fines where council_tax_id = 9) as t0" }, "style": "rule" }
{ "index": 3550, "split": "train" }
Does the OMIM number of the enzyme with ID 1 fall below the average OMIM value of all enzymes whose OMIM is 125,270 or higher?
medicine_enzyme_interaction
select t2.c2 < t1.c3 from (select omim as c2 from enzyme where id = 1) as t2, (select avg(omim) as c3 from enzyme where omim >= 125270) as t1
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 t2.c2 < t1.c3 from (select omim as c2 from enzyme where id = 1) as t2, (select avg(omim) as c3 from enzyme where omim >= 125270) as t1" }, "style": "rule" }
{ "index": 3316, "split": "train" }
What is the average problem ID, along with its description and ID, for the problem reported between late October 1970 and mid-June 1971 that has the fewest associated log entries?
tracking_software_problems
select avg(t0.problem_id), t1.problem_description, t1.problem_id as c0 from problem_log as t0 join problems as t1 on t0.problem_id = t1.problem_id where t1.date_problem_reported between '1970-10-27 16:35:34' and '1971-06-15 02:50:52' group by c0 order by count(*) asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select avg(t0.problem_id), t1.problem_description, t1.problem_id as c0 from problem_log as t0 join problems as t1 on t0.problem_id = t1.problem_id where t1.date_problem_reported between '1970-10-27 16:35:34' and '1971-06-15 02:50:52' group by ...
{ "index": 1, "split": "train" }
Which five customers have the lowest maximum order IDs, along with their names and addresses, among those whose highest product ID in their orders is less than 15? The results should be sorted by their maximum order ID in ascending order.
customers_and_products_contacts
select max(t0.order_id) as c1, t2.customer_name, t2.customer_address from order_items as t0 join customer_orders as t1 on t0.order_id = t1.order_id join customers as t2 on t1.customer_id = t2.customer_id group by t2.customer_id having max(t0.product_id) < 15 order by c1 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": "customers_and_products_contacts", "sql": "select max(t0.order_id) as c1, t2.customer_name, t2.customer_address from order_items as t0 join customer_orders as t1 on t0.order_id = t1.order_id join customers as t2 on t1.customer_id = t2.customer_id group by t2.customer_id having max...
{ "index": 1570, "split": "train" }
Which church has the most recent name in reverse alphabetical order, and what is the total number of times it appears, the sum of its opening dates, and the number of organizers associated with it?
wedding
select name as c0, count(*), sum(open_date), count(organized_by) from church group by c0 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": "wedding", "sql": "select name as c0, count(*), sum(open_date), count(organized_by) from church group by c0 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 2958, "split": "train" }
How many days passed between the order date and the actual delivery date for orders placed on or before July 3, 2000, at 9:41:50 PM?
cre_Drama_Workshop_Groups
select julianday(t1.c1) - julianday(t0.c3) from (select actual_delivery_date as c1 from customer_orders where order_date <= '2000-07-03 21:41:50' and order_date <= '2000-07-03 21:41:50') as t1, (select order_date as c3 from customer_orders) 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": "cre_Drama_Workshop_Groups", "sql": "select julianday(t1.c1) - julianday(t0.c3) from (select actual_delivery_date as c1 from customer_orders where order_date <= '2000-07-03 21:41:50' and order_date <= '2000-07-03 21:41:50') as t1, (select order_date as c3 from customer_orders) as ...
{ "index": 3684, "split": "train" }
Which are the five allergies that start with "Egg" or are "Anchovies," each affecting no more than 1013 students, along with the count of unique students affected, sorted in reverse alphabetical order?
allergy_1
select allergy as c1, count(distinct (stuid)) from has_allergy where c1 like 'Egg%' or c1 = 'Anchovies' group by c1 having count(distinct (stuid)) <= 1013 order by c1 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "allergy_1", "sql": "select allergy as c1, count(distinct (stuid)) from has_allergy where c1 like 'Egg%' or c1 = 'Anchovies' group by c1 having count(distinct (stuid)) <= 1013 order by c1 desc limit 5" }, "style": "rule" }
{ "index": 570, "split": "train" }
Can you tell me the smallest catalog level number, along with the publisher and publication date, for catalogs whose total product price in euros exceeds 458.45? Please sort these catalogs by their lowest level number and show me the first three results.
product_catalog
select min(t0.catalog_level_number) as c1, t2.catalog_publisher, t2.date_of_publication from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number join catalogs as t2 on t1.catalog_id = t2.catalog_id group by t2.catalog_id having sum(t0.price_in_euros) > 458.45 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": "product_catalog", "sql": "select min(t0.catalog_level_number) as c1, t2.catalog_publisher, t2.date_of_publication from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number join catalogs as t2 on t1.catalog_id = t2.catalog_id gro...
{ "index": 182, "split": "train" }
Which inventory entries have rentals with inventory IDs less than 4509 and also with inventory IDs greater than or equal to 3952? Please list their Inventory IDs and Film IDs.
sakila_1
select anon_1.c1, anon_1.c0 from (select t0.inventory_id as c1, t0.film_id as c0 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t1.inventory_id < 4509 intersect select t0.inventory_id as c1, t0.film_id as c0 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id w...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "sakila_1", "sql": "select anon_1.c1, anon_1.c0 from (select t0.inventory_id as c1, t0.film_id as c0 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t1.inventory_id < 4509 intersect select t0.inventory_id as c1, t0.film_id as c0 from inventory as ...
{ "index": 1347, "split": "train" }
What are the date of the most recent order, the customer ID, the order item ID, and the order ID for products whose names end with "k"?
tracking_orders
select t0.date_order_placed as c0, t0.customer_id, t1.order_item_id, t1.order_id from orders as t0 join order_items as t1 on t0.order_id = t1.order_id join products as t2 on t1.product_id = t2.product_id where t2.product_name like '%k' 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": "tracking_orders", "sql": "select t0.date_order_placed as c0, t0.customer_id, t1.order_item_id, t1.order_id from orders as t0 join order_items as t1 on t0.order_id = t1.order_id join products as t2 on t1.product_id = t2.product_id where t2.product_name like '%k' order by c0 desc l...
{ "index": 2919, "split": "train" }
Can you tell me the five shipping agents whose codes start with "F" or "U," listed from Z to A, based on the shipping agent code?
cre_Doc_Control_Systems
select t0.shipping_agent_code as c0 from ref_shipping_agents as t0 join documents as t1 on t0.shipping_agent_code = t1.shipping_agent_code where t1.shipping_agent_code like 'F%' or t1.shipping_agent_code like 'U%' order by c0 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Control_Systems", "sql": "select t0.shipping_agent_code as c0 from ref_shipping_agents as t0 join documents as t1 on t0.shipping_agent_code = t1.shipping_agent_code where t1.shipping_agent_code like 'F%' or t1.shipping_agent_code like 'U%' order by c0 desc limit 5" }, ...
{ "index": 486, "split": "train" }
What is the percentage change of the maximum user ID for user 5 who posted a tweet ending with "yfriend." at the specific time 2018-03-12 02:30:30 compared to itself?
twitter_1
select (t0.c0 / cast(t0.c0 as real) - 1) * 100 from (select max(t1.uid) as c0 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 5 and t1.createdate = '2018-03-12 02:30:30' and t1.text like '%yfriend.' group by t0.uid) 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": "twitter_1", "sql": "select (t0.c0 / cast(t0.c0 as real) - 1) * 100 from (select max(t1.uid) as c0 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 5 and t1.createdate = '2018-03-12 02:30:30' and t1.text like '%yfriend.' group by t0.uid) as t0" }, "...
{ "index": 3432, "split": "train" }
What are the color codes and typical selling prices for products whose descriptions start with "reru"?
products_gen_characteristics
select t0.color_code, t1.typical_selling_price from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.product_description like 'reru%'
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 t0.color_code, t1.typical_selling_price from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.product_description like 'reru%'" }, "style": "rule" }
{ "index": 2881, "split": "train" }
Is the total sum of inventory ID 3213 from rental records greater than the total number of unique summed inventory IDs across all inventory items?
sakila_1
select t2.c1 > t1.c3 from (select sum(t1.inventory_id) as c1 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t0.inventory_id = 3213 group by t0.inventory_id) as t2, (select count(distinct (t0.c1)) as c3 from (select sum(t1.inventory_id) as c1 from inventory as t0 join rental as t1 on t...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "sakila_1", "sql": "select t2.c1 > t1.c3 from (select sum(t1.inventory_id) as c1 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t0.inventory_id = 3213 group by t0.inventory_id) as t2, (select count(distinct (t0.c1)) as c3 from (select sum(t1.inve...
{ "index": 3280, "split": "train" }
What is the smallest customer ID, the total number of booking start dates, and the count of unique booking end dates for bookings that have a payment type starting with "Direct" or exactly equal to "Check"?
products_for_hire
select min(t0.customer_id), count(t0.booking_start_date), count(distinct (t0.booking_end_date)) from bookings as t0 join payments as t1 on t0.booking_id = t1.booking_id where t1.payment_type_code like 'Direct%' or t1.payment_type_code = 'Check'
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 min(t0.customer_id), count(t0.booking_start_date), count(distinct (t0.booking_end_date)) from bookings as t0 join payments as t1 on t0.booking_id = t1.booking_id where t1.payment_type_code like 'Direct%' or t1.payment_type_code = 'Check'" }, ...
{ "index": 2402, "split": "train" }
How many days passed between the start and end dates of the address history for addresses with IDs between 10 and 13?
customers_and_products_contacts
select julianday(t1.c2) - julianday(t0.c0) from (select date_to as c2 from customer_address_history) as t1, (select date_from as c0 from customer_address_history where address_id between 10 and 13 and address_id between 10 and 13) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select julianday(t1.c2) - julianday(t0.c0) from (select date_to as c2 from customer_address_history) as t1, (select date_from as c0 from customer_address_history where address_id between 10 and 13 and address_id between 10 and 13) as t0" ...
{ "index": 3870, "split": "train" }
Which discipline enrollments—showing discipline, campus, undergraduate counts, and year—are from campuses that have awarded more than 147 degrees?
csu_1
select anon_1.c1, anon_1.c3, anon_1.c2, anon_1.c0 from (select discipline as c1, campus as c3, undergraduate as c2, year as c0 from discipline_enrollments except select t0.discipline as c1, t0.campus as c3, t0.undergraduate as c2, t0.year as c0 from discipline_enrollments as t0 join campuses as t1 on t0.campus = t1.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": "csu_1", "sql": "select anon_1.c1, anon_1.c3, anon_1.c2, anon_1.c0 from (select discipline as c1, campus as c3, undergraduate as c2, year as c0 from discipline_enrollments except select t0.discipline as c1, t0.campus as c3, t0.undergraduate as c2, t0.year as c0 from discipline_enr...
{ "index": 282, "split": "train" }
Does Zach's friendship year occur after the total number of unique years that are greater than or equal to 6?
network_2
select t2.c1 > t1.c0 from (select year as c1 from personfriend where name = 'Zach') as t2, (select count(distinct (year)) as c0 from personfriend where year >= 6) as t1
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 t2.c1 > t1.c0 from (select year as c1 from personfriend where name = 'Zach') as t2, (select count(distinct (year)) as c0 from personfriend where year >= 6) as t1" }, "style": "rule" }
{ "index": 3278, "split": "train" }
How many devices in stock have a quantity of 56 or less, or have the lowest stock quantity across all devices?
device
select count(t0.device_id) from stock as t0, (select min(quantity) as c0 from stock) as t0 where t0.quantity <= 56 or t0.quantity = 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": "device", "sql": "select count(t0.device_id) from stock as t0, (select min(quantity) as c0 from stock) as t0 where t0.quantity <= 56 or t0.quantity = t0.c0" }, "style": "rule" }
{ "index": 2418, "split": "train" }
Which are the top 10 inventory counts in terms of unique inventory IDs, along with the total store IDs, when sorted by the number of unique inventory IDs?
sakila_1
select count(distinct (inventory_id)) as c1, sum(store_id) from inventory 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": "sakila_1", "sql": "select count(distinct (inventory_id)) as c1, sum(store_id) from inventory order by c1 desc limit 10" }, "style": "rule" }
{ "index": 2949, "split": "train" }
Did the order with ID 13 occur before the order with ID 10?
department_store
select t1.c0 < t0.c0 from (select order_date as c0 from customer_orders where order_id = 13) as t1, (select order_date as c0 from customer_orders where order_id = 10) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select t1.c0 < t0.c0 from (select order_date as c0 from customer_orders where order_id = 13) as t1, (select order_date as c0 from customer_orders where order_id = 10) as t0" }, "style": "rule" }
{ "index": 3129, "split": "train" }
Which exhibitions have records from December 12, but do not have any attendance of 13,142 or more on that date? For these exhibitions, what are the ticket prices and their IDs?
theme_gallery
select anon_1.c1, anon_1.c0 from (select t0.ticket_price as c1, t0.exhibition_id as c0 from exhibition as t0 join exhibition_record as t1 on t0.exhibition_id = t1.exhibition_id where t1.date = 'December 12' except select t0.ticket_price as c1, t0.exhibition_id as c0 from exhibition as t0 join exhibition_record as t1 on...
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": "theme_gallery", "sql": "select anon_1.c1, anon_1.c0 from (select t0.ticket_price as c1, t0.exhibition_id as c0 from exhibition as t0 join exhibition_record as t1 on t0.exhibition_id = t1.exhibition_id where t1.date = 'December 12' except select t0.ticket_price as c1, t0.exhibitio...
{ "index": 908, "split": "train" }
For people, what are the ages and parties of the ten youngest affirmative supporters in debates held at venues starting with "Abu Dha" and occurring in December 2017, along with the number of negative supporters in those debates?
debate
select t0.age as c1, t0.party, t1.negative from people as t0 join debate_people as t1 on t0.people_id = t1.affirmative join debate as t2 on t1.debate_id = t2.debate_id where t2.date like '%1, 2017' and t2.venue like 'Abu Dha%' order by c1 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "debate", "sql": "select t0.age as c1, t0.party, t1.negative from people as t0 join debate_people as t1 on t0.people_id = t1.affirmative join debate as t2 on t1.debate_id = t2.debate_id where t2.date like '%1, 2017' and t2.venue like 'Abu Dha%' order by c1 asc nulls last limit 10"...
{ "index": 1450, "split": "train" }
How much smaller is the minimum author ID for subject 2 compared to the highest minimum author ID among courses authored by author 12 across all subjects?
e_learning
select t2.c3 - t0.c2 from (select max(t1.c2) as c3 from (select min(t1.author_id) as c2 from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.author_id = 12 group by t0.subject_id) as t1) as t2, (select t0.subject_id, min(t1.author_id) as c2 from subjects as t0 join courses as t1 on t0.subjec...
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 t2.c3 - t0.c2 from (select max(t1.c2) as c3 from (select min(t1.author_id) as c2 from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.author_id = 12 group by t0.subject_id) as t1) as t2, (select t0.subject_id, min(t1.author_...
{ "index": 3170, "split": "train" }
Which airlines operate routes to France, and what are their countries and whether they are currently active?
flight_4
select t0.country, t0.active, t1.alid from airlines as t0 join routes as t1 on t0.alid = t1.alid where t1.dst_ap = 'FR'
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 t0.country, t0.active, t1.alid from airlines as t0 join routes as t1 on t0.alid = t1.alid where t1.dst_ap = 'FR'" }, "style": "rule" }
{ "index": 2456, "split": "train" }
How many days are there between the start date of a booking and its end date?
products_for_hire
select julianday(t1.c0) - julianday(t0.c2) from (select booking_start_date as c0 from bookings) as t1, (select booking_end_date as c2 from bookings where c2 = '2018-02-01 16:39:13' and c2 = '2018-02-01 16:39:13') as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select julianday(t1.c0) - julianday(t0.c2) from (select booking_start_date as c0 from bookings) as t1, (select booking_end_date as c2 from bookings where c2 = '2018-02-01 16:39:13' and c2 = '2018-02-01 16:39:13') as t0" }, "style": "rule" }
{ "index": 3734, "split": "train" }
How many days are there between each employee's hire date and their birth date for those employees hired after August 14, 2002?
store_1
select julianday(t1.c0) - julianday(t0.c2) from (select hire_date as c0 from employees) as t1, (select birth_date as c2 from employees where hire_date > '2002-08-14 00:00:00' and hire_date > '2002-08-14 00:00:00') as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select julianday(t1.c0) - julianday(t0.c2) from (select hire_date as c0 from employees) as t1, (select birth_date as c2 from employees where hire_date > '2002-08-14 00:00:00' and hire_date > '2002-08-14 00:00:00') as t0" }, "style": "rule" }
{ "index": 3741, "split": "train" }
What is the smallest prominence and how many countries have mountains in the most common mountain range?
climbing
select min(t0.prominence), count(t0.country) from mountain as t0, (select range as c2 from mountain group by c2 order by count(*) desc limit 1) as t0 where t0.range = 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": "climbing", "sql": "select min(t0.prominence), count(t0.country) from mountain as t0, (select range as c2 from mountain group by c2 order by count(*) desc limit 1) as t0 where t0.range = t0.c2" }, "style": "rule" }
{ "index": 1177, "split": "train" }
For each state and county in the address records where the town or city ends with "nland", how many buildings are listed at each location?
e_government
select state_province_county as c0, count(line_1_number_building) from addresses where town_city like '%nland' 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": "e_government", "sql": "select state_province_county as c0, count(line_1_number_building) from addresses where town_city like '%nland' group by c0" }, "style": "rule" }
{ "index": 763, "split": "train" }
Is the publication date of the catalog with ID 1 earlier than the publication date of the catalog with ID 6?
product_catalog
select t1.c2 < t0.c2 from (select date_of_publication as c2 from catalogs where catalog_id = 1) as t1, (select date_of_publication as c2 from catalogs where catalog_id = 6) 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": "product_catalog", "sql": "select t1.c2 < t0.c2 from (select date_of_publication as c2 from catalogs where catalog_id = 1) as t1, (select date_of_publication as c2 from catalogs where catalog_id = 6) as t0" }, "style": "rule" }
{ "index": 3138, "split": "train" }
Is the cross-reference ID for council tax ID 8 in the benefits overpayments table less than 83?
local_govt_mdm
select cmi_cross_ref_id < 83 from benefits_overpayments where council_tax_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": "local_govt_mdm", "sql": "select cmi_cross_ref_id < 83 from benefits_overpayments where council_tax_id = 8" }, "style": "rule" }
{ "index": 3342, "split": "train" }
What is the difference between the highest minimum number of bikes available across stations with at least 25 docks and the minimum number of bikes available at station 25?
bike_1
select t2.c0 - t0.c2 from (select max(t1.c2) as c0 from (select min(t1.bikes_available) as c2 from station as t0 join status as t1 on t0.id = t1.station_id where t0.dock_count >= 25 group by t0.id) as t1) as t2, (select t0.id, min(t1.bikes_available) as c2 from station as t0 join status as t1 on t0.id = t1.station_id w...
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 t2.c0 - t0.c2 from (select max(t1.c2) as c0 from (select min(t1.bikes_available) as c2 from station as t0 join status as t1 on t0.id = t1.station_id where t0.dock_count >= 25 group by t0.id) as t1) as t2, (select t0.id, min(t1.bikes_available) as c2 from s...
{ "index": 3160, "split": "train" }
What are the course codes and classrooms for classes taught by departments with the fewest total courses, or departments whose school code includes "A&SC"?
college_1
select t0.crs_code, t0.class_room 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(*) asc nulls last limit 1) as t0 where t2.school_code = t0.c2 or t2.school_code like '%A&SC%'
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.crs_code, t0.class_room 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(*) asc nulls last limit 1) as t0 where t2....
{ "index": 332, "split": "train" }
Can you list the top 10 restaurant types, showing their descriptions, IDs, and names, along with the restaurant IDs and their type IDs for restaurants with IDs of 2 or higher? Sort the list in reverse alphabetical order based on the restaurant type descriptions.
restaurant_1
select t0.restypedescription as c2, t0.restypeid, t0.restypename, t1.resid, t1.restypeid from restaurant_type as t0 join type_of_restaurant as t1 on t0.restypeid = t1.restypeid join restaurant as t2 on t1.resid = t2.resid join visits_restaurant as t3 on t2.resid = t3.resid where t3.resid >= 2 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": "restaurant_1", "sql": "select t0.restypedescription as c2, t0.restypeid, t0.restypename, t1.resid, t1.restypeid from restaurant_type as t0 join type_of_restaurant as t1 on t0.restypeid = t1.restypeid join restaurant as t2 on t1.resid = t2.resid join visits_restaurant as t3 on t2....
{ "index": 1625, "split": "train" }
Which mountains have photos taken with camera lenses with IDs greater than 5 and photo ID 6, and what are their prominence, IDs, and the smallest mountain ID among them?
mountain_photos
select t0.prominence, t0.id as c2, min(t1.mountain_id) from mountain as t0 join photos as t1 on t0.id = t1.mountain_id where t1.camera_lens_id > 5 and t1.id = 6 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": "mountain_photos", "sql": "select t0.prominence, t0.id as c2, min(t1.mountain_id) from mountain as t0 join photos as t1 on t0.id = t1.mountain_id where t1.camera_lens_id > 5 and t1.id = 6 group by c2" }, "style": "rule" }
{ "index": 753, "split": "train" }
Which away teams and game IDs have at least one injury accident, for games with IDs of 8 or higher?
game_injury
select t0.away_team, t0.id as c2, count(t1.game_id) from game as t0 join injury_accident as t1 on t0.id = t1.game_id where t1.game_id >= 8 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": "game_injury", "sql": "select t0.away_team, t0.id as c2, count(t1.game_id) from game as t0 join injury_accident as t1 on t0.id = t1.game_id where t1.game_id >= 8 group by c2" }, "style": "rule" }
{ "index": 671, "split": "train" }
What was the percentage change in the number of unique staff members with the researcher role on 1991-01-11 compared to a previous point in time?
tracking_grants_for_research
select (t0.c1 / cast(t0.c1 as real) - 1) * 100 from (select count(distinct (t1.staff_id)) as c1 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 = '1991-01-11 16:57:50' group by t0.role_code) 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_grants_for_research", "sql": "select (t0.c1 / cast(t0.c1 as real) - 1) * 100 from (select count(distinct (t1.staff_id)) as c1 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 = '1991-01-11 1...
{ "index": 3839, "split": "train" }
For each performance location, what are the lowest attendance figures and the number of unique hosts whose names include "tlanta Thrasher"? List the top five locations with the most performances, sorted from the most to the least performances.
performance_attendance
select location as c1, min(attendance), count(distinct (host)) from performance where host like '%tlanta Thrasher%' group by c1 order by count(performance_id) desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "performance_attendance", "sql": "select location as c1, min(attendance), count(distinct (host)) from performance where host like '%tlanta Thrasher%' group by c1 order by count(performance_id) desc limit 5" }, "style": "rule" }
{ "index": 1825, "split": "train" }
Which five stadiums have the lowest average attendance, along with their number of home games, capacity percentage, and total injured games, sorted by increasing average attendance?
game_injury
select t0.average_attendance as c3, t0.home_games, t0.capacity_percentage, sum(t2.game_id) from stadium as t0 join game as t1 on t0.id = t1.stadium_id join injury_accident as t2 on t1.id = t2.game_id group by t0.id 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": "game_injury", "sql": "select t0.average_attendance as c3, t0.home_games, t0.capacity_percentage, sum(t2.game_id) from stadium as t0 join game as t1 on t0.id = t1.stadium_id join injury_accident as t2 on t1.id = t2.game_id group by t0.id order by c3 asc nulls last limit 5" }, ...
{ "index": 1277, "split": "train" }
What are the three most recent document statuses, including their descriptions and codes, along with the receipt dates, for documents whose types start with "f" or "b"? The results should be ordered by document status code from highest to lowest.
cre_Doc_Control_Systems
select t0.document_status_description, t0.document_status_code, t1.receipt_date, t1.document_status_code as c0 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code join ref_document_types as t2 on t1.document_type_code = t2.document_type_code where t2.document_type_de...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Control_Systems", "sql": "select t0.document_status_description, t0.document_status_code, t1.receipt_date, t1.document_status_code as c0 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code join ref_document_types as t2 ...
{ "index": 2591, "split": "train" }
Which five stadiums with names containing "um" and capacities at least 95.3% have hosted the fewest number of games, and what is the total number of seasons for each?
game_injury
select count(t0.stadium_id) as c1, sum(t0.season), t1.id as c2 from game as t0 join stadium as t1 on t0.stadium_id = t1.id where t1.capacity_percentage >= 95.3 and t1.name like '%um%' group by c2 order by c1 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": "game_injury", "sql": "select count(t0.stadium_id) as c1, sum(t0.season), t1.id as c2 from game as t0 join stadium as t1 on t0.stadium_id = t1.id where t1.capacity_percentage >= 95.3 and t1.name like '%um%' group by c2 order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 932, "split": "train" }
How many invoices were issued between March 7th and March 19th of 2018?
customers_and_invoices
select count(invoice_number) as c0 from invoices where invoice_date between '2018-03-07 02:04:32' and '2018-03-19 22:38:10' order by c0 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select count(invoice_number) as c0 from invoices where invoice_date between '2018-03-07 02:04:32' and '2018-03-19 22:38:10' order by c0 asc nulls last" }, "style": "rule" }
{ "index": 2363, "split": "train" }
Can you list the number of floors, height in feet, and building IDs for buildings that have a building ID of 3 or end with the digit '5'?
protein_institute
select t0.floors, t0.height_feet, t0.building_id, t1.building_id as c2 from building as t0 join institution as t1 on t0.building_id = t1.building_id where c2 = 3 or c2 like '%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": "protein_institute", "sql": "select t0.floors, t0.height_feet, t0.building_id, t1.building_id as c2 from building as t0 join institution as t1 on t0.building_id = t1.building_id where c2 = 3 or c2 like '%5'" }, "style": "rule" }
{ "index": 1774, "split": "train" }
For each furniture manufacturer, what are the top 10 highest prices in dollars and the total number of products they produce, ordered by their manufacturer ID?
manufacturer
select manufacturer_id as c0, max(price_in_dollar), count(manufacturer_id) from furniture_manufacte group by c0 order by c0 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": "manufacturer", "sql": "select manufacturer_id as c0, max(price_in_dollar), count(manufacturer_id) from furniture_manufacte group by c0 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 1777, "split": "train" }
Who are the top 3 governors based on the total number of years they served, for parties where the sum of election years is 2002 or earlier?
election
select governor as c0 from party group by c0 having sum(year) <= 2002.0 order by sum(year) 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": "election", "sql": "select governor as c0 from party group by c0 having sum(year) <= 2002.0 order by sum(year) desc limit 3" }, "style": "rule" }
{ "index": 2307, "split": "train" }
Which ten hometowns, listed in reverse alphabetical order, have the highest count of unique members whose names contain "am" or whose names are not among branch names, grouped by hometown?
shop_membership
select hometown as c0, count(distinct (member_id)) from member where name like '%am%' or (not name in (select name as c1 from branch)) group by c0 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": "shop_membership", "sql": "select hometown as c0, count(distinct (member_id)) from member where name like '%am%' or (not name in (select name as c1 from branch)) group by c0 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 2357, "split": "train" }
Which ten machine series have the highest number of distinct machines, and for each, what is the minimum value point and the total number of records?
machine_repair
select machine_series as c0, count(*), min(value_points), count(distinct (machine_id)) as c2 from machine group by c0 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": "machine_repair", "sql": "select machine_series as c0, count(*), min(value_points), count(distinct (machine_id)) as c2 from machine group by c0 order by c2 desc limit 10" }, "style": "rule" }
{ "index": 326, "split": "train" }
How much more credits does course 659 have compared to the course with the fewest credits in departments whose names end with "Accounting"?
college_2
select t2.c0 - t0.c2 from (select min(credits) as c0 from course where dept_name like '%Accounting') as t2, (select credits as c2 from course where course_id = 659) 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": "college_2", "sql": "select t2.c0 - t0.c2 from (select min(credits) as c0 from course where dept_name like '%Accounting') as t2, (select credits as c2 from course where course_id = 659) as t0" }, "style": "rule" }
{ "index": 3183, "split": "train" }
What are the first 10 contact staff IDs for engineer visits, where the contact staff ID is less than or equal to the total number of unique contact staff IDs, and the engineer ID is greater than the smallest engineer ID? List these contact staff IDs ordered by staff ID.
assets_maintenance
select t0.contact_staff_id as c1 from engineer_visits as t0 join staff as t1 on t0.contact_staff_id = t1.staff_id, (select count(distinct (contact_staff_id)) as c2 from engineer_visits) as t1, (select min(engineer_id) as c0 from engineer_visits) as t0 where c1 <= t1.c2 and t0.engineer_id > t0.c0 order by t1.staff_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": "assets_maintenance", "sql": "select t0.contact_staff_id as c1 from engineer_visits as t0 join staff as t1 on t0.contact_staff_id = t1.staff_id, (select count(distinct (contact_staff_id)) as c2 from engineer_visits) as t1, (select min(engineer_id) as c0 from engineer_visits) as t0...
{ "index": 226, "split": "train" }
What is the percentage change in the number of incident types, based on the highest student ID involved, comparing incidents that started on April 23, 2017, to those that started on May 25, 2017, considering only incidents that lasted until or after March 10, 2018?
behavior_monitoring
select (count(t0.c0) / cast(count(t1.c0) as real) - 1) * 100 from (select max(t1.student_id) as c0 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t1.date_incident_start = '2017-04-23 07:03:17' and t1.date_incident_end >= '2018-03-10 21:12:22' group by 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 (count(t0.c0) / cast(count(t1.c0) as real) - 1) * 100 from (select max(t1.student_id) as c0 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t1.date_incident_start = '2017-04-23 0...
{ "index": 3881, "split": "train" }
How does lesson 9 rank when the lessons are ordered by staff ID from smallest to largest?
driving_school
select t1.c1, t1.c3 as c4 from (select row_number() over (order by staff_id asc nulls last) as c1, lesson_id as c3 from lessons) as t1 where c4 = 9
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select t1.c1, t1.c3 as c4 from (select row_number() over (order by staff_id asc nulls last) as c1, lesson_id as c3 from lessons) as t1 where c4 = 9" }, "style": "rule" }
{ "index": 3482, "split": "train" }
What is the difference in the number of unique tweets posted by user 1 between March 9, 2018, at 8:00 PM and March 12, 2018, at 2:30 AM?
twitter_1
select t1.c1 - t0.c1 from (select count(distinct (t1.id)) as c1 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' group by t0.uid) as t1, (select t0.uid, count(distinct (t1.id)) as c1 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid 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": "twitter_1", "sql": "select t1.c1 - t0.c1 from (select count(distinct (t1.id)) as c1 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' group by t0.uid) as t1, (select t0.uid, count(distinct (t1.id)) as c1 from ...
{ "index": 3534, "split": "train" }
Which students' ages, city codes, and last names are there who do not have the allergy to wheat?
allergy_1
select anon_1.c2, anon_1.c0, anon_1.c1 from (select age as c2, city_code as c0, lname as c1 from student except select t0.age as c2, t0.city_code as c0, t0.lname as c1 from student as t0 join has_allergy as t1 on t0.stuid = t1.stuid join allergy_type as t2 on t1.allergy = t2.allergy where t2.allergy = 'Wheat') as anon_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "allergy_1", "sql": "select anon_1.c2, anon_1.c0, anon_1.c1 from (select age as c2, city_code as c0, lname as c1 from student except select t0.age as c2, t0.city_code as c0, t0.lname as c1 from student as t0 join has_allergy as t1 on t0.stuid = t1.stuid join allergy_type as t2 on ...
{ "index": 1553, "split": "train" }
What is the average customer ID in lessons for customer number 8?
driving_school
select t0.c1 from (select avg(t1.customer_id) as c1 from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 8 group by t0.customer_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": "driving_school", "sql": "select t0.c1 from (select avg(t1.customer_id) as c1 from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 8 group by t0.customer_id) as t0" }, "style": "rule" }
{ "index": 3377, "split": "train" }
correctly reflects that the SQL finds companies with the most common type and reports their names along with the count of distinct group equity shareholdings. It avoids confusing references to "least common" and maintains clarity and natural language flow.
flight_company
select t0.name as c0, count(distinct (t0.group_equity_shareholding)) from operate_company as t0, (select type as c1 from operate_company group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.type = t0.c1 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": "flight_company", "sql": "select t0.name as c0, count(distinct (t0.group_equity_shareholding)) from operate_company as t0, (select type as c1 from operate_company group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.type = t0.c1 group by c0" }, "style": "rule" ...
{ "index": 2087, "split": "train" }
What is the numerical difference between the lowest amenity ID overall and each of the amenities assigned to dorm 117?
dorm_1
select t2.c0 - t0.c3 from (select min(amenid) as c0 from has_amenity) as t2, (select amenid as c3 from has_amenity where dormid = 117) 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": "dorm_1", "sql": "select t2.c0 - t0.c3 from (select min(amenid) as c0 from has_amenity) as t2, (select amenid as c3 from has_amenity where dormid = 117) as t0" }, "style": "rule" }
{ "index": 3189, "split": "train" }
Show the types and names of artworks along with the festival IDs for the first ten nominations linked to festivals chaired by Lucy Lu or with chairs whose names contain "For", sorted by festival ID.
entertainment_awards
select t0.type, t0.name, t1.festival_id as c0 from artwork as t0 join nomination as t1 on t0.artwork_id = t1.artwork_id join festival_detail as t2 on t1.festival_id = t2.festival_id where t2.chair_name = 'Lucy Lu' or t2.chair_name like '%For%' order by c0 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": "entertainment_awards", "sql": "select t0.type, t0.name, t1.festival_id as c0 from artwork as t0 join nomination as t1 on t0.artwork_id = t1.artwork_id join festival_detail as t2 on t1.festival_id = t2.festival_id where t2.chair_name = 'Lucy Lu' or t2.chair_name like '%For%' order...
{ "index": 1915, "split": "train" }
Can you list the studios and directors of films that either have a market ID of 2 or are available in countries whose names include the letter "A"?
film_rank
select anon_1.c1, anon_1.c0 from (select t0.studio as c1, t0.director as c0 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id join market as t2 on t1.market_id = t2.market_id where t2.market_id = 2 union select t0.studio as c1, t0.director as c0 from film as t0 join film_market_estimation 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": "film_rank", "sql": "select anon_1.c1, anon_1.c0 from (select t0.studio as c1, t0.director as c0 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id join market as t2 on t1.market_id = t2.market_id where t2.market_id = 2 union select t0.studio as c1, t0.di...
{ "index": 2405, "split": "train" }
What are the first five organization and individual IDs for contacts involving organizations with ID 3 or 4, listed in order of the least recent or future contact date?
e_government
select organization_id as c0, individual_id from organization_contact_individuals where c0 = 3 or c0 = 4 order by date_contact_to 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": "e_government", "sql": "select organization_id as c0, individual_id from organization_contact_individuals where c0 = 3 or c0 = 4 order by date_contact_to asc nulls last limit 5" }, "style": "rule" }
{ "index": 642, "split": "train" }
Can you tell me the number of hosts, the year they first occurred, the theme, location, and ID for each party, excluding those parties that have hosts whose ages include the digit "7"?
party_host
select anon_1.c4, anon_1.c1, anon_1.c2, anon_1.c3, anon_1.c0 from (select number_of_hosts as c4, first_year as c1, party_theme as c2, location as c3, party_id as c0 from party except select t0.number_of_hosts as c4, t0.first_year as c1, t0.party_theme as c2, t0.location as c3, t0.party_id as c0 from party as t0 join pa...
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_host", "sql": "select anon_1.c4, anon_1.c1, anon_1.c2, anon_1.c3, anon_1.c0 from (select number_of_hosts as c4, first_year as c1, party_theme as c2, location as c3, party_id as c0 from party except select t0.number_of_hosts as c4, t0.first_year as c1, t0.party_theme as c2, ...
{ "index": 2733, "split": "train" }
What are the publisher, name, and ID of catalogs at the most rare catalog level that has a level name including "Category"?
product_catalog
select distinct t0.catalog_publisher, t0.catalog_name, t1.catalog_id from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id, (select catalog_level_number as c3 from catalog_structure group by c3 order by count(*) asc nulls last limit 1) as t0 where t1.catalog_level_number = t0.c3 and t1.catal...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select distinct t0.catalog_publisher, t0.catalog_name, t1.catalog_id from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id, (select catalog_level_number as c3 from catalog_structure group by c3 order by count(*) asc nulls last...
{ "index": 1115, "split": "train" }
On what date did the booking with the highest refund amount start?
products_for_hire
select t0.booking_start_date, t0.amount_of_refund as c0 from bookings as t0, (select max(amount_of_refund) as c2 from bookings) as t1 where c0 = t1.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": "products_for_hire", "sql": "select t0.booking_start_date, t0.amount_of_refund as c0 from bookings as t0, (select max(amount_of_refund) as c2 from bookings) as t1 where c0 = t1.c2" }, "style": "rule" }
{ "index": 3790, "split": "train" }
Does the expiration date of card 14 come before the expiration date of card 11?
customers_card_transactions
select t1.c2 < t0.c2 from (select date_valid_to as c2 from customers_cards where card_id = 14) as t1, (select date_valid_to as c2 from customers_cards where card_id = 11) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select t1.c2 < t0.c2 from (select date_valid_to as c2 from customers_cards where card_id = 14) as t1, (select date_valid_to as c2 from customers_cards where card_id = 11) as t0" }, "style": "rule" }
{ "index": 3127, "split": "train" }
Can you list the OMIM numbers, porphyria details, and enzyme IDs for enzymes that interact with medicines whose trade names start with 'Fana'?
medicine_enzyme_interaction
select anon_1.c1, anon_1.c0, anon_1.c2 from (select omim as c1, porphyria as c0, id as c2 from enzyme intersect select t0.omim as c1, t0.porphyria as c0, t0.id 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.trade_name like 'F...
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.c1, anon_1.c0, anon_1.c2 from (select omim as c1, porphyria as c0, id as c2 from enzyme intersect select t0.omim as c1, t0.porphyria as c0, t0.id as c2 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzym...
{ "index": 1589, "split": "train" }
Find the ages of members whose names start with "Breton, Robe," and list the three youngest ages in order of their purchase time, showing the earliest purchases first.
coffee_shop
select age from member where name like 'Breton, Robe%' order by time_of_purchase 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": "coffee_shop", "sql": "select age from member where name like 'Breton, Robe%' order by time_of_purchase asc nulls last limit 3" }, "style": "rule" }
{ "index": 2703, "split": "train" }
Looking at orders placed on or after March 23, 2018, what is the order date and customer ID of the customer with the highest customer ID?
customers_and_addresses
select t0.order_date, t0.customer_id as c2 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where order_date >= '2018-03-23 06:25:41') 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": "customers_and_addresses", "sql": "select t0.order_date, t0.customer_id as c2 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where order_date >= '2018-03-23 06:25:41') as t1 where c2 = t1.c3" }, "style": "rule" }
{ "index": 3754, "split": "train" }
What is the percentage change in the smallest average customer ID for customers with email addresses containing "e" between the order on February 2nd and the order on February 26th?
department_store
select (min(t0.c1) / cast(min(t1.c1) as real) - 1) * 100 from (select avg(t1.customer_id) as c1 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t1.order_date = '2018-02-26 05:34:18' and t0.customer_email like '%e%' group by t0.customer_id) as t0, (select t0.customer_id, avg(t1.c...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select (min(t0.c1) / cast(min(t1.c1) as real) - 1) * 100 from (select avg(t1.customer_id) as c1 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t1.order_date = '2018-02-26 05:34:18' and t0.customer_email like '%e...
{ "index": 3028, "split": "train" }
Is the cmi cross reference id for council tax id 10 higher than the maximum cmi cross reference id equal to 4?
local_govt_mdm
select t2.c2 > t1.c0 from (select cmi_cross_ref_id as c2 from parking_fines where council_tax_id = 10) as t2, (select max(cmi_cross_ref_id) as c0 from parking_fines where cmi_cross_ref_id between 4 and 4) as t1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_mdm", "sql": "select t2.c2 > t1.c0 from (select cmi_cross_ref_id as c2 from parking_fines where council_tax_id = 10) as t2, (select max(cmi_cross_ref_id) as c0 from parking_fines where cmi_cross_ref_id between 4 and 4) as t1" }, "style": "rule" }
{ "index": 3277, "split": "train" }
Which customers have both completed lessons (lesson status code ending with "d") and are listed with their email address, date they became customers, and first name?
driving_school
select anon_1.c1, anon_1.c0, anon_1.c2 from (select t0.email_address as c1, t0.date_became_customer as c0, t0.first_name as c2 from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t1.lesson_status_code like '%d' intersect select t0.email_address as c1, t0.date_became_customer as c0, t0.first...
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, anon_1.c2 from (select t0.email_address as c1, t0.date_became_customer as c0, t0.first_name as c2 from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t1.lesson_status_code like '%d' intersect selec...
{ "index": 1944, "split": "train" }
What are the names and employee IDs of the three highest-paid employees who are either associated with aircraft number 3 or haven't participated in any flights?
flight_1
select t0.name from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.aid = 3 or (not t1.aid in (select flight.aid as c0 from flight)) order by t0.salary 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": "flight_1", "sql": "select t0.name from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.aid = 3 or (not t1.aid in (select flight.aid as c0 from flight)) order by t0.salary desc limit 3" }, "style": "rule" }
{ "index": 2235, "split": "train" }
Which claim amounts and their corresponding claim header IDs are associated with the policy ID 125 or belong to the most frequently used policy type?
insurance_and_eClaims
select anon_1.c0, anon_1.c1 from (select t0.amount_claimed as c0, t0.claim_header_id as c1 from claim_headers as t0 join policies as t1 on t0.policy_id = t1.policy_id where t1.policy_id = 125 union select t0.amount_claimed as c0, t0.claim_header_id as c1 from claim_headers as t0 join policies as t1 on t0.policy_id = t1...
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 anon_1.c0, anon_1.c1 from (select t0.amount_claimed as c0, t0.claim_header_id as c1 from claim_headers as t0 join policies as t1 on t0.policy_id = t1.policy_id where t1.policy_id = 125 union select t0.amount_claimed as c0, t0.claim_header_id...
{ "index": 2503, "split": "train" }
Which staff member in department 3 has the gender that appears last when sorted in reverse, and what is their name and gender?
department_store
select t0.staff_name, t0.staff_gender as c1 from staff as t0 join staff_department_assignments as t1 on t0.staff_id = t1.staff_id where t1.department_id = 3 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": "department_store", "sql": "select t0.staff_name, t0.staff_gender as c1 from staff as t0 join staff_department_assignments as t1 on t0.staff_id = t1.staff_id where t1.department_id = 3 order by c1 desc limit 1" }, "style": "rule" }
{ "index": 210, "split": "train" }
How many days passed between the enrollment date and the completion date for courses that were completed on or before March 4, 2018, at 01:24:56?
e_learning
select julianday(t1.c2) - julianday(t0.c1) from (select date_of_completion as c2 from student_course_enrolment where c2 <= '2018-03-04 01:24:56' and c2 <= '2018-03-04 01:24:56') as t1, (select date_of_enrolment as c1 from student_course_enrolment) 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": "e_learning", "sql": "select julianday(t1.c2) - julianday(t0.c1) from (select date_of_completion as c2 from student_course_enrolment where c2 <= '2018-03-04 01:24:56' and c2 <= '2018-03-04 01:24:56') as t1, (select date_of_enrolment as c1 from student_course_enrolment) as t0" },...
{ "index": 3860, "split": "train" }
What are the SSNs and names of scientists, along with the project they are assigned to, for projects whose name ends with "Extracting Apple Juice with Pectinase"?
scientist_1
select t0.ssn, t0.name, t1.project from scientists as t0 join assignedto as t1 on t0.ssn = t1.scientist join projects as t2 on t1.project = t2.code where t2.name like '% Extracting Apple Juice with Pectinase'
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": "scientist_1", "sql": "select t0.ssn, t0.name, t1.project from scientists as t0 join assignedto as t1 on t0.ssn = t1.scientist join projects as t2 on t1.project = t2.code where t2.name like '% Extracting Apple Juice with Pectinase'" }, "style": "rule" }
{ "index": 108, "split": "train" }