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
Which are the top five members, listed by name in alphabetical order, who participated in the most-attended performance held at a location ending with "en", along with their roles?
performance_attendance
select t0.role, t0.name as c2 from member as t0 join member_attendance as t1 on t0.member_id = t1.member_id join performance as t2 on t1.performance_id = t2.performance_id, (select performance_id as c1 from performance group by c1 order by count(*) desc limit 1) as t0 where t2.location like '%en' and t2.performance_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": "performance_attendance", "sql": "select t0.role, t0.name as c2 from member as t0 join member_attendance as t1 on t0.member_id = t1.member_id join performance as t2 on t1.performance_id = t2.performance_id, (select performance_id as c1 from performance group by c1 order by count(*...
{ "index": 536, "split": "train" }
Among transactions linked to lots with IDs of 3 or higher, what are the amounts of the first three transactions when ordered by transaction type code alphabetically?
tracking_share_transactions
select t0.amount_of_transaction from transactions as t0 join transactions_lots as t1 on t0.transaction_id = t1.transaction_id where t1.lot_id >= 3 or t1.lot_id = 3 order by t0.transaction_type_code 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_share_transactions", "sql": "select t0.amount_of_transaction from transactions as t0 join transactions_lots as t1 on t0.transaction_id = t1.transaction_id where t1.lot_id >= 3 or t1.lot_id = 3 order by t0.transaction_type_code asc nulls last limit 3" }, "style": "rul...
{ "index": 2890, "split": "train" }
Which five countries are associated with addresses linked to customers who either have the most common mobile phone number or the specific mobile number 577-584-4864, when listings are sorted by postcode in alphabetical order?
driving_school
select t0.country from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id, (select cell_mobile_phone_number as c0 from customers group by c0 order by count(*) desc limit 1) as t0 where t1.cell_mobile_phone_number = t0.c0 or t1.cell_mobile_phone_number = '577-584-4864' order by t0.zip_postcod...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.country from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id, (select cell_mobile_phone_number as c0 from customers group by c0 order by count(*) desc limit 1) as t0 where t1.cell_mobile_phone_number = t0.c0 or t1....
{ "index": 1552, "split": "train" }
Show the first 10 journal themes sorted alphabetically, with any missing themes listed last.
journal_committee
select theme as c0 from journal 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": "journal_committee", "sql": "select theme as c0 from journal order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 1423, "split": "train" }
How many different payment dates are there for each payment type, and what is the smallest amount paid for each payment type?
products_for_hire
select payment_type_code as c1, count(distinct (payment_date)), min(amount_paid) from payments group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select payment_type_code as c1, count(distinct (payment_date)), min(amount_paid) from payments group by c1" }, "style": "rule" }
{ "index": 190, "split": "train" }
For each person they are friends with, what is the average year the friendships started, and list the friends in alphabetical order?
network_2
select avg(year) from personfriend group by friend order by friend 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": "network_2", "sql": "select avg(year) from personfriend group by friend order by friend asc nulls last" }, "style": "rule" }
{ "index": 1443, "split": "train" }
How has the parent organization of organization 8 changed from July 17, 2016, to December 28, 2017?
local_govt_and_lot
select t1.c2 - t0.c2 from (select t0.parent_organization_id as c2 from organizations as t0 join things as t1 on t0.organization_id = t1.organization_id join timed_status_of_things as t2 on t1.thing_id = t2.thing_id where t0.organization_id = 8 and t2.date_and_date = '2016-07-17 08:35:27') as t1, (select t0.parent_organ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t1.c2 - t0.c2 from (select t0.parent_organization_id as c2 from organizations as t0 join things as t1 on t0.organization_id = t1.organization_id join timed_status_of_things as t2 on t1.thing_id = t2.thing_id where t0.organization_id = 8 and t2....
{ "index": 3521, "split": "train" }
Show the IDs, aircraft IDs, airports IDs, and aircraft descriptions for matches held at Swan River, Perth, or locations starting with "Flamengo".
aircraft
select t0.id, t0.aircraft_id, t0.airport_id, t1.aircraft_id, t1.description from airport_aircraft as t0 join aircraft as t1 on t0.aircraft_id = t1.aircraft_id join match as t2 on t1.aircraft_id = t2.winning_aircraft where t2.location = 'Swan River , Perth' or t2.location like 'Flamengo%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "aircraft", "sql": "select t0.id, t0.aircraft_id, t0.airport_id, t1.aircraft_id, t1.description from airport_aircraft as t0 join aircraft as t1 on t0.aircraft_id = t1.aircraft_id join match as t2 on t1.aircraft_id = t2.winning_aircraft where t2.location = 'Swan River , Perth' or t...
{ "index": 944, "split": "train" }
Is the resolution of "My Love" lower than the resolution of "Just Beat It"?
music_1
select t1.c0 < t0.c0 from (select resolution as c0 from song where song_name = 'Just beat it') as t1, (select resolution as c0 from song where song_name = 'My love') 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": "music_1", "sql": "select t1.c0 < t0.c0 from (select resolution as c0 from song where song_name = 'Just beat it') as t1, (select resolution as c0 from song where song_name = 'My love') as t0" }, "style": "rule" }
{ "index": 3570, "split": "train" }
List the locations and names of all clubs, including those that have at least one female student member.
club_1
select anon_1.c0, anon_1.c1 from (select clublocation as c0, clubname as c1 from club union select t0.clublocation as c0, t0.clubname as c1 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid join student as t2 on t1.stuid = t2.stuid where t2.sex = 'F') as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "club_1", "sql": "select anon_1.c0, anon_1.c1 from (select clublocation as c0, clubname as c1 from club union select t0.clublocation as c0, t0.clubname as c1 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid join student as t2 on t1.stuid = t2.stuid where t2.sex =...
{ "index": 480, "split": "train" }
How does the product with a Page Per Minute Color rating of 4 rank when the products are sorted from highest to lowest in that category?
store_product
select t1.c4, t1.c3 as c5 from (select row_number() over (order by pages_per_minute_color desc) as c4, product_id as c3 from product) as t1 where c5 = 4
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select t1.c4, t1.c3 as c5 from (select row_number() over (order by pages_per_minute_color desc) as c4, product_id as c3 from product) as t1 where c5 = 4" }, "style": "rule" }
{ "index": 3505, "split": "train" }
What are the country, airline name, whether the airline is active, and destination airport code for airlines that have routes ending with airports whose codes start with "K"?
flight_4
select t0.country, t0.name, t0.active, t1.dst_ap as c2 from airlines as t0 join routes as t1 on t0.alid = t1.alid where c2 like 'K%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t0.country, t0.name, t0.active, t1.dst_ap as c2 from airlines as t0 join routes as t1 on t0.alid = t1.alid where c2 like 'K%'" }, "style": "rule" }
{ "index": 2498, "split": "train" }
Which are the ten colleges, identified by their IDs and full names, that are linked to players who have died on or before the most recent death year among all players, when ordered by college ID from highest to lowest?
baseball_1
select t0.college_id as c1, t0.name_full, t1.college_id from college as t0 join player_college as t1 on t0.college_id = t1.college_id join player as t2 on t1.player_id = t2.player_id, (select max(death_year) as c2 from player) as t0 where t2.death_year <= t0.c2 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": "baseball_1", "sql": "select t0.college_id as c1, t0.name_full, t1.college_id from college as t0 join player_college as t1 on t0.college_id = t1.college_id join player as t2 on t1.player_id = t2.player_id, (select max(death_year) as c2 from player) as t0 where t2.death_year <= t0....
{ "index": 1401, "split": "train" }
What are the staff IDs, vehicle IDs, and customer IDs for lessons taught by staff members whose middle name ends with "Duane"?
driving_school
select t0.staff_id, t0.vehicle_id, t0.customer_id from lessons as t0 join staff as t1 on t0.staff_id = t1.staff_id where t1.middle_name like '%Duane'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.staff_id, t0.vehicle_id, t0.customer_id from lessons as t0 join staff as t1 on t0.staff_id = t1.staff_id where t1.middle_name like '%Duane'" }, "style": "rule" }
{ "index": 1034, "split": "train" }
Which shops have stock quantities of 110 or fewer and are also shop number 2? What are their Shop IDs, open years, and open dates?
device
select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.shop_id as c0, t0.open_year as c2, t0.open_date as c1 from shop as t0 join stock as t1 on t0.shop_id = t1.shop_id where t1.quantity <= 110 intersect select t0.shop_id as c0, t0.open_year as c2, t0.open_date as c1 from shop as t0 join stock as t1 on t0.shop_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": "device", "sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.shop_id as c0, t0.open_year as c2, t0.open_date as c1 from shop as t0 join stock as t1 on t0.shop_id = t1.shop_id where t1.quantity <= 110 intersect select t0.shop_id as c0, t0.open_year as c2, t0.open_date a...
{ "index": 2115, "split": "train" }
What are the descriptions of product categories that contain products with names ending in "ge" or exactly "laurel," sorted by their unit of measure in descending order?
products_gen_characteristics
select t0.product_category_description from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code where t1.product_name like '%ge' or t1.product_name = 'laurel' order by t0.unit_of_measure desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select t0.product_category_description from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code where t1.product_name like '%ge' or t1.product_name = 'laurel' order by t0.unit_of_measure de...
{ "index": 1666, "split": "train" }
Which are the ten lesson times with the lowest average number of customers attending, where that average is nine or fewer?
driving_school
select lesson_time as c0 from lessons group by c0 having avg(customer_id) <= 9 order by avg(customer_id) 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": "driving_school", "sql": "select lesson_time as c0 from lessons group by c0 having avg(customer_id) <= 9 order by avg(customer_id) asc nulls last limit 10" }, "style": "rule" }
{ "index": 730, "split": "train" }
What are the number of credits for the course with ID 857?
college_2
select credits from course where course_id = 857
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 credits from course where course_id = 857" }, "style": "rule" }
{ "index": 3360, "split": "train" }
Did the transaction with ID 5 happen earlier than the transaction with ID 13?
tracking_share_transactions
select t1.c1 < t0.c1 from (select date_of_transaction as c1 from transactions where transaction_id = 5) as t1, (select date_of_transaction as c1 from transactions where transaction_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": "tracking_share_transactions", "sql": "select t1.c1 < t0.c1 from (select date_of_transaction as c1 from transactions where transaction_id = 5) as t1, (select date_of_transaction as c1 from transactions where transaction_id = 13) as t0" }, "style": "rule" }
{ "index": 3152, "split": "train" }
Can you provide the college ID, college name, and member ID for all members, including those who are from the college with ID 1?
decoration_competition
select anon_1.c0, anon_1.c1, anon_1.c2 from (select college_id as c0, name as c1, member_id as c2 from member union select t0.college_id as c0, t0.name as c1, t0.member_id as c2 from member as t0 join college as t1 on t0.college_id = t1.college_id where t1.college_id = 1) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "decoration_competition", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select college_id as c0, name as c1, member_id as c2 from member union select t0.college_id as c0, t0.name as c1, t0.member_id as c2 from member as t0 join college as t1 on t0.college_id = t1.college_id...
{ "index": 1896, "split": "train" }
Which player with a last name ending in "th" and fewer than 5 awards has the most recent player ID, and what is their earliest award year?
baseball_1
select min(t0.year) from player_award as t0 join player as t1 on t0.player_id = t1.player_id where t1.name_last like '%th' group by t1.player_id having count(*) < 5 order by t1.player_id 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": "baseball_1", "sql": "select min(t0.year) from player_award as t0 join player as t1 on t0.player_id = t1.player_id where t1.name_last like '%th' group by t1.player_id having count(*) < 5 order by t1.player_id desc limit 1" }, "style": "rule" }
{ "index": 2314, "split": "train" }
Was the percentage change in the total investor IDs involved in SALE transactions with amounts less than 78 million units on April 3, 2000, greater than the overall variation in investor activity across all transaction types at that same time?
tracking_share_transactions
select abs((t2.c2 / cast(t2.c2 as real) - 1) * 100) > t1.c3 from (select sum(t1.investor_id) as c2 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'SALE' and t1.date_of_transaction = '2000-04-03 20:55:43' and t1.amount_of_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": "tracking_share_transactions", "sql": "select abs((t2.c2 / cast(t2.c2 as real) - 1) * 100) > t1.c3 from (select sum(t1.investor_id) as c2 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code ...
{ "index": 3454, "split": "train" }
Which are the top 10 airports (based on their X, Y, and Apid) with route source IDs between 3303 and 3376 and source codes starting with "AS," ordered by the total sum of their source IDs?
flight_4
select t0.x, t0.y, t0.apid as c1 from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.src_apid between 3303 and 3376 and t1.src_ap like 'AS%' group by c1 order by sum(t1.src_apid) 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": "flight_4", "sql": "select t0.x, t0.y, t0.apid as c1 from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.src_apid between 3303 and 3376 and t1.src_ap like 'AS%' group by c1 order by sum(t1.src_apid) desc limit 10" }, "style": "rule" }
{ "index": 555, "split": "train" }
What are the first three students' IDs, details, and email addresses for those with addresses having an ID greater than 45, sorted alphabetically by email address?
student_assessment
select t0.student_id, t0.student_details, t1.email_address as c1 from students as t0 join people as t1 on t0.student_id = t1.person_id join people_addresses as t2 on t1.person_id = t2.person_id where t2.address_id > 45 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": "student_assessment", "sql": "select t0.student_id, t0.student_details, t1.email_address as c1 from students as t0 join people as t1 on t0.student_id = t1.person_id join people_addresses as t2 on t1.person_id = t2.person_id where t2.address_id > 45 order by c1 asc nulls last limit...
{ "index": 1162, "split": "train" }
Who are the ten persons living in cities that start with "c" with the fewest distinct friendship years, and what are their genders and names?
network_2
select t0.gender, t0.name as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.city like 'c%' group by c0 order by count(distinct (t1.year)) asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select t0.gender, t0.name as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.city like 'c%' group by c0 order by count(distinct (t1.year)) asc nulls last limit 10" }, "style": "rule" }
{ "index": 967, "split": "train" }
What are the lesson status code, customer ID, mobile phone number, and date of birth for customers who made payments of less than or equal to 787.12 or between 4610.26 and 9414.74, and which are associated with their lessons?
driving_school
select t0.lesson_status_code, t0.customer_id, t1.cell_mobile_phone_number, t1.date_of_birth from lessons as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_payments as t2 on t1.customer_id = t2.customer_id where t2.amount_payment <= 787.12 or t2.amount_payment between 4610.26 and 9414.74
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.lesson_status_code, t0.customer_id, t1.cell_mobile_phone_number, t1.date_of_birth from lessons as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_payments as t2 on t1.customer_id = t2.customer_id where t2.amount_payment ...
{ "index": 1108, "split": "train" }
Can you list the top 10 students with their names, department names, total credits, and their department budgets, for students in departments taught by instructor Soisalon-Soininen, excluding instructors whose IDs also appear as students with names ending in "w"? Please order the list by student name in reverse alphabe...
college_2
select t0.name as c0, t0.dept_name, t0.tot_cred, t1.budget from student as t0 join department as t1 on t0.dept_name = t1.dept_name join instructor as t2 on t1.dept_name = t2.dept_name where (not t2.id in (select t0.id as c3 from student where c0 like '%w')) and t2.name = 'Soisalon-Soininen' 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": "college_2", "sql": "select t0.name as c0, t0.dept_name, t0.tot_cred, t1.budget from student as t0 join department as t1 on t0.dept_name = t1.dept_name join instructor as t2 on t1.dept_name = t2.dept_name where (not t2.id in (select t0.id as c3 from student where c0 like '%w')) an...
{ "index": 2575, "split": "train" }
What is the difference between the smallest address ID associated with person 121 and that of person 111?
student_assessment
select t1.c1 - t0.c1 from (select min(t1.address_id) as c1 from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id where t0.person_id = 121 group by t0.person_id) as t1, (select t0.person_id, min(t1.address_id) as c1 from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id where...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select t1.c1 - t0.c1 from (select min(t1.address_id) as c1 from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id where t0.person_id = 121 group by t0.person_id) as t1, (select t0.person_id, min(t1.address_id) as c1 from people a...
{ "index": 3627, "split": "train" }
Can you tell me the three stations located furthest east (with longitude greater than or equal to the maximum longitude) that have the fewest different bike availability counts? For each of these stations, include the number of unique bikes that have been available, the installation date, and the station ID.
bike_1
select count(distinct (t0.bikes_available)) as c0, t1.installation_date, t1.id as c3 from status as t0 join station as t1 on t0.station_id = t1.id, (select max(long) as c2 from station) as t0 where t1.long >= t0.c2 group by c3 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": "bike_1", "sql": "select count(distinct (t0.bikes_available)) as c0, t1.installation_date, t1.id as c3 from status as t0 join station as t1 on t0.station_id = t1.id, (select max(long) as c2 from station) as t0 where t1.long >= t0.c2 group by c3 order by c0 asc nulls last limit 3" ...
{ "index": 2222, "split": "train" }
Which are the top three courses, when ordered in reverse alphabetical order by course name, that have fewer than three students enrolled? For each of these courses, what is the course name, course ID, and the average student ID among students whose IDs are greater than the total number of unique students enrolled or at...
e_learning
select t0.course_name as c3, t0.course_id as c2, avg(t1.student_id) from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id, (select count(distinct (student_id)) as c0 from student_course_enrolment) as t0 where t1.student_id > t0.c0 or t1.student_id >= 6 group by c2 having count(*) < 3 ord...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.course_name as c3, t0.course_id as c2, avg(t1.student_id) from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id, (select count(distinct (student_id)) as c0 from student_course_enrolment) as t0 where t1.student_id > t0...
{ "index": 1059, "split": "train" }
For the document sections, what are the section titles, document codes, section IDs, and corresponding document names of sections that belong to the most frequently used functional area, or functional areas whose descriptions end with the letter "t"?
document_management
select t0.section_title, t0.document_code, t0.section_id, t1.document_name from document_sections as t0 join documents as t1 on t0.document_code = t1.document_code join document_functional_areas as t2 on t1.document_code = t2.document_code join functional_areas as t3 on t2.functional_area_code = t3.functional_area_code...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "document_management", "sql": "select t0.section_title, t0.document_code, t0.section_id, t1.document_name from document_sections as t0 join documents as t1 on t0.document_code = t1.document_code join document_functional_areas as t2 on t1.document_code = t2.document_code join funct...
{ "index": 315, "split": "train" }
Can you tell me the profits, market value, and company IDs of the top 3 companies, considering only gas stations that opened after 2000, sorted by company ID in descending order?
gas_company
select t0.profits_billion, t0.market_value, t1.company_id as c2 from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id where t2.open_year > 2000 order by c2 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "gas_company", "sql": "select t0.profits_billion, t0.market_value, t1.company_id as c2 from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id where t2.open_year > 2000 order by c2 desc limit 3" }, ...
{ "index": 205, "split": "train" }
What are the latitude values of the five entries for the station named Harry Bridges Plaza (Ferry Building), ordered by station ID?
bike_1
select t0.lat from station as t0 join status as t1 on t0.id = t1.station_id where t0.name = 'Harry Bridges Plaza (Ferry Building)' order by t1.station_id 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": "bike_1", "sql": "select t0.lat from station as t0 join status as t1 on t0.id = t1.station_id where t0.name = 'Harry Bridges Plaza (Ferry Building)' order by t1.station_id asc nulls last limit 5" }, "style": "rule" }
{ "index": 1998, "split": "train" }
Which player positions have a total sum of club IDs less than or equal to 5, and what are those sums?
sports_competition
select position as c1, sum(club_id) from player group by c1 having sum(club_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": "sports_competition", "sql": "select position as c1, sum(club_id) from player group by c1 having sum(club_id) <= 5" }, "style": "rule" }
{ "index": 1968, "split": "train" }
Is the average total value of purchases from supplier 2 lower than the average total value of purchases from supplier 4?
department_store
select t1.c1 < t0.c1 from (select avg(t1.total_value_purchased) as c1 from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id where t0.supplier_id = 4 group by t0.supplier_id) as t1, (select t0.supplier_id, avg(t1.total_value_purchased) as c1 from suppliers as t0 join product_suppliers as 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": "department_store", "sql": "select t1.c1 < t0.c1 from (select avg(t1.total_value_purchased) as c1 from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id where t0.supplier_id = 4 group by t0.supplier_id) as t1, (select t0.supplier_id, avg(t1.total_valu...
{ "index": 3565, "split": "train" }
Is the date of birth of guest with ID 6 later than the date of birth of guest with ID 9?
apartment_rentals
select t1.c1 > t0.c1 from (select date_of_birth as c1 from guests where guest_id = 6) as t1, (select date_of_birth as c1 from guests where guest_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": "apartment_rentals", "sql": "select t1.c1 > t0.c1 from (select date_of_birth as c1 from guests where guest_id = 6) as t1, (select date_of_birth as c1 from guests where guest_id = 9) as t0" }, "style": "rule" }
{ "index": 3067, "split": "train" }
For the top 5 mission codes when sorted in reverse alphabetical order, what is the minimum Ship ID recorded for each of those codes?
ship_mission
select code as c1, min(ship_id) from mission group by c1 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": "ship_mission", "sql": "select code as c1, min(ship_id) from mission group by c1 order by c1 desc limit 5" }, "style": "rule" }
{ "index": 1830, "split": "train" }
List the city codes and advisors of students whose majors are greater than 520, showing the five highest city codes first.
club_1
select city_code as c0, advisor from student where major > 520 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": "club_1", "sql": "select city_code as c0, advisor from student where major > 520 order by c0 desc limit 5" }, "style": "rule" }
{ "index": 308, "split": "train" }
How much does the total sum of student IDs for students who received a B- grade differ from 2048?
college_3
select t0.c0 - 2048 from (select sum(t1.stuid) as c0 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t0.lettergrade = 'B-' group by t0.lettergrade) 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_3", "sql": "select t0.c0 - 2048 from (select sum(t1.stuid) as c0 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t0.lettergrade = 'B-' group by t0.lettergrade) as t0" }, "style": "rule" }
{ "index": 3216, "split": "train" }
What is the earliest year each player was an all-star, for players who are either exactly 78 inches tall or have a height between 67 and 71 inches?
baseball_1
select min(t0.year), t1.player_id as c0 from all_star as t0 join player as t1 on t0.player_id = t1.player_id where t1.height = 78 or t1.height between 67 and 71 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": "baseball_1", "sql": "select min(t0.year), t1.player_id as c0 from all_star as t0 join player as t1 on t0.player_id = t1.player_id where t1.height = 78 or t1.height between 67 and 71 group by c0" }, "style": "rule" }
{ "index": 1894, "split": "train" }
Can you list the top 10 performances with the highest attendance, showing their attendance numbers and performance IDs, along with the member IDs and performance IDs for members whose member ID includes "2" and whose role contains "V", ordered by attendance from highest to lowest?
performance_attendance
select t0.attendance as c0, t0.performance_id, t1.member_id, t1.performance_id from performance as t0 join member_attendance as t1 on t0.performance_id = t1.performance_id join member as t2 on t1.member_id = t2.member_id where t2.member_id like '%2%' and t2.role like '%V%' 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": "performance_attendance", "sql": "select t0.attendance as c0, t0.performance_id, t1.member_id, t1.performance_id from performance as t0 join member_attendance as t1 on t0.performance_id = t1.performance_id join member as t2 on t1.member_id = t2.member_id where t2.member_id like '%...
{ "index": 574, "split": "train" }
Which are the five most recently opened stadiums, and what are their countries, names, and the number of performance records associated with each?
swimming
select t0.opening_year as c1, t0.country, t0.name, count(t2.id) from stadium as t0 join event as t1 on t0.id = t1.stadium_id join record as t2 on t1.id = t2.event_id group by t0.id order by c1 desc limit 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": "swimming", "sql": "select t0.opening_year as c1, t0.country, t0.name, count(t2.id) from stadium as t0 join event as t1 on t0.id = t1.stadium_id join record as t2 on t1.id = t2.event_id group by t0.id order by c1 desc limit 5" }, "style": "rule" }
{ "index": 7, "split": "train" }
Which are the first 10 activity names with actid up to 778, listed in reverse alphabetical order?
activity_1
select t0.activity_name as c0 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.actid <= 778 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": "activity_1", "sql": "select t0.activity_name as c0 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.actid <= 778 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 856, "split": "train" }
Which are the names, installation dates, IDs, and total bikes available for the top 5 stations with the most status updates, sorted alphabetically by station name?
bike_1
select t0.name as c4, t0.installation_date, t0.id as c1, sum(t1.bikes_available) from station as t0 join status as t1 on t0.id = t1.station_id, (select station_id as c0 from status group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.station_id = t0.c0 group by c1 order by c4 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": "bike_1", "sql": "select t0.name as c4, t0.installation_date, t0.id as c1, sum(t1.bikes_available) from station as t0 join status as t1 on t0.id = t1.station_id, (select station_id as c0 from status group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.station_id = ...
{ "index": 481, "split": "train" }
How many employees have worked for the company with ID 15?
company_employee
select count(*) from employment where company_id = 15
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_employee", "sql": "select count(*) from employment where company_id = 15" }, "style": "rule" }
{ "index": 2264, "split": "train" }
Can you tell me the rank of customer with ID 11 among customers with coupon IDs greater than 3, when they are ordered from highest to lowest customer ID? Also, show the customer ID alongside their rank.?
products_for_hire
select t1.c5, t1.c3 as c0 from (select row_number() over (order by t0.c1 desc) as c5, t0.c2 as c3 from (select t0.customer_id as c2, max(t1.customer_id) as c1 from customers as t0 join bookings as t1 on t0.customer_id = t1.customer_id where t0.coupon_id > 3 group by c2) as t0) as t1 where c0 = 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": "products_for_hire", "sql": "select t1.c5, t1.c3 as c0 from (select row_number() over (order by t0.c1 desc) as c5, t0.c2 as c3 from (select t0.customer_id as c2, max(t1.customer_id) as c1 from customers as t0 join bookings as t1 on t0.customer_id = t1.customer_id where t0.coupon_i...
{ "index": 3496, "split": "train" }
How many unique students are enrolled in each subject where the highest course ID they are enrolled in is 11 or less? Please list these counts alongside the subject IDs, sorted by subject ID.
e_learning
select count(distinct (t0.student_id)), t2.subject_id as c1 from student_course_enrolment as t0 join courses as t1 on t0.course_id = t1.course_id join subjects as t2 on t1.subject_id = t2.subject_id group by c1 having max(t0.course_id) <= 11 order by c1 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select count(distinct (t0.student_id)), t2.subject_id as c1 from student_course_enrolment as t0 join courses as t1 on t0.course_id = t1.course_id join subjects as t2 on t1.subject_id = t2.subject_id group by c1 having max(t0.course_id) <= 11 order by c1 asc n...
{ "index": 643, "split": "train" }
What is the percentage change in the average staff member handling rentals for all inventory items between May 31, 2005, at 15:24:19, and July 27, 2005, at 01:08:26?
sakila_1
select (avg(t0.c2) / cast(avg(t1.c2) as real) - 1) * 100 from (select avg(t1.staff_id) as c2 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t1.rental_date = '2005-05-31 15:24:19' group by t0.inventory_id) as t0, (select t0.inventory_id, avg(t1.staff_id) as c2 from inventory as t0 join...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (avg(t0.c2) / cast(avg(t1.c2) as real) - 1) * 100 from (select avg(t1.staff_id) as c2 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t1.rental_date = '2005-05-31 15:24:19' group by t0.inventory_id) as t0, (select t0.inv...
{ "index": 3047, "split": "train" }
How many days did a document stay in a location, based on its move-in and move-out dates within the specified period?
cre_Doc_Tracking_DB
select julianday(t1.c0) - julianday(t0.c2) from (select date_in_location_from as c0 from document_locations) as t1, (select date_in_locaton_to as c2 from document_locations where date_in_location_from between '2009-08-18 03:29:08' and '2010-11-26 19:22:50' and date_in_location_from between '2009-08-18 03:29:08' and '20...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Tracking_DB", "sql": "select julianday(t1.c0) - julianday(t0.c2) from (select date_in_location_from as c0 from document_locations) as t1, (select date_in_locaton_to as c2 from document_locations where date_in_location_from between '2009-08-18 03:29:08' and '2010-11-26 19:...
{ "index": 3984, "split": "train" }
For debates with ID 4, what are the dates when they took place, along with the number of unique debates, the total number of entries, and how many different venues were involved on each of those dates?
debate
select date as c2, count(distinct (debate_id)), count(*), count(venue) from debate where debate_id = 4 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": "debate", "sql": "select date as c2, count(distinct (debate_id)), count(*), count(venue) from debate where debate_id = 4 group by c2" }, "style": "rule" }
{ "index": 1737, "split": "train" }
Is Bob's total number of friendship years less than 12?
network_2
select t0.c0 < 12 from (select sum(t1.year) as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.name = 'Bob' group by t0.name) 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": "network_2", "sql": "select t0.c0 < 12 from (select sum(t1.year) as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.name = 'Bob' group by t0.name) as t0" }, "style": "rule" }
{ "index": 3345, "split": "train" }
Which are the first five subject names associated with courses named 'Chinese Painting' that have descriptions containing the letter 'h', ordered alphabetically by subject name?
e_learning
select t0.subject_name as c0 from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.course_name = 'Chinese Painting' and t1.course_description like '%h%' order by c0 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.subject_name as c0 from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.course_name = 'Chinese Painting' and t1.course_description like '%h%' order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2554, "split": "train" }
What are the lowest and highest 'people_id's involved in incidents?
perpetrator
select min(t0.c2), max(t0.c2) from (select max(t1.people_id) as c2 from people as t0 join perpetrator as t1 on t0.people_id = t1.people_id group by t0.people_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": "perpetrator", "sql": "select min(t0.c2), max(t0.c2) from (select max(t1.people_id) as c2 from people as t0 join perpetrator as t1 on t0.people_id = t1.people_id group by t0.people_id) as t0" }, "style": "rule" }
{ "index": 3647, "split": "train" }
How many trucks are there in total?
customer_deliveries
select count(*) from trucks
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_deliveries", "sql": "select count(*) from trucks" }, "style": "rule" }
{ "index": 1646, "split": "train" }
What is the highest salary earned by the employee with EID 141582651 according to their certification records?
flight_1
select t0.salary as c0 from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 141582651 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_1", "sql": "select t0.salary as c0 from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 141582651 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 31, "split": "train" }
How much is the total access count for document structure 9 above or below 13,427?
document_management
select t0.c1 - 13427 from (select sum(t1.access_count) as c1 from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code where t0.document_structure_code = 9 group by t0.document_structure_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": "document_management", "sql": "select t0.c1 - 13427 from (select sum(t1.access_count) as c1 from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code where t0.document_structure_code = 9 group by t0.document_structure_code) as t...
{ "index": 3230, "split": "train" }
Which home teams played in stadiums with capacity utilization between 95.8% and 100.3%, or in stadiums with more than 98.4% capacity?
game_injury
select t0.home_team, t1.name from game as t0 join stadium as t1 on t0.stadium_id = t1.id where t1.capacity_percentage between 95.8 and 100.3 or t1.capacity_percentage > 98.4
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_injury", "sql": "select t0.home_team, t1.name from game as t0 join stadium as t1 on t0.stadium_id = t1.id where t1.capacity_percentage between 95.8 and 100.3 or t1.capacity_percentage > 98.4" }, "style": "rule" }
{ "index": 470, "split": "train" }
Which three locations hosted parties in the most popular first year, listed in reverse alphabetical order?
party_host
select t0.location as c0 from party as t0, (select first_year as c1 from party group by c1 order by count(*) desc limit 1) as t0 where t0.first_year = t0.c1 order by c0 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "party_host", "sql": "select t0.location as c0 from party as t0, (select first_year as c1 from party group by c1 order by count(*) desc limit 1) as t0 where t0.first_year = t0.c1 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 1252, "split": "train" }
For each account name that has fewer than five accounts, what is the number of unique other account details, the total number of accounts, and the average customer ID?
customers_and_invoices
select account_name as c3, count(distinct (other_account_details)), count(*) as c2, avg(customer_id) from accounts group by c3 having c2 < 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_invoices", "sql": "select account_name as c3, count(distinct (other_account_details)), count(*) as c2, avg(customer_id) from accounts group by c3 having c2 < 5" }, "style": "rule" }
{ "index": 1975, "split": "train" }
What is the percentage change in the number of unique documents marked as 'working' between July 2, 2017, and July 27, 1996?
cre_Doc_Control_Systems
select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c2 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t0.document_status_code = 'working' and t1.receipt_date = '1996-07-27 03:30:40' group by t0.document_status_co...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c2 / cast(t1.c2 as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c2 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t0.document_status_code = 'working' ...
{ "index": 3409, "split": "train" }
What is the smallest and largest enrollment number among the colleges?
soccer_2
select min(enr), max(enr) from college
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 min(enr), max(enr) from college" }, "style": "rule" }
{ "index": 3648, "split": "train" }
Does the percentage change in the number of unique tweets made by user with UID 5 at exactly 2:30:30 AM on March 12, 2018, exceed the overall percentage change for all users who posted tweets containing "t couple of wee" at that same time?
twitter_1
select abs((t2.c4 / cast(t2.c4 as real) - 1) * 100) > t1.c1 from (select count(distinct (t1.id)) as c4 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' group by t0.uid) as t2, (select abs((count(t0.c4) / cast(count(t0.c4) as real) - 1) * 100) as 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": "twitter_1", "sql": "select abs((t2.c4 / cast(t2.c4 as real) - 1) * 100) > t1.c1 from (select count(distinct (t1.id)) as c4 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' group by t0.uid) as t2, (select abs(...
{ "index": 3457, "split": "train" }
Among organizations whose type starts with "R," which one has the highest organization type code when sorted in reverse alphabetical order, and what is its type description?
tracking_grants_for_research
select t0.organisation_type as c0, t0.organisation_type_description from organisation_types as t0 join organisations as t1 on t0.organisation_type = t1.organisation_type where t1.organisation_type like 'R%' 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_grants_for_research", "sql": "select t0.organisation_type as c0, t0.organisation_type_description from organisation_types as t0 join organisations as t1 on t0.organisation_type = t1.organisation_type where t1.organisation_type like 'R%' order by c0 desc limit 1" }, "...
{ "index": 1544, "split": "train" }
Which customers, with customer IDs of 113 or higher, have filed complaints between August 6, 1977, and July 11, 1987, and what are their customer IDs, phone numbers, towns or cities, along with the staff IDs who handled their complaints?
customer_complaints
select t0.customer_id, t0.phone_number, t0.town_city, t1.staff_id from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.date_complaint_raised between '1977-08-06 00:31:19' and '1987-07-11 14:40:30' and t1.customer_id >= 113
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_complaints", "sql": "select t0.customer_id, t0.phone_number, t0.town_city, t1.staff_id from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.date_complaint_raised between '1977-08-06 00:31:19' and '1987-07-11 14:40:30' and t1.customer_id ...
{ "index": 128, "split": "train" }
What are the customer ID and order details for each order, along with the number of unique invoices and the total number of transactions associated with that order?
customers_and_invoices
select t0.customer_id, t0.order_details, count(distinct (t2.invoice_number)), count(*) from orders as t0 join invoices as t1 on t0.order_id = t1.order_id join financial_transactions as t2 on t1.invoice_number = t2.invoice_number group by t0.order_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": "customers_and_invoices", "sql": "select t0.customer_id, t0.order_details, count(distinct (t2.invoice_number)), count(*) from orders as t0 join invoices as t1 on t0.order_id = t1.order_id join financial_transactions as t2 on t1.invoice_number = t2.invoice_number group by t0.order_...
{ "index": 192, "split": "train" }
Can you tell me the three apartments with the least number of available units among those that have either the most common room count or a room count starting with "5"? For each of these, I want to know the total number of available units, the sum of their apartment IDs, and how many different bedroom counts they have.
apartment_rentals
select count(t0.available_yn) as c3, sum(t0.apt_id), count(distinct (t1.bedroom_count)) from view_unit_status as t0 join apartments as t1 on t0.apt_id = t1.apt_id, (select room_count as c2 from apartments group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.room_count = t0.c2 or t1.room_count 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": "apartment_rentals", "sql": "select count(t0.available_yn) as c3, sum(t0.apt_id), count(distinct (t1.bedroom_count)) from view_unit_status as t0 join apartments as t1 on t0.apt_id = t1.apt_id, (select room_count as c2 from apartments group by c2 order by count(*) asc nulls last li...
{ "index": 1814, "split": "train" }
Find the unique customer IDs, their address validity dates, and payment methods for customers whose customer numbers start with "2".
customers_and_products_contacts
select distinct t0.customer_id, t0.date_to, t0.date_from, t1.payment_method_code from customer_address_history as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.customer_number like '2%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select distinct t0.customer_id, t0.date_to, t0.date_from, t1.payment_method_code from customer_address_history as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.customer_number like '2%'" }, "style": "rule" }
{ "index": 1923, "split": "train" }
Did the order placed with order ID 11 occur after the order placed with order ID 14?
tracking_orders
select t1.c1 > t0.c1 from (select date_order_placed as c1 from orders where order_id = 11) as t1, (select date_order_placed as c1 from orders where order_id = 14) 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_orders", "sql": "select t1.c1 > t0.c1 from (select date_order_placed as c1 from orders where order_id = 11) as t1, (select date_order_placed as c1 from orders where order_id = 14) as t0" }, "style": "rule" }
{ "index": 3105, "split": "train" }
Which combinations of games managed, wins, and losses are found in managers but are not recorded for any team?
baseball_1
select anon_1.c0, anon_1.c4, anon_1.c3 from (select g as c0, w as c4, l as c3 from manager except select g, w, l from team) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "baseball_1", "sql": "select anon_1.c0, anon_1.c4, anon_1.c3 from (select g as c0, w as c4, l as c3 from manager except select g, w, l from team) as anon_1" }, "style": "rule" }
{ "index": 2209, "split": "train" }
Which staff members have handled complaints raised since July 11, 1987, with the complaint status that was assigned to the fewest unique customers? Please provide their phone number, last name, staff ID, and note the smallest staff ID among them.
customer_complaints
select t0.phone_number, t0.last_name, t0.staff_id as c3, min(t1.staff_id) from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id, (select complaint_status_code as c4 from complaints group by c4 order by count(distinct (customer_id)) asc nulls last limit 1) as t0 where t1.date_complaint_raised >= '1987-07-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": "customer_complaints", "sql": "select t0.phone_number, t0.last_name, t0.staff_id as c3, min(t1.staff_id) from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id, (select complaint_status_code as c4 from complaints group by c4 order by count(distinct (customer_id)) asc ...
{ "index": 1350, "split": "train" }
Which addresses have a specific combination of state, province, county, address ID, and city that are not associated with any orders containing exactly four items?
customers_and_products_contacts
select anon_1.c0, anon_1.c2, anon_1.c1 from (select state_province_county as c0, address_id as c2, city as c1 from addresses except select t0.state_province_county as c0, t0.address_id as c2, t0.city as c1 from addresses as t0 join customer_address_history as t1 on t0.address_id = t1.address_id join customers as t2 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": "customers_and_products_contacts", "sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select state_province_county as c0, address_id as c2, city as c1 from addresses except select t0.state_province_county as c0, t0.address_id as c2, t0.city as c1 from addresses as t0 join custom...
{ "index": 1507, "split": "train" }
Which three ship types have the smallest total tonnage, and what is the combined tonnage for each of these types?
ship_mission
select type as c1, sum(tonnage) as c0 from ship group by c1 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": "ship_mission", "sql": "select type as c1, sum(tonnage) as c0 from ship group by c1 order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 676, "split": "train" }
Can you tell me the formation dates and UK VAT numbers for the organization with ID 2, listing the first five results sorted alphabetically by the organization's name?
e_government
select t0.date_formed, t0.uk_vat_number from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where t1.organization_id = 2 order by t0.organization_name asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_government", "sql": "select t0.date_formed, t0.uk_vat_number from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where t1.organization_id = 2 order by t0.organization_name asc nulls last limit 5" }, "style": "rule"...
{ "index": 383, "split": "train" }
Which product IDs from the Products For Hire that have a description starting with "Anna Ka" are currently the highest in the view of product availability?
products_for_hire
select max(t0.product_id), t1.product_id as c1 from view_product_availability as t0 join products_for_hire as t1 on t0.product_id = t1.product_id where t1.product_description like 'Anna Ka%' group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select max(t0.product_id), t1.product_id as c1 from view_product_availability as t0 join products_for_hire as t1 on t0.product_id = t1.product_id where t1.product_description like 'Anna Ka%' group by c1" }, "style": "rule" }
{ "index": 705, "split": "train" }
Can you list the scholarship status, student IDs, and advisors for students who played any game with an ID greater than 1 for exactly one hour?
game_1
select t0.onscholarship, t0.stuid, t1.stuid, t1.advisor from sportsinfo as t0 join student as t1 on t0.stuid = t1.stuid join plays_games as t2 on t1.stuid = t2.stuid where t2.hours_played = 1 and t2.gameid > 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": "game_1", "sql": "select t0.onscholarship, t0.stuid, t1.stuid, t1.advisor from sportsinfo as t0 join student as t1 on t0.stuid = t1.stuid join plays_games as t2 on t1.stuid = t2.stuid where t2.hours_played = 1 and t2.gameid > 1" }, "style": "rule" }
{ "index": 2916, "split": "train" }
Which courses and their subjects are taken by the student with the fewest total course enrollments?
e_learning
select t0.subject_id, t0.course_name from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id, (select registration_id as c0 from student_course_enrolment group by c0 order by count(course_id) asc nulls last limit 1) as t0 where t1.registration_id = 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": "e_learning", "sql": "select t0.subject_id, t0.course_name from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id, (select registration_id as c0 from student_course_enrolment group by c0 order by count(course_id) asc nulls last limit 1) as t0 where t...
{ "index": 2978, "split": "train" }
What is the date when the customers became clients and their payment method for those whose contact channel includes "Mobile"?
customers_and_addresses
select t0.date_became_customer, t0.payment_method from customers as t0 join customer_contact_channels as t1 on t0.customer_id = t1.customer_id where t1.channel_code like '%Mobile%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.date_became_customer, t0.payment_method from customers as t0 join customer_contact_channels as t1 on t0.customer_id = t1.customer_id where t1.channel_code like '%Mobile%'" }, "style": "rule" }
{ "index": 1548, "split": "train" }
What are the IDs of members in charge of party events for parties with IDs less than 3, sorted from the highest to the lowest ID?
party_people
select member_in_charge_id as c0 from party_events where party_id < 3 or party_id < 1 order by c0 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "party_people", "sql": "select member_in_charge_id as c0 from party_events where party_id < 3 or party_id < 1 order by c0 desc" }, "style": "rule" }
{ "index": 1280, "split": "train" }
Find the phone number and customer ID of customers who have a complaint assigned to staff member 115 and whose complaint status includes the letter "w".
customer_complaints
select t0.phone_number, t1.customer_id from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.staff_id = 115 and t1.complaint_status_code like '%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": "customer_complaints", "sql": "select t0.phone_number, t1.customer_id from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.staff_id = 115 and t1.complaint_status_code like '%w%'" }, "style": "rule" }
{ "index": 1952, "split": "train" }
How much does the characteristic ID, associated with product 6, differ from 3?
products_gen_characteristics
select characteristic_id - 3 from product_characteristics where product_id = 6
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select characteristic_id - 3 from product_characteristics where product_id = 6" }, "style": "rule" }
{ "index": 3248, "split": "train" }
What are the grade points and letter grades for students with IDs between 1029 and 1030?
college_3
select t0.gradepoint from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t1.stuid between 1029 and 1030
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_3", "sql": "select t0.gradepoint from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t1.stuid between 1029 and 1030" }, "style": "rule" }
{ "index": 549, "split": "train" }
Can you tell me the tourist IDs and visit dates for visits where the associated shop has details containing "ffee" or is among the most frequently listed shop details?
cre_Theme_park
select t0.tourist_id, t0.visit_date from visits as t0 join tourist_attractions as t1 on t0.tourist_attraction_id = t1.tourist_attraction_id join shops as t2 on t1.tourist_attraction_id = t2.shop_id, (select shop_details as c1 from shops group by c1 order by count(*) desc limit 1) as t0 where t2.shop_details like '%ffee...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.tourist_id, t0.visit_date from visits as t0 join tourist_attractions as t1 on t0.tourist_attraction_id = t1.tourist_attraction_id join shops as t2 on t1.tourist_attraction_id = t2.shop_id, (select shop_details as c1 from shops group by c1 order ...
{ "index": 1917, "split": "train" }
Who are the top five course authors or tutors with the highest author IDs, considering only the courses that either have not been completed by students before specific dates or are course 9, and sorted by their personal names in reverse alphabetical order?
e_learning
select t0.author_id as c1, sum(t1.author_id) from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where (not t1.course_id in (select student_course_enrolment.course_id as c2 from student_course_enrolment where student_course_enrolment.date_of_completion < '2018-03-16 09:00:44' or stude...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.author_id as c1, sum(t1.author_id) from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where (not t1.course_id in (select student_course_enrolment.course_id as c2 from student_course_enrolment where student_course_...
{ "index": 2842, "split": "train" }
Did the percentage increase or decrease in the amount of purchase transactions between August 17, 1977, and October 8, 1985, exceed the overall percentage change across all transaction types during that period?
tracking_share_transactions
select t5.c2 > t2.c1 from (select abs((t3.c0 / cast(t4.c0 as real) - 1) * 100) as c2 from (select sum(t1.amount_of_transaction) as c0 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'PUR' and t1.date_of_transaction = '1977-...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_share_transactions", "sql": "select t5.c2 > t2.c1 from (select abs((t3.c0 / cast(t4.c0 as real) - 1) * 100) as c2 from (select sum(t1.amount_of_transaction) as c0 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_c...
{ "index": 3453, "split": "train" }
What is the difference between the highest Omim value among all enzymes and the Omim value of the enzyme with ID 7?
medicine_enzyme_interaction
select t2.c1 - t0.c3 from (select max(omim) as c1 from enzyme) as t2, (select omim as c3 from enzyme where id = 7) 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": "medicine_enzyme_interaction", "sql": "select t2.c1 - t0.c3 from (select max(omim) as c1 from enzyme) as t2, (select omim as c3 from enzyme where id = 7) as t0" }, "style": "rule" }
{ "index": 3172, "split": "train" }
Can you tell me the names and IDs of furniture items, along with their manufacturing prices, produced by manufacturers who have 24 or fewer shops?
manufacturer
select t0.name, t0.furniture_id, t1.price_in_dollar from furniture as t0 join furniture_manufacte as t1 on t0.furniture_id = t1.furniture_id join manufacturer as t2 on t1.manufacturer_id = t2.manufacturer_id where t2.num_of_shops <= 24
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t0.name, t0.furniture_id, t1.price_in_dollar from furniture as t0 join furniture_manufacte as t1 on t0.furniture_id = t1.furniture_id join manufacturer as t2 on t1.manufacturer_id = t2.manufacturer_id where t2.num_of_shops <= 24" }, "style": "rul...
{ "index": 2711, "split": "train" }
What is the largest coupon amount that customer 9 has received?
products_for_hire
select t0.coupon_amount as c0 from discount_coupons as t0 join customers as t1 on t0.coupon_id = t1.coupon_id where t1.customer_id = 9 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": "products_for_hire", "sql": "select t0.coupon_amount as c0 from discount_coupons as t0 join customers as t1 on t0.coupon_id = t1.coupon_id where t1.customer_id = 9 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 2741, "split": "train" }
Which stores have both the product with ID 2 and are located in districts with district IDs greater than 4?
store_product
select anon_1.c0, anon_1.c1 from (select t0.store_id as c0, t0.type as c1 from store as t0 join store_product as t1 on t0.store_id = t1.store_id where t1.product_id = 2 intersect select t0.store_id as c0, t0.type as c1 from store as t0 join store_district as t1 on t0.store_id = t1.store_id where t1.district_id > 4) 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": "store_product", "sql": "select anon_1.c0, anon_1.c1 from (select t0.store_id as c0, t0.type as c1 from store as t0 join store_product as t1 on t0.store_id = t1.store_id where t1.product_id = 2 intersect select t0.store_id as c0, t0.type as c1 from store as t0 join store_district ...
{ "index": 1665, "split": "train" }
Which document types are associated with documents that have a section titled ending with "fore"?
document_management
select t0.document_type_code from documents as t0 join document_sections as t1 on t0.document_code = t1.document_code where t1.section_title like '%fore'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "document_management", "sql": "select t0.document_type_code from documents as t0 join document_sections as t1 on t0.document_code = t1.document_code where t1.section_title like '%fore'" }, "style": "rule" }
{ "index": 2035, "split": "train" }
What is the number of stories of the building with ID 1?
company_office
select stories from buildings where id = 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select stories from buildings where id = 1" }, "style": "rule" }
{ "index": 3363, "split": "train" }
Can you list the five earliest accounts, including their account opening dates and names, that have financial transactions with types starting with "Payme" or ending with "nt"?
customers_and_invoices
select t0.date_account_opened as c0, t0.account_name from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_type like 'Payme%' or t1.transaction_type like '%nt' order by c0 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t0.date_account_opened as c0, t0.account_name from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_type like 'Payme%' or t1.transaction_type like '%nt' order by c0 asc nulls last limit ...
{ "index": 2326, "split": "train" }
Which customers have savings account balances between $60 and $200,000 but do not have checking accounts with exactly $77?
small_bank_1
select anon_1.c0, anon_1.c1 from (select t0.custid as c0, t0.name as c1 from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.balance between 60.0 and 200000.0 except select t0.custid as c0, t0.name as c1 from accounts as t0 join checking as t1 on t0.custid = t1.custid where t1.balance between 77.0 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": "small_bank_1", "sql": "select anon_1.c0, anon_1.c1 from (select t0.custid as c0, t0.name as c1 from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.balance between 60.0 and 200000.0 except select t0.custid as c0, t0.name as c1 from accounts as t0 join checking...
{ "index": 2362, "split": "train" }
What is the latest hire date and department ID of the employee who worked in the highest department ID among those hired on or before August 8th, 1987?
hr_1
select t0.hire_date, t0.department_id as c1 from employees as t0, (select max(department_id) as c3 from employees where hire_date <= '1987-08-08 00:00:00') as t1 where c1 = 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": "hr_1", "sql": "select t0.hire_date, t0.department_id as c1 from employees as t0, (select max(department_id) as c3 from employees where hire_date <= '1987-08-08 00:00:00') as t1 where c1 = t1.c3" }, "style": "rule" }
{ "index": 3778, "split": "train" }
How many days elapsed between the date when the staff was assigned to a department and the date their assignment ended?
department_store
select julianday(t1.c0) - julianday(t0.c1) from (select date_assigned_from as c0 from staff_department_assignments) as t1, (select date_assigned_to as c1 from staff_department_assignments where staff_id = 3 and staff_id = 3) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select julianday(t1.c0) - julianday(t0.c1) from (select date_assigned_from as c0 from staff_department_assignments) as t1, (select date_assigned_to as c1 from staff_department_assignments where staff_id = 3 and staff_id = 3) as t0" }, "style": "rule...
{ "index": 3700, "split": "train" }
Can you list each product's ID and name, along with the number of unique problems reported for that product, and the total number of log entries associated with those problems? Please order the list so that products with the most log entries appear first.
tracking_software_problems
select t0.product_id as c0, t0.product_name, count(distinct (t2.problem_id)), count(*) as c3 from product as t0 join problems as t1 on t0.product_id = t1.product_id join problem_log as t2 on t1.problem_id = t2.problem_id group by c0 order by c3 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t0.product_id as c0, t0.product_name, count(distinct (t2.problem_id)), count(*) as c3 from product as t0 join problems as t1 on t0.product_id = t1.product_id join problem_log as t2 on t1.problem_id = t2.problem_id group by c0 order by c...
{ "index": 1999, "split": "train" }
Who are the top 3 players with heights between 162.56 and 180.34, based on their name in reverse alphabetical order, along with their average weight and the count of their name entries?
soccer_1
select player_name as c2, avg(weight), count(distinct (player_name)) from player where height between 162.56 and 180.34 group by c2 order by c2 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select player_name as c2, avg(weight), count(distinct (player_name)) from player where height between 162.56 and 180.34 group by c2 order by c2 desc limit 3" }, "style": "rule" }
{ "index": 2353, "split": "train" }
Which addresses have customers living at them, and for each address, what is the address, address ID, and the number of distinct stores associated with customers at that address, considering only addresses with ID up to 424?
sakila_1
select t0.address, t0.address_id as c2, count(distinct (t1.store_id)) from address as t0 join customer as t1 on t0.address_id = t1.address_id where t1.address_id <= 424 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": "sakila_1", "sql": "select t0.address, t0.address_id as c2, count(distinct (t1.store_id)) from address as t0 join customer as t1 on t0.address_id = t1.address_id where t1.address_id <= 424 group by c2" }, "style": "rule" }
{ "index": 1424, "split": "train" }
Can you tell me the heights and street addresses of buildings whose IDs end with "4" or "1"?
protein_institute
select t0.height_feet, t0.street_address from building as t0 join institution as t1 on t0.building_id = t1.building_id where t1.building_id like '%4' or t1.building_id like '%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": "protein_institute", "sql": "select t0.height_feet, t0.street_address from building as t0 join institution as t1 on t0.building_id = t1.building_id where t1.building_id like '%4' or t1.building_id like '%1'" }, "style": "rule" }
{ "index": 2736, "split": "train" }
What are the address ID, monthly rental, and city of student addresses located in the most frequently occurring zip code among addresses whose line 1 starts with "51391 Dach Parkway"?
behavior_monitoring
select t0.address_id, t0.monthly_rental, t1.city from student_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id, (select zip_postcode as c3 from addresses where line_1 like '51391 Dach Parkway%' group by c3 order by count(*) asc nulls last limit 1) as t0 where t1.zip_postcode = t0.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": "behavior_monitoring", "sql": "select t0.address_id, t0.monthly_rental, t1.city from student_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id, (select zip_postcode as c3 from addresses where line_1 like '51391 Dach Parkway%' group by c3 order by count(*) asc n...
{ "index": 2694, "split": "train" }
List the customer status codes of the top five customers with payment amounts between 3073.98 and 4032.33, ordered by their address ID from newest to oldest.
driving_school
select t0.customer_status_code from customers as t0 join customer_payments as t1 on t0.customer_id = t1.customer_id where t1.amount_payment between 3073.98 and 4032.33 order by t0.customer_address_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": "driving_school", "sql": "select t0.customer_status_code from customers as t0 join customer_payments as t1 on t0.customer_id = t1.customer_id where t1.amount_payment between 3073.98 and 4032.33 order by t0.customer_address_id desc limit 5" }, "style": "rule" }
{ "index": 206, "split": "train" }