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 color description is associated with the most frequently purchased product that has a typical buying price ending with '8'?
products_gen_characteristics
select t0.color_description from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code, (select product_id as c1 from products where typical_buying_price like '%8' group by c1 order by count(*) desc limit 1) as t0 where t1.product_id = t0.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select t0.color_description from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code, (select product_id as c1 from products where typical_buying_price like '%8' group by c1 order by count(*) desc limit 1) as t0 where t1.pr...
{ "index": 1864, "split": "train" }
What is the difference between the highest property ID associated with customer 91 on September 27, 2016, at noon, and the same maximum property ID at that exact time?
local_govt_and_lot
select t0.c1 - t0.c1 from (select max(t1.property_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 91 and t1.date_moved_in = '2016-09-27 12:00:00' group by t0.customer_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t0.c1 - t0.c1 from (select max(t1.property_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 91 and t1.date_moved_in = '2016-09-27 12:00:00' group by t0.customer_id) as t0" }, ...
{ "index": 3522, "split": "train" }
Find the gender and dorm ID of the dorms whose names contain "t", specifically the one where the smallest amenity ID in its amenities is the highest among all such dorms.
dorm_1
select t0.gender, t0.dormid as c1 from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where t0.dorm_name like '%t%' group by c1 order by min(t1.amenid) 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": "dorm_1", "sql": "select t0.gender, t0.dormid as c1 from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where t0.dorm_name like '%t%' group by c1 order by min(t1.amenid) desc limit 1" }, "style": "rule" }
{ "index": 698, "split": "train" }
How many supplier names and address IDs are associated with the supplier who has the most supplier phones, specifically for supplier ID 4?
department_store
select count(t0.supplier_name), count(t1.address_id) from suppliers as t0 join supplier_addresses as t1 on t0.supplier_id = t1.supplier_id where t1.supplier_id = 4 order by count(t0.supplier_phone) desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select count(t0.supplier_name), count(t1.address_id) from suppliers as t0 join supplier_addresses as t1 on t0.supplier_id = t1.supplier_id where t1.supplier_id = 4 order by count(t0.supplier_phone) desc limit 1" }, "style": "rule" }
{ "index": 569, "split": "train" }
Is the highest address ID associated with address 3 less than the total number of unique maximum address IDs found across all address groups?
behavior_monitoring
select t2.c2 < t1.c0 from (select max(t1.address_id) as c2 from addresses as t0 join student_addresses as t1 on t0.address_id = t1.address_id where t0.address_id = 3 group by t0.address_id) as t2, (select count(distinct (t0.c2)) as c0 from (select max(t1.address_id) as c2 from addresses as t0 join student_addresses 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": "behavior_monitoring", "sql": "select t2.c2 < t1.c0 from (select max(t1.address_id) as c2 from addresses as t0 join student_addresses as t1 on t0.address_id = t1.address_id where t0.address_id = 3 group by t0.address_id) as t2, (select count(distinct (t0.c2)) as c0 from (select ma...
{ "index": 3309, "split": "train" }
What are the ten transaction types with the highest maximum transaction amounts and lowest account IDs, among transactions where the card ID is at least 3, sorted by transaction type in reverse alphabetical order?
customers_card_transactions
select transaction_type as c0, max(transaction_amount), min(account_id) from financial_transactions where card_id >= 3 group by c0 order by c0 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select transaction_type as c0, max(transaction_amount), min(account_id) from financial_transactions where card_id >= 3 group by c0 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 883, "split": "train" }
Among the stadiums with a capacity between 68,000 and 69,501, what are the three earliest opening years, and how many unique stadiums are there in each of these years?
swimming
select min(opening_year), count(distinct (id)) from stadium where capacity between 68000 and 69501 order by count(*) asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "swimming", "sql": "select min(opening_year), count(distinct (id)) from stadium where capacity between 68000 and 69501 order by count(*) asc nulls last limit 3" }, "style": "rule" }
{ "index": 2707, "split": "train" }
Did the booking with ID 13 start before the booking with ID 4?
products_for_hire
select t1.c1 < t0.c1 from (select booking_start_date as c1 from bookings where booking_id = 13) as t1, (select booking_start_date as c1 from bookings where booking_id = 4) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select t1.c1 < t0.c1 from (select booking_start_date as c1 from bookings where booking_id = 13) as t1, (select booking_start_date as c1 from bookings where booking_id = 4) as t0" }, "style": "rule" }
{ "index": 3140, "split": "train" }
Can you show the names and principal activities of the operating companies that have flights arriving at the airport with IATA code "AEY"?
flight_company
select t0.name, t0.principal_activities from operate_company as t0 join flight as t1 on t0.id = t1.company_id join airport as t2 on t1.airport_id = t2.id where t2.iata = 'AEY'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_company", "sql": "select t0.name, t0.principal_activities from operate_company as t0 join flight as t1 on t0.id = t1.company_id join airport as t2 on t1.airport_id = t2.id where t2.iata = 'AEY'" }, "style": "rule" }
{ "index": 178, "split": "train" }
Can you tell me the author or editor, publisher, publication year, and the country where the culture company was incorporated for book clubs with IDs starting with "6"?
culture_company
select t0.author_or_editor, t0.publisher, t0.year, t1.incorporated_in from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where t1.book_club_id like '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": "culture_company", "sql": "select t0.author_or_editor, t0.publisher, t0.year, t1.incorporated_in from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where t1.book_club_id like '6%'" }, "style": "rule" }
{ "index": 1585, "split": "train" }
Was order 1 placed after order 11?
customers_and_addresses
select t1.c0 > t0.c0 from (select order_date as c0 from customer_orders where order_id = 1) as t1, (select order_date as c0 from customer_orders where order_id = 11) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t1.c0 > t0.c0 from (select order_date as c0 from customer_orders where order_id = 1) as t1, (select order_date as c0 from customer_orders where order_id = 11) as t0" }, "style": "rule" }
{ "index": 3074, "split": "train" }
Is the percentage change in the total customer ID sum for customer 113 on February 10, 1973, greater than the overall percentage change across all customers involved in complaints handled by staff 117 on the same date?
customer_complaints
select abs((t2.c3 / cast(t2.c3 as real) - 1) * 100) > t1.c0 from (select sum(t1.customer_id) as c3 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 113 and t1.date_complaint_raised = '1973-02-10 22:55:56' group by t0.customer_id) as t2, (select abs((sum(t0.c3) / cast(...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 abs((t2.c3 / cast(t2.c3 as real) - 1) * 100) > t1.c0 from (select sum(t1.customer_id) as c3 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 113 and t1.date_complaint_raised = '1973-02-10 22:...
{ "index": 3917, "split": "train" }
On which departure date was the flight's price, that was at most 780.99, the highest?
flight_1
select t0.departure_date, t0.price as c2 from flight as t0, (select max(price) as c1 from flight where price <= 780.99) as t1 where c2 = t1.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_1", "sql": "select t0.departure_date, t0.price as c2 from flight as t0, (select max(price) as c1 from flight where price <= 780.99) as t1 where c2 = t1.c1" }, "style": "rule" }
{ "index": 3772, "split": "train" }
Is the latest revision date of the catalog with ID 3 more recent than that of the catalog with ID 4?
product_catalog
select t1.c0 > t0.c0 from (select date_of_latest_revision as c0 from catalogs where catalog_id = 3) as t1, (select date_of_latest_revision as c0 from catalogs where catalog_id = 4) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select t1.c0 > t0.c0 from (select date_of_latest_revision as c0 from catalogs where catalog_id = 3) as t1, (select date_of_latest_revision as c0 from catalogs where catalog_id = 4) as t0" }, "style": "rule" }
{ "index": 3092, "split": "train" }
Which are the top 10 regions affected by storms that caused less than 4.05 million USD in damages, sorted by the most recent storm IDs?
storm_record
select t0.region_name, t0.region_id, t1.storm_id as c0 from region as t0 join affected_region as t1 on t0.region_id = t1.region_id join storm as t2 on t1.storm_id = t2.storm_id where t2.damage_millions_usd < 4.05 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": "storm_record", "sql": "select t0.region_name, t0.region_id, t1.storm_id as c0 from region as t0 join affected_region as t1 on t0.region_id = t1.region_id join storm as t2 on t1.storm_id = t2.storm_id where t2.damage_millions_usd < 4.05 order by c0 desc limit 10" }, "style": "...
{ "index": 2803, "split": "train" }
What are the gender and student IDs of the top 10 students who are either the student with ID 1016 or students not listed in the Student database, ordered by student ID in descending order?
dorm_1
select t0.gender, t1.stuid as c0 from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid where c0 = 1016 or (not c0 in (select student.stuid as c2 from student)) 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": "dorm_1", "sql": "select t0.gender, t1.stuid as c0 from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid where c0 = 1016 or (not c0 in (select student.stuid as c2 from student)) order by c0 desc limit 10" }, "style": "rule" }
{ "index": 1290, "split": "train" }
Can you tell me the top 10 buildings with the most stories that are home to companies with sales of at least 130.4 billion? For each, I want to know the number of stories, the building ID, and the company ID.
company_office
select t0.stories as c1, t0.id, t1.company_id from buildings as t0 join office_locations as t1 on t0.id = t1.building_id join companies as t2 on t1.company_id = t2.id where t2.sales_billion >= 130.4 order by c1 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select t0.stories as c1, t0.id, t1.company_id from buildings as t0 join office_locations as t1 on t0.id = t1.building_id join companies as t2 on t1.company_id = t2.id where t2.sales_billion >= 130.4 order by c1 desc limit 10" }, "style": "rule" }
{ "index": 604, "split": "train" }
How many customer contact channels became active exactly on December 6, 2017, at 3:25:33 PM?
customers_and_addresses
select count(*) from customer_contact_channels where active_from_date = '2017-12-06 15:25:33'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(*) from customer_contact_channels where active_from_date = '2017-12-06 15:25:33'" }, "style": "rule" }
{ "index": 237, "split": "train" }
Which student ID appears the most often in the student records?
allergy_1
select stuid as c2, count(distinct (stuid)) as c0 from student group by c2 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": "allergy_1", "sql": "select stuid as c2, count(distinct (stuid)) as c0 from student group by c2 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 3652, "split": "train" }
Which airline or cargo company with a certain type has the highest priority when airports start with "Log"? Specifically, what is their type, company ID, the flight velocity, and the airport ID for the top result when sorting company types in reverse alphabetical order?
flight_company
select t0.type as c2, t0.id, t1.velocity, t1.airport_id from operate_company as t0 join flight as t1 on t0.id = t1.company_id join airport as t2 on t1.airport_id = t2.id where t2.name like 'Log%' order by c2 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_company", "sql": "select t0.type as c2, t0.id, t1.velocity, t1.airport_id from operate_company as t0 join flight as t1 on t0.id = t1.company_id join airport as t2 on t1.airport_id = t2.id where t2.name like 'Log%' order by c2 desc limit 1" }, "style": "rule" }
{ "index": 451, "split": "train" }
What are the Service ID, Service Type Code, Service Details, and Organization ID for all services, including those associated with items and their statuses before July 3, 2017 at 2:22 AM?
local_govt_and_lot
select anon_1.c0, anon_1.c2, anon_1.c3, anon_1.c1 from (select service_id as c0, service_type_code as c2, service_details as c3, organization_id as c1 from services union select t0.service_id as c0, t0.service_type_code as c2, t0.service_details as c3, t0.organization_id as c1 from services as t0 join organizations 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": "local_govt_and_lot", "sql": "select anon_1.c0, anon_1.c2, anon_1.c3, anon_1.c1 from (select service_id as c0, service_type_code as c2, service_details as c3, organization_id as c1 from services union select t0.service_id as c0, t0.service_type_code as c2, t0.service_details as c3...
{ "index": 1085, "split": "train" }
What are the customer type codes, address lines, and product IDs for complaints about products named 'Mouse', sorted by the product ID from the newest to the oldest?
customer_complaints
select t0.customer_type_code, t0.address_line_1, t1.product_id as c0 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id join products as t2 on t1.product_id = t2.product_id where t2.product_name = 'Mouse' 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": "customer_complaints", "sql": "select t0.customer_type_code, t0.address_line_1, t1.product_id as c0 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id join products as t2 on t1.product_id = t2.product_id where t2.product_name = 'Mouse' order by c0 desc" ...
{ "index": 829, "split": "train" }
Find the airport ID, elevation, Y coordinate, and airline ID for the airport linked to Qatar-based airlines that has the lowest airport ID.
flight_4
select t0.apid as c1, t0.elevation, t0.y, t1.alid from airports as t0 join routes as t1 on t0.apid = t1.src_apid join airlines as t2 on t1.alid = t2.alid where t2.country like '%Qatar' order by c1 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t0.apid as c1, t0.elevation, t0.y, t1.alid from airports as t0 join routes as t1 on t0.apid = t1.src_apid join airlines as t2 on t1.alid = t2.alid where t2.country like '%Qatar' order by c1 asc nulls last limit 1" }, "style": "rule" }
{ "index": 130, "split": "train" }
How many countries are named England?
soccer_1
select count(*) from country where name = 'England'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(*) from country where name = 'England'" }, "style": "rule" }
{ "index": 490, "split": "train" }
Can you find the country ID and area for the country that either has a name starting with "Swede" or has the least common country name, selecting the one with the highest population among these?
roller_coaster
select t0.country_id, t0.area from country as t0, (select name as c2 from country group by c2 order by count(*) asc nulls last limit 1) as t0 where t0.name like 'Swede%' or t0.name = t0.c2 order by t0.population 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": "roller_coaster", "sql": "select t0.country_id, t0.area from country as t0, (select name as c2 from country group by c2 order by count(*) asc nulls last limit 1) as t0 where t0.name like 'Swede%' or t0.name = t0.c2 order by t0.population desc limit 1" }, "style": "rule" }
{ "index": 1991, "split": "train" }
Is the contract start date for the maintenance contract with ID 5 earlier than the start date for the contract with ID 4?
assets_maintenance
select t1.c2 < t0.c2 from (select contract_start_date as c2 from maintenance_contracts where maintenance_contract_id = 5) as t1, (select contract_start_date as c2 from maintenance_contracts where maintenance_contract_id = 4) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t1.c2 < t0.c2 from (select contract_start_date as c2 from maintenance_contracts where maintenance_contract_id = 5) as t1, (select contract_start_date as c2 from maintenance_contracts where maintenance_contract_id = 4) as t0" }, "style": "ru...
{ "index": 3117, "split": "train" }
Which artists, identified by their famous release dates and artist IDs, have both released a volume on June 6 and also have volumes that stayed on top for three weeks or less?
music_4
select anon_1.c0, anon_1.c1 from (select t0.famous_release_date as c0, t0.artist_id as c1 from artist as t0 join volume as t1 on t0.artist_id = t1.artist_id where t1.issue_date = '6 June' intersect select t0.famous_release_date as c0, t0.artist_id as c1 from artist as t0 join volume as t1 on t0.artist_id = t1.artist_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": "music_4", "sql": "select anon_1.c0, anon_1.c1 from (select t0.famous_release_date as c0, t0.artist_id as c1 from artist as t0 join volume as t1 on t0.artist_id = t1.artist_id where t1.issue_date = '6 June' intersect select t0.famous_release_date as c0, t0.artist_id as c1 from art...
{ "index": 802, "split": "train" }
Which are the three repair assignment machine IDs listed in order, placing any with unknown IDs at the end?
machine_repair
select machine_id as c0 from repair_assignment 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": "machine_repair", "sql": "select machine_id as c0 from repair_assignment order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 824, "split": "train" }
What are the names and years of the top three friends, ordered from Z to A, who share the most common gender among all individuals?
network_2
select t0.friend as c0, t0.year from personfriend as t0 join person as t1 on t0.friend = t1.name, (select gender as c2 from person group by c2 order by count(*) desc limit 1) as t0 where t1.gender = t0.c2 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": "network_2", "sql": "select t0.friend as c0, t0.year from personfriend as t0 join person as t1 on t0.friend = t1.name, (select gender as c2 from person group by c2 order by count(*) desc limit 1) as t0 where t1.gender = t0.c2 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 1549, "split": "train" }
What are the genre identifiers, resolutions, languages, and genders of up to the ten songs where the artist's gender includes "al," sorted from Z to A by genre identifier?
music_1
select t0.genre_is as c3, t0.resolution, t0.languages, t1.gender as c2 from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where c2 like '%al%' order by c3 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": "music_1", "sql": "select t0.genre_is as c3, t0.resolution, t0.languages, t1.gender as c2 from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where c2 like '%al%' order by c3 desc limit 10" }, "style": "rule" }
{ "index": 2802, "split": "train" }
List the top 10 names with the most entries among people born in August 1975 or any year beginning with 19, along with their lowest recorded height.
entrepreneur
select name as c1, min(height) from people where date_of_birth like '1975-08%' or date_of_birth like '19%' group by c1 order by count(*) 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": "entrepreneur", "sql": "select name as c1, min(height) from people where date_of_birth like '1975-08%' or date_of_birth like '19%' group by c1 order by count(*) desc limit 10" }, "style": "rule" }
{ "index": 2747, "split": "train" }
Which ten assets have the most recent fault logs recorded by staff members of the most common gender or those whose gender starts with "0"? List their asset details, supplier company IDs, and maintenance contract IDs, ordered alphabetically by asset details.
assets_maintenance
select t0.asset_details as c2, t0.supplier_company_id, t0.maintenance_contract_id from assets as t0 join fault_log as t1 on t0.asset_id = t1.asset_id join staff as t2 on t1.recorded_by_staff_id = t2.staff_id, (select gender as c1 from staff group by c1 order by count(*) desc limit 1) as t0 where t2.gender = t0.c1 or t2...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t0.asset_details as c2, t0.supplier_company_id, t0.maintenance_contract_id from assets as t0 join fault_log as t1 on t0.asset_id = t1.asset_id join staff as t2 on t1.recorded_by_staff_id = t2.staff_id, (select gender as c1 from staff group by c...
{ "index": 75, "split": "train" }
For each photo color that appears in at least three photos, what is the total number of photos, the smallest mountain ID associated, and the number of times that color appears?
mountain_photos
select color as c1, count(*) as c0, min(mountain_id), count(color) from photos group by c1 having c0 >= 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": "mountain_photos", "sql": "select color as c1, count(*) as c0, min(mountain_id), count(color) from photos group by c1 having c0 >= 3" }, "style": "rule" }
{ "index": 2603, "split": "train" }
How does the average student ID for 'DISTURB' compare to the smallest average student ID across all incident types?
behavior_monitoring
select t2.c2 - t0.c0 from (select min(t1.c0) as c2 from (select avg(t1.student_id) as c0 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code group by t0.incident_type_code) as t1) as t2, (select t0.incident_type_code, avg(t1.student_id) as c0 from ref_incident_type...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c2 - t0.c0 from (select min(t1.c0) as c2 from (select avg(t1.student_id) as c0 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code group by t0.incident_type_code) as t1) as t2, (select ...
{ "index": 3181, "split": "train" }
Find the venue of the workshop that appears last in alphabetical order.
workshop_paper
select venue as c0 from workshop 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": "workshop_paper", "sql": "select venue as c0 from workshop order by c0 desc limit 1" }, "style": "rule" }
{ "index": 1741, "split": "train" }
What are the middle name, last name, and first name of individuals who are contact persons for organizations with a UK VAT number of 7237, along with the organization ID and individual ID?
e_government
select t0.individual_middle_name, t0.individual_last_name, t0.individual_first_name, t1.organization_id, t1.individual_id from individuals as t0 join organization_contact_individuals as t1 on t0.individual_id = t1.individual_id join organizations as t2 on t1.organization_id = t2.organization_id where t2.uk_vat_number =...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.individual_middle_name, t0.individual_last_name, t0.individual_first_name, t1.organization_id, t1.individual_id from individuals as t0 join organization_contact_individuals as t1 on t0.individual_id = t1.individual_id join organizations as t2 on t...
{ "index": 1459, "split": "train" }
What is the percentage change between the smallest policy ID associated with claim headers on March 16, 2017, and the smallest policy ID on February 10, 2018?
insurance_and_eClaims
select (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select t0.policy_id as c0 from claim_headers as t0 join policies as t1 on t0.policy_id = t1.policy_id where t1.start_date = '2017-03-16 18:16:52') as t0, (select t0.policy_id as c0 from claim_headers as t0 join policies as t1 on t0.policy_id = t1.policy_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": "insurance_and_eClaims", "sql": "select (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select t0.policy_id as c0 from claim_headers as t0 join policies as t1 on t0.policy_id = t1.policy_id where t1.start_date = '2017-03-16 18:16:52') as t0, (select t0.policy_id as c0 from...
{ "index": 3924, "split": "train" }
How does the injury accident with id 11 rank in order of most recent to oldest based on game ID?
game_injury
select t1.c3, t1.c1 as c4 from (select row_number() over (order by game_id desc) as c3, id as c1 from injury_accident) as t1 where c4 = 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": "game_injury", "sql": "select t1.c3, t1.c1 as c4 from (select row_number() over (order by game_id desc) as c3, id as c1 from injury_accident) as t1 where c4 = 11" }, "style": "rule" }
{ "index": 3867, "split": "train" }
Which are the five most recent home game attendance records, including the park id and team id, for parks located in cities starting with "Ro", sorted by team id from highest to lowest?
baseball_1
select t0.attendance, t0.park_id, t0.team_id as c0 from home_game as t0 join park as t1 on t0.park_id = t1.park_id where t1.city like 'Ro%' 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": "baseball_1", "sql": "select t0.attendance, t0.park_id, t0.team_id as c0 from home_game as t0 join park as t1 on t0.park_id = t1.park_id where t1.city like 'Ro%' order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2995, "split": "train" }
What is the difference between the smallest customer ID associated with customer 16 on the move-in date of March 27, 2015, and the smallest customer ID for that same customer on the same date but only considering properties with IDs of 108 or higher?
local_govt_and_lot
select t1.c1 - t0.c1 from (select min(t1.customer_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t1, (select t0.customer_id, min(t1.customer_id) as c1 from customers as t0 joi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c1 - t0.c1 from (select min(t1.customer_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t1, (sele...
{ "index": 3520, "split": "train" }
Who are the ten oldest technicians assigned to machine number 4?
machine_repair
select t0.technician_id from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id where t1.machine_id = 4 order by t0.age desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "machine_repair", "sql": "select t0.technician_id from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id where t1.machine_id = 4 order by t0.age desc limit 10" }, "style": "rule" }
{ "index": 857, "split": "train" }
The key is ensuring clarity that we're selecting the pilot related to the match with aircraft ID 3, sorting matches by country in reverse order, and limiting the result to just one record.
aircraft
select t0.name, t0.pilot_id, t0.age, t1.country as c3 from pilot as t0 join match as t1 on t0.pilot_id = t1.winning_pilot join aircraft as t2 on t1.winning_aircraft = t2.aircraft_id where t2.aircraft_id = 3 order by c3 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "aircraft", "sql": "select t0.name, t0.pilot_id, t0.age, t1.country as c3 from pilot as t0 join match as t1 on t0.pilot_id = t1.winning_pilot join aircraft as t2 on t1.winning_aircraft = t2.aircraft_id where t2.aircraft_id = 3 order by c3 desc limit 1" }, "style": "rule" }
{ "index": 2486, "split": "train" }
What is the percentage difference in the total crossing attribute for players born on December 30, 1986, compared to those born on October 6, 1983, among players with potential of 81 or less?
soccer_1
select (sum(t0.c1) / cast(sum(t1.c1) as real) - 1) * 100 from (select t0.crossing as c1 from player_attributes as t0 join player as t1 on t0.player_api_id = t1.player_api_id where t1.birthday = '1983-10-06 00:00:00' and t0.potential <= 81) as t0, (select t0.crossing as c1 from player_attributes as t0 join player as t1 ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select (sum(t0.c1) / cast(sum(t1.c1) as real) - 1) * 100 from (select t0.crossing as c1 from player_attributes as t0 join player as t1 on t0.player_api_id = t1.player_api_id where t1.birthday = '1983-10-06 00:00:00' and t0.potential <= 81) as t0, (select t0.cro...
{ "index": 3049, "split": "train" }
Which customers have lessons, and what are their lesson statuses and mobile phone numbers, for those who made payments totaling between 4032.33 and 8180.26 or exactly 9414.74?
driving_school
select t0.customer_id, t0.lesson_status_code, t1.cell_mobile_phone_number 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 between 4032.33 and 8180.26 or t2.amount_payment = 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.customer_id, t0.lesson_status_code, t1.cell_mobile_phone_number 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 between 4032.33 an...
{ "index": 2780, "split": "train" }
Can you tell me the total number of letter grades, the number of distinct grade points, and the total number of grade entries for course 600.315 among students whose student IDs are greater than or equal to the smallest student ID enrolled in that course?
college_3
select count(t0.lettergrade), count(distinct (t0.gradepoint)), count(t1.grade) from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade, (select min(stuid) as c1 from enrolled_in) as t0 where t1.cid = 600.315 and t1.stuid >= t0.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_3", "sql": "select count(t0.lettergrade), count(distinct (t0.gradepoint)), count(t1.grade) from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade, (select min(stuid) as c1 from enrolled_in) as t0 where t1.cid = 600.315 and t1.stuid >= t0.c1" }, ...
{ "index": 2358, "split": "train" }
Which station IDs are associated with stations whose local authority ends with "iltern" or "Broxbourne," listed in order of their station ID?
station_weather
select t0.station_id as c0 from route as t0 join station as t1 on t0.station_id = t1.id where t1.local_authority like '%iltern' or t1.local_authority like '%Broxbourne' order by c0 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select t0.station_id as c0 from route as t0 join station as t1 on t0.station_id = t1.id where t1.local_authority like '%iltern' or t1.local_authority like '%Broxbourne' order by c0 asc nulls last" }, "style": "rule" }
{ "index": 1400, "split": "train" }
Which are the top three stadiums, in terms of average stadium ID, that hosted games during the 2007, 2012, or 2013 seasons, and what was their total attendance?
game_injury
select t0.total_attendance, t0.id as c0 from stadium as t0 join game as t1 on t0.id = t1.stadium_id where t1.season between 2012 and 2013 or t1.season = 2007 group by c0 having count(*) >= 1 order by avg(t1.stadium_id) desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_injury", "sql": "select t0.total_attendance, t0.id as c0 from stadium as t0 join game as t1 on t0.id = t1.stadium_id where t1.season between 2012 and 2013 or t1.season = 2007 group by c0 having count(*) >= 1 order by avg(t1.stadium_id) desc limit 3" }, "style": "rule" }
{ "index": 1376, "split": "train" }
Can you list the names of all individuals who are either involved in repairs or are technicians?
machine_repair
select anon_1.c0 from (select name as c0 from repair union select name from technician) 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": "machine_repair", "sql": "select anon_1.c0 from (select name as c0 from repair union select name from technician) as anon_1" }, "style": "rule" }
{ "index": 2280, "split": "train" }
What is the percentage change of the maximum purchase transaction amount for 'PUR' transactions at 1982-06-06 17:19:00 compared to its previous value?
tracking_share_transactions
select (t0.c1 / cast(t0.c1 as real) - 1) * 100 from (select max(t1.amount_of_transaction) as c1 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 = '1982-06-06 17:19:00' group by t0.transactio...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c1 / cast(t0.c1 as real) - 1) * 100 from (select max(t1.amount_of_transaction) as c1 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": 3428, "split": "train" }
Which race name, among those where the earliest circuit ID it occurred at is between 23 and 46, has the lowest such earliest circuit ID?
formula_1
select name as c0 from races group by c0 having min(circuitid) between 23 and 46 order by min(circuitid) asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "formula_1", "sql": "select name as c0 from races group by c0 having min(circuitid) between 23 and 46 order by min(circuitid) asc nulls last limit 1" }, "style": "rule" }
{ "index": 64, "split": "train" }
For each order quantity in the Order Items, what is the smallest number of rows recorded and the average product ID, when sorted by order quantity from lowest to highest?
customers_and_products_contacts
select order_quantity as c0, count(*), avg(product_id) from order_items group by c0 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select order_quantity as c0, count(*), avg(product_id) from order_items group by c0 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 152, "split": "train" }
How much larger is the game ID associated with the injury accident record 11 compared to the one linked to record 6?
game_injury
select t1.c0 - t0.c0 from (select game_id as c0 from injury_accident where id = 6) as t1, (select game_id as c0 from injury_accident where id = 11) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_injury", "sql": "select t1.c0 - t0.c0 from (select game_id as c0 from injury_accident where id = 6) as t1, (select game_id as c0 from injury_accident where id = 11) as t0" }, "style": "rule" }
{ "index": 3610, "split": "train" }
Which customers who pay by Direct Debit and have a phone number matching "7193x818" have their Customer ID and Outcome Code recorded along with their names?
customers_campaigns_ecommerce
select t0.customer_id, t0.outcome_code, t1.customer_name from mailshot_customers as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.payment_method = 'Direct Debit' and t1.customer_phone like '%7193x818%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_campaigns_ecommerce", "sql": "select t0.customer_id, t0.outcome_code, t1.customer_name from mailshot_customers as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.payment_method = 'Direct Debit' and t1.customer_phone like '%7193x818%'" }, "style":...
{ "index": 518, "split": "train" }
What are the different genders and ages of people who are friends in years before 12 or after 10?
network_2
select distinct t0.gender, t0.age from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.year < 12 or t1.year > 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 distinct t0.gender, t0.age from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.year < 12 or t1.year > 10" }, "style": "rule" }
{ "index": 685, "split": "train" }
Which three camera lens brands are most commonly used for photos with the most frequent photo name or with the name 'cloud', sorted alphabetically in reverse order?
mountain_photos
select t0.brand as c0 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id, (select name as c1 from photos group by c1 order by count(*) desc limit 1) as t0 where t1.name = t0.c1 or t1.name = 'cloud' 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": "mountain_photos", "sql": "select t0.brand as c0 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id, (select name as c1 from photos group by c1 order by count(*) desc limit 1) as t0 where t1.name = t0.c1 or t1.name = 'cloud' order by c0 desc limit 3" }, "sty...
{ "index": 2936, "split": "train" }
Which customers with only one address are either the one with the highest minimum address ID or are customer number 5? For those customers, what is their payment method, the date they became a customer, and their customer ID?
customer_deliveries
select t0.payment_method, t0.date_became_customer, t0.customer_id as c2 from customers as t0 join customer_addresses as t1 on t0.customer_id = t1.customer_id, (select customer_id as c0 from customer_addresses group by c0 order by min(address_id) desc limit 1) as t0 where t1.customer_id = t0.c0 or t1.customer_id = 5 gro...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t0.payment_method, t0.date_became_customer, t0.customer_id as c2 from customers as t0 join customer_addresses as t1 on t0.customer_id = t1.customer_id, (select customer_id as c0 from customer_addresses group by c0 order by min(address_id) desc...
{ "index": 2062, "split": "train" }
Who are the first ten customers by last name whose support representatives were hired between October 17, 2003, and January 2, 2004, or hired after March 4, 2004?
store_1
select t0.id, t0.last_name as c1 from customers as t0 join employees as t1 on t0.support_rep_id = t1.id where t1.hire_date between '2003-10-17 00:00:00' and '2004-01-02 00:00:00' or t1.hire_date > '2004-03-04 00:00:00' order by c1 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t0.id, t0.last_name as c1 from customers as t0 join employees as t1 on t0.support_rep_id = t1.id where t1.hire_date between '2003-10-17 00:00:00' and '2004-01-02 00:00:00' or t1.hire_date > '2004-03-04 00:00:00' order by c1 asc nulls last limit 10" }, ...
{ "index": 846, "split": "train" }
Which are the three dorms with dorm ID 104 that have at most five amenities, sorted by the lowest average amenity ID, including their student capacity and dorm ID?
dorm_1
select t0.student_capacity, t0.dormid as c1 from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where c1 = 104 group by c1 having count(*) <= 5 order by avg(t1.amenid) asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select t0.student_capacity, t0.dormid as c1 from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where c1 = 104 group by c1 having count(*) <= 5 order by avg(t1.amenid) asc nulls last limit 3" }, "style": "rule" }
{ "index": 1928, "split": "train" }
What are the staff IDs, genders, and names of staff members who have logged faults for assets with IDs up to 6, but who have not participated in engineer visits where the contact staff ID was less than 4?
assets_maintenance
select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.staff_id as c0, t0.gender as c1, t0.staff_name as c2 from staff as t0 join fault_log as t1 on t0.staff_id = t1.recorded_by_staff_id where t1.asset_id <= 6 except select t0.staff_id as c0, t0.gender as c1, t0.staff_name as c2 from staff as t0 join engineer_visits as...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.staff_id as c0, t0.gender as c1, t0.staff_name as c2 from staff as t0 join fault_log as t1 on t0.staff_id = t1.recorded_by_staff_id where t1.asset_id <= 6 except select t0.staff_id as c0, t0.gende...
{ "index": 2628, "split": "train" }
Find the names and high school scores of players, along with their player IDs and tryout decisions, for those who tried out at colleges with enrollment of at least 19,000 students and whose college names end with "SU".
soccer_2
select t0.pname, t0.hs, t1.pid, t1.decision from player as t0 join tryout as t1 on t0.pid = t1.pid join college as t2 on t1.cname = t2.cname where t2.enr >= 19000 and t2.cname like '%SU'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_2", "sql": "select t0.pname, t0.hs, t1.pid, t1.decision from player as t0 join tryout as t1 on t0.pid = t1.pid join college as t2 on t1.cname = t2.cname where t2.enr >= 19000 and t2.cname like '%SU'" }, "style": "rule" }
{ "index": 163, "split": "train" }
How does the Cmi Cross Reference ID for the electoral register entry with ID 4 compare to 75?
local_govt_mdm
select cmi_cross_ref_id - 75 from electoral_register where electoral_register_id = 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": "local_govt_mdm", "sql": "select cmi_cross_ref_id - 75 from electoral_register where electoral_register_id = 4" }, "style": "rule" }
{ "index": 3861, "split": "train" }
What is the smallest student ID among students who received a 'C' grade and have IDs between 1004 and 1017?
college_3
select t0.c2 from (select min(t1.stuid) as c2 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t0.lettergrade = 'C' and t1.stuid between 1004 and 1017 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.c2 from (select min(t1.stuid) as c2 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t0.lettergrade = 'C' and t1.stuid between 1004 and 1017 group by t0.lettergrade) as t0" }, "style": "rule" }
{ "index": 3974, "split": "train" }
How much does the total sum of product ID 6 in the 'regular_order_products' table differ from 4?
customer_deliveries
select t0.c0 - 4 from (select sum(t1.product_id) as c0 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t0.product_id = 6 group by t0.product_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": "customer_deliveries", "sql": "select t0.c0 - 4 from (select sum(t1.product_id) as c0 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t0.product_id = 6 group by t0.product_id) as t0" }, "style": "rule" }
{ "index": 3223, "split": "train" }
Which circuits hosted both the race with ID 84 and a race starting at 11:00:00, and what are their circuit IDs and locations?
formula_1
select anon_1.c0, anon_1.c1 from (select t0.circuitid as c0, t0.location as c1 from circuits as t0 join races as t1 on t0.circuitid = t1.circuitid where t1.raceid = 84 intersect select t0.circuitid as c0, t0.location as c1 from circuits as t0 join races as t1 on t0.circuitid = t1.circuitid where t1.time = '11:00:00') 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": "formula_1", "sql": "select anon_1.c0, anon_1.c1 from (select t0.circuitid as c0, t0.location as c1 from circuits as t0 join races as t1 on t0.circuitid = t1.circuitid where t1.raceid = 84 intersect select t0.circuitid as c0, t0.location as c1 from circuits as t0 join races as t1 ...
{ "index": 1313, "split": "train" }
Which customers have checking account numbers, their checking balances, names, and account IDs, where their savings account balance is either extremely high (over 1 billion) or above 60?
small_bank_1
select t0.custid, t0.balance, t1.name, t1.custid from checking as t0 join accounts as t1 on t0.custid = t1.custid join savings as t2 on t1.custid = t2.custid where t2.balance > 999999999.0 or t2.balance > 60.0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select t0.custid, t0.balance, t1.name, t1.custid from checking as t0 join accounts as t1 on t0.custid = t1.custid join savings as t2 on t1.custid = t2.custid where t2.balance > 999999999.0 or t2.balance > 60.0" }, "style": "rule" }
{ "index": 84, "split": "train" }
Which customers have used the fewest different coupons, and how many unique coupons did each of them use? Please provide their Customer Ids along with the count of distinct Coupon Ids used.
products_for_hire
select t0.customer_id as c1, count(distinct (t0.coupon_id)) from customers as t0, (select first_name as c2 from customers group by c2 order by count(*) asc nulls last limit 1) as t0 where t0.first_name = t0.c2 group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select t0.customer_id as c1, count(distinct (t0.coupon_id)) from customers as t0, (select first_name as c2 from customers group by c2 order by count(*) asc nulls last limit 1) as t0 where t0.first_name = t0.c2 group by c1" }, "style": "rule" }
{ "index": 2513, "split": "train" }
What is the average staff ID of those who authorized the closure of problems for product 13, where the problems were reported by staff with IDs between 2 and 7?
tracking_software_problems
select t0.c2 from (select avg(t1.closure_authorised_by_staff_id) as c2 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t0.product_id = 13 and t1.reported_by_staff_id between 2 and 7 group by t0.product_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": "tracking_software_problems", "sql": "select t0.c2 from (select avg(t1.closure_authorised_by_staff_id) as c2 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t0.product_id = 13 and t1.reported_by_staff_id between 2 and 7 group by t0.product_id) as t0" ...
{ "index": 3405, "split": "train" }
For each enrollment grade that ends with the letter "B," what are the top 10 enrollment grades along with the number of unique students who received each grade, sorted alphabetically by enrollment grade?
college_1
select enroll_grade as c0, count(distinct (stu_num)) from enroll where c0 like '%B' group by c0 order by c0 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_1", "sql": "select enroll_grade as c0, count(distinct (stu_num)) from enroll where c0 like '%B' group by c0 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 1447, "split": "train" }
Which web client accelerators, along with their client, connection type, and identifier, have been compatible with browsers since or before 2009, and how many browsers are they compatible with?
browser_web
select t0.client, t0.connection, t0.id as c0, count(*) from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id where t1.compatible_since_year <= 2009 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": "browser_web", "sql": "select t0.client, t0.connection, t0.id as c0, count(*) from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id where t1.compatible_since_year <= 2009 group by c0" }, "style": "rule" }
{ "index": 1278, "split": "train" }
What are the track IDs, invoice line IDs, and invoice IDs for invoice lines linked to customers supported by employees who report to a manager with an ID of 2 or less?
store_1
select anon_1.c1, anon_1.c0, anon_1.c2 from (select track_id as c1, id as c0, invoice_id as c2 from invoice_lines intersect select t0.track_id as c1, t0.id as c0, t0.invoice_id as c2 from invoice_lines as t0 join invoices as t1 on t0.invoice_id = t1.id join customers as t2 on t1.customer_id = t2.id join employees as t3...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select anon_1.c1, anon_1.c0, anon_1.c2 from (select track_id as c1, id as c0, invoice_id as c2 from invoice_lines intersect select t0.track_id as c1, t0.id as c0, t0.invoice_id as c2 from invoice_lines as t0 join invoices as t1 on t0.invoice_id = t1.id join cust...
{ "index": 2943, "split": "train" }
What are the names and codes of the top 3 projects, along with the scientist's SSN, for the scientist with SSN 654873219, listed in reverse alphabetical order of the project codes?
scientist_1
select t0.name, t0.code, t1.scientist, t1.project as c2 from projects as t0 join assignedto as t1 on t0.code = t1.project join scientists as t2 on t1.scientist = t2.ssn where t2.ssn = 654873219 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": "scientist_1", "sql": "select t0.name, t0.code, t1.scientist, t1.project as c2 from projects as t0 join assignedto as t1 on t0.code = t1.project join scientists as t2 on t1.scientist = t2.ssn where t2.ssn = 654873219 order by c2 desc limit 3" }, "style": "rule" }
{ "index": 1019, "split": "train" }
When did the customer with the highest customer ID who has account details ending with "IP" open their account?
customers_and_invoices
select t0.date_account_opened, t0.customer_id as c1 from accounts as t0, (select max(customer_id) as c2 from accounts where other_account_details like '%IP') as t1 where c1 = t1.c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t0.date_account_opened, t0.customer_id as c1 from accounts as t0, (select max(customer_id) as c2 from accounts where other_account_details like '%IP') as t1 where c1 = t1.c2" }, "style": "rule" }
{ "index": 3757, "split": "train" }
Can you tell me how the total sum of lot IDs for lot 10 compares to the lowest total sum of lot IDs among the lots owned by investors with IDs between 6 and 10?
tracking_share_transactions
select t2.c1 - t0.c0 from (select min(t1.c0) as c1 from (select sum(t1.lot_id) as c0 from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id where t0.investor_id between 6 and 10 group by t0.lot_id) as t1) as t2, (select t0.lot_id, sum(t1.lot_id) as c0 from lots as t0 join transactions_lots as t1 on t0.lo...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c1 - t0.c0 from (select min(t1.c0) as c1 from (select sum(t1.lot_id) as c0 from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id where t0.investor_id between 6 and 10 group by t0.lot_id) as t1) as t2, (select t0.lot_...
{ "index": 3205, "split": "train" }
Which match results involve clubs with a specific coach (coach ID 1), and what are the club IDs and gold medals for those matches? Also, include the club ID of the club associated with each match.
riding_club
select t0.club_id, t0.gold, t1.club_id from match_result as t0 join club as t1 on t0.club_id = t1.club_id join coach as t2 on t1.club_id = t2.club_id join player_coach as t3 on t2.coach_id = t3.coach_id where t3.coach_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": "riding_club", "sql": "select t0.club_id, t0.gold, t1.club_id from match_result as t0 join club as t1 on t0.club_id = t1.club_id join coach as t2 on t1.club_id = t2.club_id join player_coach as t3 on t2.coach_id = t3.coach_id where t3.coach_id = 1" }, "style": "rule" }
{ "index": 2254, "split": "train" }
How many unique medicine names and IDs are associated with medicines that interact with enzymes having ID 3 or 1, when sorted by the total number of unique medicine IDs?
medicine_enzyme_interaction
select count(distinct (t0.name)), count(distinct (t0.id)) as c0 from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.medicine_id = 3 or t1.medicine_id = 1 order by c0 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select count(distinct (t0.name)), count(distinct (t0.id)) as c0 from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.medicine_id = 3 or t1.medicine_id = 1 order by c0 asc nulls last" }, "style": "r...
{ "index": 1112, "split": "train" }
Can you tell me the Customer Id, Order Id, and order details for orders that include products of the most frequently occurring size?
customers_and_invoices
select product_size as c0 from products group by c0 order by count(*) 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": "customers_and_invoices", "sql": "select product_size as c0 from products group by c0 order by count(*) desc limit 1" }, "style": "rule" }
{ "index": 1065, "split": "train" }
What is the smallest building ID for building 808 that contains apartments with five or fewer bedrooms?
apartment_rentals
select t0.c0 from (select min(t1.building_id) as c0 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t0.building_id = 808 and t1.bedroom_count <= 5 group by t0.building_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select t0.c0 from (select min(t1.building_id) as c0 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t0.building_id = 808 and t1.bedroom_count <= 5 group by t0.building_id) as t0" }, "style": "rule" }
{ "index": 3353, "split": "train" }
How many days typically pass between the Date Assigned From and Date Assigned To in staff department assignments?
department_store
select julianday(t1.c3) - julianday(t0.c0) from (select date_assigned_to as c3 from staff_department_assignments) as t1, (select date_assigned_from as c0 from staff_department_assignments where c0 < '2017-12-26 06:34:20' and c0 < '2017-12-26 06:34:20') 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.c3) - julianday(t0.c0) from (select date_assigned_to as c3 from staff_department_assignments) as t1, (select date_assigned_from as c0 from staff_department_assignments where c0 < '2017-12-26 06:34:20' and c0 < '2017-12-26 06:34:20') ...
{ "index": 3949, "split": "train" }
When were the songs with resolution at least 512 and the highest rating released?
music_1
select t0.releasedate, t0.rating as c3 from song as t0, (select max(rating) as c1 from song where resolution >= 512) as t1 where c3 = t1.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t0.releasedate, t0.rating as c3 from song as t0, (select max(rating) as c1 from song where resolution >= 512) as t1 where c3 = t1.c1" }, "style": "rule" }
{ "index": 3787, "split": "train" }
What are the details of the top 3 train stations with the highest annual entry and exit numbers, including their main services and names, along with their station IDs, where the stations are served by trains departing at times that start with "11" or contain the digit "1," ordered by the highest annual entry and exit f...
train_station
select t0.annual_entry_exit as c1, t0.main_services, t0.name, t1.station_id from station as t0 join train_station as t1 on t0.station_id = t1.station_id join train as t2 on t1.train_id = t2.train_id where t2.time like '11%' or t2.time like '%1%' order by c1 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "train_station", "sql": "select t0.annual_entry_exit as c1, t0.main_services, t0.name, t1.station_id from station as t0 join train_station as t1 on t0.station_id = t1.station_id join train as t2 on t1.train_id = t2.train_id where t2.time like '11%' or t2.time like '%1%' order by c...
{ "index": 2908, "split": "train" }
What are the checking balance, customer ID, and name of the customer with custid 4?
small_bank_1
select t0.balance, t0.custid, t1.name from checking as t0 join accounts as t1 on t0.custid = t1.custid where t1.custid = 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": "small_bank_1", "sql": "select t0.balance, t0.custid, t1.name from checking as t0 join accounts as t1 on t0.custid = t1.custid where t1.custid = 4" }, "style": "rule" }
{ "index": 405, "split": "train" }
Show the ages and names of the three youngest journalists who reported on events held at venues containing "tho," ordered by age from youngest to oldest.
news_report
select t0.age as c0, t0.name from journalist as t0 join news_report as t1 on t0.journalist_id = t1.journalist_id join event as t2 on t1.event_id = t2.event_id where t2.venue like '%tho%' 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": "news_report", "sql": "select t0.age as c0, t0.name from journalist as t0 join news_report as t1 on t0.journalist_id = t1.journalist_id join event as t2 on t1.event_id = t2.event_id where t2.venue like '%tho%' order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 384, "split": "train" }
Is the organization associated with service ID 41 assigned a higher Organization ID than the smallest Organization ID among services whose type code contains "Chec"?
local_govt_and_lot
select t2.c3 > t1.c0 from (select organization_id as c3 from services where service_id = 41) as t2, (select min(organization_id) as c0 from services where service_type_code like '%Chec%') as t1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t2.c3 > t1.c0 from (select organization_id as c3 from services where service_id = 41) as t2, (select min(organization_id) as c0 from services where service_type_code like '%Chec%') as t1" }, "style": "rule" }
{ "index": 3952, "split": "train" }
Which allergy has the smallest number of students affected, and how many students have that allergy?
allergy_1
select allergy as c1, count(stuid) as c0 from has_allergy group by c1 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "allergy_1", "sql": "select allergy as c1, count(stuid) as c0 from has_allergy group by c1 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 2582, "split": "train" }
Show the five highest product IDs from "Products_in_Events" where each product ID is either in the list of all product IDs from the "Products" table or is less than 34, ordered from largest to smallest.
solvency_ii
select product_id as c0 from products_in_events where c0 in (select c0 as c1 from products) or c0 < 34 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": "solvency_ii", "sql": "select product_id as c0 from products_in_events where c0 in (select c0 as c1 from products) or c0 < 34 order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2483, "split": "train" }
What is the master customer ID for the customer record in the Customer Master Index that has the details 'Gottlieb, Becker and Wyman' and a master customer ID of 5?
local_govt_mdm
select master_customer_id as c0 from customer_master_index where cmi_details = 'Gottlieb, Becker and Wyman' and c0 = 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": "local_govt_mdm", "sql": "select master_customer_id as c0 from customer_master_index where cmi_details = 'Gottlieb, Becker and Wyman' and c0 = 5" }, "style": "rule" }
{ "index": 24, "split": "train" }
Show the details of investors who conducted transactions with a type code ending in "SALE" and whose transaction date was on or after November 1, 1983, at 5:57 PM.
tracking_share_transactions
select t0.investor_details from investors as t0 join transactions as t1 on t0.investor_id = t1.investor_id where t1.transaction_type_code like '%SALE' and t1.date_of_transaction >= '1983-11-01 17:57:27'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.investor_details from investors as t0 join transactions as t1 on t0.investor_id = t1.investor_id where t1.transaction_type_code like '%SALE' and t1.date_of_transaction >= '1983-11-01 17:57:27'" }, "style": "rule" }
{ "index": 711, "split": "train" }
Is the average premise ID for premise 8 greater than 5.0?
customers_campaigns_ecommerce
select t0.c1 > 5.0 from (select avg(t1.premise_id) as c1 from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id where t0.premise_id = 8 group by t0.premise_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": "customers_campaigns_ecommerce", "sql": "select t0.c1 > 5.0 from (select avg(t1.premise_id) as c1 from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id where t0.premise_id = 8 group by t0.premise_id) as t0" }, "style": "rule" }
{ "index": 3292, "split": "train" }
What are the details of the projects that have outcomes with codes containing the substring "tent"?
tracking_grants_for_research
select t0.project_details from projects as t0 join project_outcomes as t1 on t0.project_id = t1.project_id where t1.outcome_code like '%tent%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.project_details from projects as t0 join project_outcomes as t1 on t0.project_id = t1.project_id where t1.outcome_code like '%tent%'" }, "style": "rule" }
{ "index": 1327, "split": "train" }
How many different transaction types and how many unique invoices are there for invoice number 14 or the most frequently used invoice number, sorted by the number of distinct transaction types?
customers_and_invoices
select count(distinct (t0.transaction_type)) as c2, count(distinct (t1.invoice_number)) from financial_transactions as t0 join invoices as t1 on t0.invoice_number = t1.invoice_number, (select invoice_number as c0 from invoices group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.invoice_number = 14 or 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": "customers_and_invoices", "sql": "select count(distinct (t0.transaction_type)) as c2, count(distinct (t1.invoice_number)) from financial_transactions as t0 join invoices as t1 on t0.invoice_number = t1.invoice_number, (select invoice_number as c0 from invoices group by c0 order by...
{ "index": 1605, "split": "train" }
Which coupon amounts and coupon IDs are associated with customers whose first names contain "eova" and also with customers whose first names contain "i"?
products_for_hire
select anon_1.c0, anon_1.c1 from (select t0.coupon_amount as c0, t0.coupon_id as c1 from discount_coupons as t0 join customers as t1 on t0.coupon_id = t1.coupon_id where t1.first_name like '%eova%' intersect select t0.coupon_amount as c0, t0.coupon_id as c1 from discount_coupons as t0 join customers as t1 on t0.coupon_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select anon_1.c0, anon_1.c1 from (select t0.coupon_amount as c0, t0.coupon_id as c1 from discount_coupons as t0 join customers as t1 on t0.coupon_id = t1.coupon_id where t1.first_name like '%eova%' intersect select t0.coupon_amount as c0, t0.coupon_id ...
{ "index": 1297, "split": "train" }
What is the birthday of the player with the highest player ID who weighs between 152 and 174?
soccer_1
select t0.birthday, t0.player_api_id as c2 from player as t0, (select max(player_api_id) as c3 from player where weight between 152 and 174) as t1 where c2 = t1.c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select t0.birthday, t0.player_api_id as c2 from player as t0, (select max(player_api_id) as c3 from player where weight between 152 and 174) as t1 where c2 = t1.c3" }, "style": "rule" }
{ "index": 3791, "split": "train" }
Which hosts have participated in the party with host ID 5 but have not participated in any other valid parties? Show their names, ages, and host IDs.
party_host
select anon_1.c1, anon_1.c3, anon_1.c0 from (select t0.name as c1, t0.age as c3, t0.host_id as c0 from host as t0 join party_host as t1 on t0.host_id = t1.host_id where t1.host_id = 5 except select t0.name as c1, t0.age as c3, t0.host_id as c0 from host as t0 join party_host as t1 on t0.host_id = t1.host_id where (not ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "party_host", "sql": "select anon_1.c1, anon_1.c3, anon_1.c0 from (select t0.name as c1, t0.age as c3, t0.host_id as c0 from host as t0 join party_host as t1 on t0.host_id = t1.host_id where t1.host_id = 5 except select t0.name as c1, t0.age as c3, t0.host_id as c0 from host as t0...
{ "index": 2650, "split": "train" }
Which ten countries have the lowest number of perpetrators recorded?
perpetrator
select country as c0 from perpetrator group by c0 order by count(country) 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": "perpetrator", "sql": "select country as c0 from perpetrator group by c0 order by count(country) asc nulls last limit 10" }, "style": "rule" }
{ "index": 2772, "split": "train" }
Who are the top 10 players, including their ID, yellow card count, decision, and position, who tried out at colleges with enrollments smaller than the smallest college or at most 12,000 students, sorted by their position from highest to lowest?
soccer_2
select t0.pid, t0.ycard, t1.decision, t1.ppos as c4 from player as t0 join tryout as t1 on t0.pid = t1.pid join college as t2 on t1.cname = t2.cname, (select min(enr) as c1 from college) as t0 where t2.enr < t0.c1 or t2.enr <= 12000 order by c4 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": "soccer_2", "sql": "select t0.pid, t0.ycard, t1.decision, t1.ppos as c4 from player as t0 join tryout as t1 on t0.pid = t1.pid join college as t2 on t1.cname = t2.cname, (select min(enr) as c1 from college) as t0 where t2.enr < t0.c1 or t2.enr <= 12000 order by c4 desc limit 10" ...
{ "index": 2311, "split": "train" }
Who are the top five players with the most years played, along with their team IDs and team names, for the most recent match season?
match_season
select t0.player as c3, t0.years_played, t1.team_id, t1.name from player as t0 join team as t1 on t0.team = t1.team_id join match_season as t2 on t1.team_id = t2.team, (select season as c1 from match_season group by c1 order by count(*) asc nulls last limit 1) as t0 where t2.season = t0.c1 order by c3 asc nulls last li...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "match_season", "sql": "select t0.player as c3, t0.years_played, t1.team_id, t1.name from player as t0 join team as t1 on t0.team = t1.team_id join match_season as t2 on t1.team_id = t2.team, (select season as c1 from match_season group by c1 order by count(*) asc nulls last limit...
{ "index": 1904, "split": "train" }
What are the earliest years of friendship for the top five female individuals when sorted alphabetically by their names?
network_2
select min(t0.year) from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.gender like 'fe%' group by t1.name order by t1.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": "network_2", "sql": "select min(t0.year) from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.gender like 'fe%' group by t1.name order by t1.name asc nulls last limit 5" }, "style": "rule" }
{ "index": 2, "split": "train" }
Can you provide the gender code, first name, and date of birth for all guests, including those who have booked apartment number 4?
apartment_rentals
select anon_1.c2, anon_1.c1, anon_1.c0 from (select gender_code as c2, guest_first_name as c1, date_of_birth as c0 from guests union select t0.gender_code as c2, t0.guest_first_name as c1, t0.date_of_birth as c0 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id join apartments as t2 on t1.apt...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c2, anon_1.c1, anon_1.c0 from (select gender_code as c2, guest_first_name as c1, date_of_birth as c0 from guests union select t0.gender_code as c2, t0.guest_first_name as c1, t0.date_of_birth as c0 from guests as t0 join apartment_booking...
{ "index": 2725, "split": "train" }
Is the release year of the movie with ID 2 later than the release year of the movie with ID 6?
culture_company
select t1.c2 > t0.c2 from (select year as c2 from movie where movie_id = 6) as t1, (select year as c2 from movie where movie_id = 2) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "culture_company", "sql": "select t1.c2 > t0.c2 from (select year as c2 from movie where movie_id = 6) as t1, (select year as c2 from movie where movie_id = 2) as t0" }, "style": "rule" }
{ "index": 3901, "split": "train" }
Can you tell me the names and eids of the first three employees (listed alphabetically) who are certified on the most common aircraft?
flight_1
select t0.name as c1 from employee as t0 join certificate as t1 on t0.eid = t1.eid, (select aid as c0 from certificate group by c0 order by count(*) desc limit 1) as t0 where t1.aid = t0.c0 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": "flight_1", "sql": "select t0.name as c1 from employee as t0 join certificate as t1 on t0.eid = t1.eid, (select aid as c0 from certificate group by c0 order by count(*) desc limit 1) as t0 where t1.aid = t0.c0 order by c1 asc nulls last limit 3" }, "style": "rule" }
{ "index": 1490, "split": "train" }