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
Who are the checking account customers with the name O'Mahony or the most common customer name, and what are their customer IDs? Please list up to five of these customers, ordered by their names in reverse alphabetical order.
small_bank_1
select t0.custid from checking as t0 join accounts as t1 on t0.custid = t1.custid, (select name as c1 from accounts group by c1 order by count(*) desc limit 1) as t0 where t1.name = 'O''mahony' or t1.name = t0.c1 order by t1.name 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": "small_bank_1", "sql": "select t0.custid from checking as t0 join accounts as t1 on t0.custid = t1.custid, (select name as c1 from accounts group by c1 order by count(*) desc limit 1) as t0 where t1.name = 'O''mahony' or t1.name = t0.c1 order by t1.name desc limit 5" }, "style...
{ "index": 71, "split": "train" }
When did the customer with the highest customer ID greater than 5 place an order?
customers_and_addresses
select t0.order_date, t0.customer_id as c2 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where customer_id > 5) as t1 where c2 = t1.c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t0.order_date, t0.customer_id as c2 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where customer_id > 5) as t1 where c2 = t1.c3" }, "style": "rule" }
{ "index": 3755, "split": "train" }
Can you find the ID, country, and pilot name of the first airport linked to an operating company with either more than 60% or exactly 30% group equity shareholding, ordered by pilot name with nulls last?
flight_company
select t0.id, t0.country, t1.pilot as c1 from airport as t0 join flight as t1 on t0.id = t1.airport_id join operate_company as t2 on t1.company_id = t2.id where t2.group_equity_shareholding > 60.0 or t2.group_equity_shareholding = 30.0 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_company", "sql": "select t0.id, t0.country, t1.pilot as c1 from airport as t0 join flight as t1 on t0.id = t1.airport_id join operate_company as t2 on t1.company_id = t2.id where t2.group_equity_shareholding > 60.0 or t2.group_equity_shareholding = 30.0 order by c1 asc nul...
{ "index": 2841, "split": "train" }
Which five companies have the highest rank, and what are their headquarters and sales in billion dollars, for gas stations whose representatives' names end with "ive Burr" or contain "ris Pya," sorted from the highest to lowest rank?
gas_company
select t0.headquarters, t0.sales_billion, t0.rank as c1 from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id where t2.representative_name like '%ive Burr' or t2.representative_name like '%ris Pya%' order by c1 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "gas_company", "sql": "select t0.headquarters, t0.sales_billion, t0.rank as c1 from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id where t2.representative_name like '%ive Burr' or t2.representative_...
{ "index": 2004, "split": "train" }
Can you tell me which campuses and years have either faculty information or degree information?
csu_1
select anon_1.c0, anon_1.c2 from (select campus as c0, year as c2 from faculty union select campus, year from degrees) 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": "csu_1", "sql": "select anon_1.c0, anon_1.c2 from (select campus as c0, year as c2 from faculty union select campus, year from degrees) as anon_1" }, "style": "rule" }
{ "index": 2882, "split": "train" }
Which districts and committees are associated with elections held between 2002 and 2006, excluding those involving the party with ID 2?
election
select anon_1.c0, anon_1.c1 from (select t0.district as c0, t0.committee as c1 from election as t0 join party as t1 on t0.party = t1.party_id where t1.year between 2002.0 and 2006.0 except select t0.district as c0, t0.committee as c1 from election as t0 join party as t1 on t0.party = t1.party_id where t1.party_id = 2) ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "election", "sql": "select anon_1.c0, anon_1.c1 from (select t0.district as c0, t0.committee as c1 from election as t0 join party as t1 on t0.party = t1.party_id where t1.year between 2002.0 and 2006.0 except select t0.district as c0, t0.committee as c1 from election as t0 join pa...
{ "index": 1412, "split": "train" }
What are the account IDs and transaction types for customers with ID 8 or those whose IDs are between 13 and 15?
customers_card_transactions
select t0.account_id, t0.transaction_type from financial_transactions as t0 join customers_cards as t1 on t0.card_id = t1.card_id where t1.customer_id = 8 or t1.customer_id between 13 and 15
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select t0.account_id, t0.transaction_type from financial_transactions as t0 join customers_cards as t1 on t0.card_id = t1.card_id where t1.customer_id = 8 or t1.customer_id between 13 and 15" }, "style": "rule" }
{ "index": 333, "split": "train" }
What are the political party and home city of drivers, combined with those who are associated with the school that has the fewest students?
school_bus
select anon_1.c1, anon_1.c0 from (select party as c1, home_city as c0 from driver union select t0.party as c1, t0.home_city as c0 from driver as t0 join school_bus as t1 on t0.driver_id = t1.driver_id join school as t2 on t1.school_id = t2.school_id, (select school as c2 from school group by c2 order by count(*) asc nu...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "school_bus", "sql": "select anon_1.c1, anon_1.c0 from (select party as c1, home_city as c0 from driver union select t0.party as c1, t0.home_city as c0 from driver as t0 join school_bus as t1 on t0.driver_id = t1.driver_id join school as t2 on t1.school_id = t2.school_id, (select ...
{ "index": 1679, "split": "train" }
Is the invoice date for invoice number 15 earlier than the invoice date for invoice number 5?
customers_and_invoices
select t1.c2 < t0.c2 from (select invoice_date as c2 from invoices where invoice_number = 15) as t1, (select invoice_date as c2 from invoices where invoice_number = 5) 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_invoices", "sql": "select t1.c2 < t0.c2 from (select invoice_date as c2 from invoices where invoice_number = 15) as t1, (select invoice_date as c2 from invoices where invoice_number = 5) as t0" }, "style": "rule" }
{ "index": 3125, "split": "train" }
What are the student first names and the highest advisor number associated with each name?
activity_1
select fname as c0, max(advisor) from student 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": "activity_1", "sql": "select fname as c0, max(advisor) from student group by c0" }, "style": "rule" }
{ "index": 2710, "split": "train" }
How many unique email addresses do students involved in behavior incidents have, and what is the total sum of their student IDs, considering only incidents where the student ID is less than the average student ID across all incidents?
behavior_monitoring
select count(distinct (t0.email_address)), sum(t1.student_id) from students as t0 join behavior_incident as t1 on t0.student_id = t1.student_id, (select avg(student_id) as c0 from behavior_incident) as t0 where t1.student_id < t0.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select count(distinct (t0.email_address)), sum(t1.student_id) from students as t0 join behavior_incident as t1 on t0.student_id = t1.student_id, (select avg(student_id) as c0 from behavior_incident) as t0 where t1.student_id < t0.c0" }, "style": ...
{ "index": 1728, "split": "train" }
Which operate companies, along with their IDs and the dates they operated flights, have worked at airports with IDs of 2 or less?
flight_company
select t0.id, t0.name, t1.date from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t1.airport_id <= 2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_company", "sql": "select t0.id, t0.name, t1.date from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t1.airport_id <= 2" }, "style": "rule" }
{ "index": 446, "split": "train" }
Based on the number of unique companies associated with each book club (considering only movies with IDs containing "6"), what is the ranking of the book clubs that have exactly six companies when sorted in ascending order?
culture_company
select t1.c0, t1.c1 as c4 from (select row_number() over (order by t0.c5 asc nulls last) as c0, t0.c2 as c1 from (select t0.book_club_id as c2, count(distinct (t1.company_name)) as c5 from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where t1.movie_id like '%6%' group by c2) as t0) 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": "culture_company", "sql": "select t1.c0, t1.c1 as c4 from (select row_number() over (order by t0.c5 asc nulls last) as c0, t0.c2 as c1 from (select t0.book_club_id as c2, count(distinct (t1.company_name)) as c5 from book_club as t0 join culture_company as t1 on t0.book_club_id = t...
{ "index": 3471, "split": "train" }
Which Panasonic camera lenses with a maximum aperture of at least 2.0 have their IDs and focal lengths listed?
mountain_photos
select id, focal_length_mm, brand as c1 from camera_lens where c1 = 'Panasonic' and max_aperture >= 2.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": "mountain_photos", "sql": "select id, focal_length_mm, brand as c1 from camera_lens where c1 = 'Panasonic' and max_aperture >= 2.0" }, "style": "rule" }
{ "index": 732, "split": "train" }
What are the active status, country, name, and route ID of airlines that operate routes with destination airport ID 609 or routes whose destination airport ID is at least as large as the average destination airport ID across all routes?
flight_4
select t0.active, t0.country, t0.name, t1.rid from airlines as t0 join routes as t1 on t0.alid = t1.alid, (select avg(dst_apid) as c1 from routes) as t0 where t1.dst_apid = 609 or t1.dst_apid >= t0.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t0.active, t0.country, t0.name, t1.rid from airlines as t0 join routes as t1 on t0.alid = t1.alid, (select avg(dst_apid) as c1 from routes) as t0 where t1.dst_apid = 609 or t1.dst_apid >= t0.c1" }, "style": "rule" }
{ "index": 477, "split": "train" }
Which ten months have scheduled happy hours, listed in alphabetical order with their number of occurrences?
coffee_shop
select month as c0, count(distinct (month)) from happy_hour 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": "coffee_shop", "sql": "select month as c0, count(distinct (month)) from happy_hour group by c0 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 1324, "split": "train" }
Which cities and address IDs are linked to addresses that are associated with both people having address IDs of 9 or above and people with IDs between 131 and 141?
student_assessment
select anon_1.c0, anon_1.c1 from (select t0.city as c0, t0.address_id as c1 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where t1.address_id >= 9 intersect select t0.city as c0, t0.address_id as c1 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id whe...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select anon_1.c0, anon_1.c1 from (select t0.city as c0, t0.address_id as c1 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where t1.address_id >= 9 intersect select t0.city as c0, t0.address_id as c1 from addresses a...
{ "index": 2173, "split": "train" }
What are the campus fees and years, along with the locations and counties, for campuses with total enrollments between 9,944 and 27,281?
csu_1
select t0.campusfee, t0.year, t1.location, t1.county from csu_fees as t0 join campuses as t1 on t0.campus = t1.id join enrollments as t2 on t1.id = t2.campus where t2.totalenrollment_ay between 9944 and 27281
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "csu_1", "sql": "select t0.campusfee, t0.year, t1.location, t1.county from csu_fees as t0 join campuses as t1 on t0.campus = t1.id join enrollments as t2 on t1.id = t2.campus where t2.totalenrollment_ay between 9944 and 27281" }, "style": "rule" }
{ "index": 1033, "split": "train" }
Which track location has the most recent opening year, considering the latest opening year for each location, when looking at locations listed in reverse alphabetical order?
race_track
select max(year_opened) from track group by location order by location 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": "race_track", "sql": "select max(year_opened) from track group by location order by location desc limit 1" }, "style": "rule" }
{ "index": 2351, "split": "train" }
Show the first ten event dates along with the number of events and the highest attendance for each date, sorted in chronological order.
news_report
select date as c0, count(distinct (date)), count(event_id), max(event_attendance) from event 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": "news_report", "sql": "select date as c0, count(distinct (date)), count(event_id), max(event_attendance) from event group by c0 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 2193, "split": "train" }
What are the `f1`, `f2`, and `name` of follow relationships where the followed user has tweeted on or before March 9th, 2018, at 8:01 PM, or exactly on March 12th, 2018, at 2:30 AM?
twitter_1
select t0.f1, t0.f2, t1.name from follows as t0 join user_profiles as t1 on t0.f2 = t1.uid join tweets as t2 on t1.uid = t2.uid where t2.createdate <= '2018-03-09 20:01:02' or t2.createdate = '2018-03-12 02:30:30'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "twitter_1", "sql": "select t0.f1, t0.f2, t1.name from follows as t0 join user_profiles as t1 on t0.f2 = t1.uid join tweets as t2 on t1.uid = t2.uid where t2.createdate <= '2018-03-09 20:01:02' or t2.createdate = '2018-03-12 02:30:30'" }, "style": "rule" }
{ "index": 1757, "split": "train" }
What are the details of the top three most recent lots involved in transactions that have sales details ending with "y" or equal to "a"? For each, include the lot ID, lot details, investor ID, along with the lot ID and transaction ID of the associated transaction.
tracking_share_transactions
select t0.lot_id, t0.lot_details, t0.investor_id, t1.lot_id, t1.transaction_id as c3 from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id join transactions as t2 on t1.transaction_id = t2.transaction_id join investors as t3 on t2.investor_id = t3.investor_id join sales as t4 on t2.transaction_id = t4.s...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select t0.lot_id, t0.lot_details, t0.investor_id, t1.lot_id, t1.transaction_id as c3 from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id join transactions as t2 on t1.transaction_id = t2.transaction_id join investors as t3 o...
{ "index": 2053, "split": "train" }
Which hosts participated in the party with ID 2? Please provide their names, nationalities, and ages.
party_host
select anon_1.c0, anon_1.c1, anon_1.c2 from (select name as c0, nationality as c1, age as c2 from host intersect select t0.name as c0, t0.nationality as c1, t0.age as c2 from host as t0 join party_host as t1 on t0.host_id = t1.host_id join party as t2 on t1.party_id = t2.party_id where t2.party_id = 2) 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": "party_host", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select name as c0, nationality as c1, age as c2 from host intersect select t0.name as c0, t0.nationality as c1, t0.age as c2 from host as t0 join party_host as t1 on t0.host_id = t1.host_id join party as t2 on t1.p...
{ "index": 2073, "split": "train" }
What are the product category codes, units of measure, and descriptions of the categories that have the most frequently occurring typical selling price?
products_gen_characteristics
select t0.product_category_code, t0.unit_of_measure, t0.product_category_description from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code, (select typical_selling_price as c0 from products group by c0 order by count(*) desc limit 1) as t0 where t1.typical_selling_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select t0.product_category_code, t0.unit_of_measure, t0.product_category_description from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code, (select typical_selling_price as c0 from produ...
{ "index": 1433, "split": "train" }
Which stadium has the highest number of home games, and what are its total attendance, average attendance, and the average game ID of matches where injuries were reported?
game_injury
select t0.home_games as c1, t0.total_attendance, t0.average_attendance, avg(t2.game_id) from stadium as t0 join game as t1 on t0.id = t1.stadium_id join injury_accident as t2 on t1.id = t2.game_id group by t0.id order by 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": "game_injury", "sql": "select t0.home_games as c1, t0.total_attendance, t0.average_attendance, avg(t2.game_id) from stadium as t0 join game as t1 on t0.id = t1.stadium_id join injury_accident as t2 on t1.id = t2.game_id group by t0.id order by c1 asc nulls last limit 1" }, "st...
{ "index": 897, "split": "train" }
Who are the people whose names start with "Ali" or are exactly "Alice," and what is the average year of their friendships, along with their gender and name?
network_2
select avg(t0.year), t1.gender, t1.name as c0 from personfriend as t0 join person as t1 on t0.friend = t1.name where c0 like 'Ali%' or c0 = 'Alice' group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select avg(t0.year), t1.gender, t1.name as c0 from personfriend as t0 join person as t1 on t0.friend = t1.name where c0 like 'Ali%' or c0 = 'Alice' group by c0" }, "style": "rule" }
{ "index": 311, "split": "train" }
What are the names of catalogs and their corresponding level names at catalog level 9?
product_catalog
select t0.catalog_name, t1.catalog_level_name from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_level_number = 9
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select t0.catalog_name, t1.catalog_level_name from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_level_number = 9" }, "style": "rule" }
{ "index": 1813, "split": "train" }
What are the aircraft IDs, aircraft names, and distances for the top 10 aircrafts with the highest IDs, where each associated employee earns more than the total number of employees in the company?
flight_1
select t0.aid as c1, t0.name, t0.distance from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid, (select count(salary) as c3 from employee) as t0 where t2.salary > t0.c3 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": "flight_1", "sql": "select t0.aid as c1, t0.name, t0.distance from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid, (select count(salary) as c3 from employee) as t0 where t2.salary > t0.c3 order by c1 desc limit 10" }, "style": "...
{ "index": 905, "split": "train" }
How much higher is customer 3’s checking balance compared to the smallest checking balance among all customers?
small_bank_1
select t2.c1 - t0.c2 from (select min(balance) as c1 from checking) as t2, (select balance as c2 from checking where custid = 3) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select t2.c1 - t0.c2 from (select min(balance) as c1 from checking) as t2, (select balance as c2 from checking where custid = 3) as t0" }, "style": "rule" }
{ "index": 3202, "split": "train" }
What is the bathroom count, apartment number, and apartment ID of the apartment with the highest apartment ID located in a building whose full name ends with "ne"?
apartment_rentals
select t0.bathroom_count, t0.apt_number, t0.apt_id as c1 from apartments as t0 join apartment_buildings as t1 on t0.building_id = t1.building_id where t1.building_full_name like '%ne' order by c1 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select t0.bathroom_count, t0.apt_number, t0.apt_id as c1 from apartments as t0 join apartment_buildings as t1 on t0.building_id = t1.building_id where t1.building_full_name like '%ne' order by c1 desc limit 1" }, "style": "rule" }
{ "index": 1657, "split": "train" }
What are the top three counts of distinct document descriptions, distinct document type codes, and total grants for documents sent after January 23, 2004, 11:57:08, with responses received on or before October 29, 1987, sorted by the number of grants?
tracking_grants_for_research
select count(distinct (t0.document_description)), count(distinct (t0.document_type_code)), count(t1.grant_id) as c1 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.sent_date > '2004-01-23 11:57:08' and t1.response_received_date <= '1987-10-29 15:35:50' order by c...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select count(distinct (t0.document_description)), count(distinct (t0.document_type_code)), count(t1.grant_id) as c1 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.sent_date > '2004-01...
{ "index": 1365, "split": "train" }
What are the five most recent effective dates of claims?
insurance_fnol
select effective_date as c0 from claims 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": "insurance_fnol", "sql": "select effective_date as c0 from claims order by c0 desc limit 5" }, "style": "rule" }
{ "index": 193, "split": "train" }
When was the highest number of assist nurses with IDs between 101 and 105 involved in patient procedures, and on which date did this occur?
hospital_1
select t0.dateundergoes, t0.assistingnurse as c2 from undergoes as t0, (select max(assistingnurse) as c0 from undergoes where assistingnurse between 101 and 105) as t1 where c2 = t1.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "hospital_1", "sql": "select t0.dateundergoes, t0.assistingnurse as c2 from undergoes as t0, (select max(assistingnurse) as c0 from undergoes where assistingnurse between 101 and 105) as t1 where c2 = t1.c0" }, "style": "rule" }
{ "index": 3776, "split": "train" }
How many days passed between the latest revision date and the publication date of the catalogs renewed after October 26, 2017?
product_catalog
select julianday(t1.c0) - julianday(t0.c2) from (select date_of_latest_revision as c0 from catalogs) as t1, (select date_of_publication as c2 from catalogs where date_of_latest_revision >= '2017-10-26 01:16:51' and date_of_latest_revision >= '2017-10-26 01:16:51') 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 julianday(t1.c0) - julianday(t0.c2) from (select date_of_latest_revision as c0 from catalogs) as t1, (select date_of_publication as c2 from catalogs where date_of_latest_revision >= '2017-10-26 01:16:51' and date_of_latest_revision >= '2017-10-26 ...
{ "index": 3733, "split": "train" }
Which Nos are associated with wines priced between 34 and 80 or belong to the most common wine-producing area?
wine_1
select anon_1.c1 from (select no as c1 from wine where price between 34 and 80 union select t0.no from appellations as t0, (select area as c0 from appellations group by c0 order by count(*) desc limit 1) as t0 where t0.area = t0.c0) 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": "wine_1", "sql": "select anon_1.c1 from (select no as c1 from wine where price between 34 and 80 union select t0.no from appellations as t0, (select area as c0 from appellations group by c0 order by count(*) desc limit 1) as t0 where t0.area = t0.c0) as anon_1" }, "style": "ru...
{ "index": 1528, "split": "train" }
How much does the minimum booked amount for booking ID 4 differ from 102.76?
products_for_hire
select t0.c0 - 102.76 from (select min(t1.booked_amount) as c0 from bookings as t0 join products_booked as t1 on t0.booking_id = t1.booking_id where t0.booking_id = 4 group by t0.booking_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": "products_for_hire", "sql": "select t0.c0 - 102.76 from (select min(t1.booked_amount) as c0 from bookings as t0 join products_booked as t1 on t0.booking_id = t1.booking_id where t0.booking_id = 4 group by t0.booking_id) as t0" }, "style": "rule" }
{ "index": 3247, "split": "train" }
Which customers have savings account balances of 230,000 or less, and whose customer ID is 4 in the checking accounts? For each of these customers, what is their name, customer ID, and how many savings records do they have that meet these conditions?
small_bank_1
select t0.name, t0.custid as c1, count(*) as c3 from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.balance <= 230000.0 and t1.custid in (select checking.custid as c0 from checking where checking.custid = 4) group by c1 having c3 >= 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": "small_bank_1", "sql": "select t0.name, t0.custid as c1, count(*) as c3 from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.balance <= 230000.0 and t1.custid in (select checking.custid as c0 from checking where checking.custid = 4) group by c1 having c3 >= 1" ...
{ "index": 2419, "split": "train" }
Among orders ranked by the highest to lowest average of their order IDs, what is the rank of the order that holds the 10th position?
tracking_orders
select t1.c1, t1.c5 as c4 from (select row_number() over (order by t0.c0 desc) as c1, t0.c2 as c5 from (select t0.order_id as c2, avg(t1.order_id) as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id group by c2) as t0) as t1 where c4 = 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": "tracking_orders", "sql": "select t1.c1, t1.c5 as c4 from (select row_number() over (order by t0.c0 desc) as c1, t0.c2 as c5 from (select t0.order_id as c2, avg(t1.order_id) as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id group by c2) as t0) as t1 where...
{ "index": 3508, "split": "train" }
Which mountain has the name and id, and what is the average camera lens id used in the photo with id 9 associated with that mountain?
mountain_photos
select t0.name, t0.id as c1, avg(t1.camera_lens_id) from mountain as t0 join photos as t1 on t0.id = t1.mountain_id where t1.id = 9 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": "mountain_photos", "sql": "select t0.name, t0.id as c1, avg(t1.camera_lens_id) from mountain as t0 join photos as t1 on t0.id = t1.mountain_id where t1.id = 9 group by c1" }, "style": "rule" }
{ "index": 2421, "split": "train" }
Can you show me all the details for all the apartment bookings?
apartment_rentals
select * from apartment_bookings
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 * from apartment_bookings" }, "style": "rule" }
{ "index": 2207, "split": "train" }
List the invested amounts, school IDs, and the percentage of the total budget that is budgeted for each school, arranged in order from the highest to the lowest invested amount.
school_finance
select invested as c0, school_id, total_budget_percent_budgeted from budget 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": "school_finance", "sql": "select invested as c0, school_id, total_budget_percent_budgeted from budget order by c0 desc" }, "style": "rule" }
{ "index": 2871, "split": "train" }
Which train origins are associated with routes that pass through stations either lacking weekly weather information or specifically station number 3?
station_weather
select t0.origin from train as t0 join route as t1 on t0.id = t1.train_id where (not t1.station_id in (select weekly_weather.station_id as c0 from weekly_weather)) or t1.station_id = 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select t0.origin from train as t0 join route as t1 on t0.id = t1.train_id where (not t1.station_id in (select weekly_weather.station_id as c0 from weekly_weather)) or t1.station_id = 3" }, "style": "rule" }
{ "index": 2415, "split": "train" }
Show the supplier ID, total value purchased, and product ID for the product with ID 5 that costs less than 918.41.
department_store
select t0.supplier_id, t0.total_value_purchased, t0.product_id from product_suppliers as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_price < 918.41 and t1.product_id = 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select t0.supplier_id, t0.total_value_purchased, t0.product_id from product_suppliers as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_price < 918.41 and t1.product_id = 5" }, "style": "rule" }
{ "index": 1468, "split": "train" }
For employee 122, how many days passed between their start date and end date in the job history?
hr_1
select julianday(t1.c2) - julianday(t0.c3) from (select start_date as c2 from job_history where employee_id = 122 and employee_id = 122) as t1, (select end_date as c3 from job_history) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "hr_1", "sql": "select julianday(t1.c2) - julianday(t0.c3) from (select start_date as c2 from job_history where employee_id = 122 and employee_id = 122) as t1, (select end_date as c3 from job_history) as t0" }, "style": "rule" }
{ "index": 3720, "split": "train" }
Who are the employees who are certified to fly the aircraft with aid 12, and what are their names, salaries, and employee IDs?
flight_1
select t0.name, t0.salary from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.aid = 12
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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, t0.salary from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.aid = 12" }, "style": "rule" }
{ "index": 1766, "split": "train" }
Show the Mountain ID, Name, Country, and Points for both climbers and mountains, including mountains from countries that start with "Ke".
climbing
select anon_1.c3, anon_1.c0, anon_1.c1, anon_1.c2 from (select mountain_id as c3, name as c0, country as c1, points as c2 from climber union select t0.mountain_id as c3, t0.name as c0, t0.country as c1, t0.points as c2 from climber as t0 join mountain as t1 on t0.mountain_id = t1.mountain_id where t1.country like 'Ke%'...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "climbing", "sql": "select anon_1.c3, anon_1.c0, anon_1.c1, anon_1.c2 from (select mountain_id as c3, name as c0, country as c1, points as c2 from climber union select t0.mountain_id as c3, t0.name as c0, t0.country as c1, t0.points as c2 from climber as t0 join mountain as t1 on ...
{ "index": 2967, "split": "train" }
How many days have passed between the date a customer’s card became valid and the date it’s no longer valid?
customers_card_transactions
select julianday(t1.c1) - julianday(t0.c2) from (select date_valid_from as c1 from customers_cards) as t1, (select date_valid_to as c2 from customers_cards) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select julianday(t1.c1) - julianday(t0.c2) from (select date_valid_from as c1 from customers_cards) as t1, (select date_valid_to as c2 from customers_cards) as t0" }, "style": "rule" }
{ "index": 3699, "split": "train" }
How many amenities does each dorm with the least common dorm name or names starting with "Grad Student A" have, and what are their dorm IDs?
dorm_1
select count(t0.amenid), t1.dormid as c1 from has_amenity as t0 join dorm as t1 on t0.dormid = t1.dormid, (select dorm_name as c2 from dorm group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.dorm_name = t0.c2 or t1.dorm_name like 'Grad Student A%' group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select count(t0.amenid), t1.dormid as c1 from has_amenity as t0 join dorm as t1 on t0.dormid = t1.dormid, (select dorm_name as c2 from dorm group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.dorm_name = t0.c2 or t1.dorm_name like 'Grad Student A...
{ "index": 2664, "split": "train" }
Which are the top 10 departments, ranked by the number of employees, that have management headed by individuals under 68 years old and born in states containing "ware"? For each of these departments, what is their number of employees, budget in billions, ranking, and whether their management leadership is temporarily a...
department_management
select t0.num_employees as c3, t0.budget_in_billions, t0.ranking, t1.temporary_acting from department as t0 join management as t1 on t0.department_id = t1.department_id join head as t2 on t1.head_id = t2.head_id where t2.age < 68.0 and t2.born_state like '%ware%' 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": "department_management", "sql": "select t0.num_employees as c3, t0.budget_in_billions, t0.ranking, t1.temporary_acting from department as t0 join management as t1 on t0.department_id = t1.department_id join head as t2 on t1.head_id = t2.head_id where t2.age < 68.0 and t2.born_stat...
{ "index": 354, "split": "train" }
Which are the three smallest numbers of employment records, and how many unique companies have those employment counts?
company_employee
select count(*) as c1, count(distinct (company_id)) from employment 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": "company_employee", "sql": "select count(*) as c1, count(distinct (company_id)) from employment order by c1 asc nulls last limit 3" }, "style": "rule" }
{ "index": 1505, "split": "train" }
What is the highest flight price and the aircraft ID for aircrafts that have no more than two flights, including aircraft with ID 4 and all aircraft that have scheduled flights?
flight_1
select max(t0.price), t1.aid as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where c0 = 4 or c0 in (select t0.aid as c2 from flight) group by c0 having count(*) <= 2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_1", "sql": "select max(t0.price), t1.aid as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where c0 = 4 or c0 in (select t0.aid as c2 from flight) group by c0 having count(*) <= 2" }, "style": "rule" }
{ "index": 647, "split": "train" }
Show me the total amount purchased from suppliers whose names either end with "idl" or start with "Lidl".
department_store
select t0.total_value_purchased from product_suppliers as t0 join suppliers as t1 on t0.supplier_id = t1.supplier_id where t1.supplier_name like '%idl' or t1.supplier_name like 'Lidl%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select t0.total_value_purchased from product_suppliers as t0 join suppliers as t1 on t0.supplier_id = t1.supplier_id where t1.supplier_name like '%idl' or t1.supplier_name like 'Lidl%'" }, "style": "rule" }
{ "index": 336, "split": "train" }
Can you list the youngest 10 customers whose address line 2 ends with '51', showing their customer IDs, the number of complaints they've made, and the smallest customer ID associated with each? The list should be sorted by their customer IDs in ascending order.
customer_complaints
select min(t0.customer_id) as c1, count(*), t1.customer_id as c2 from complaints as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.address_line_2 like '%51' group by c2 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": "customer_complaints", "sql": "select min(t0.customer_id) as c1, count(*), t1.customer_id as c2 from complaints as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.address_line_2 like '%51' group by c2 order by c1 asc nulls last limit 10" }, "style": "rule" ...
{ "index": 997, "split": "train" }
What are the top five document statuses along with their codes, receipt dates, and document type codes for documents that either have a document type description starting with "f" or belong to the least common document type? The results should be sorted in reverse alphabetical order based on the document status descrip...
cre_Doc_Control_Systems
select t0.document_status_description as c3, t0.document_status_code, t1.receipt_date, t1.document_type_code from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code join ref_document_types as t2 on t1.document_type_code = t2.document_type_code, (select document_type_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": "cre_Doc_Control_Systems", "sql": "select t0.document_status_description as c3, t0.document_status_code, t1.receipt_date, t1.document_type_code from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code join ref_document_types as t2 on...
{ "index": 598, "split": "train" }
Sterli"?
ship_mission
select anon_1.c0, anon_1.c1 from (select t0.type as c0, t0.ship_id as c1 from ship as t0 join mission as t1 on t0.ship_id = t1.ship_id where t1.ship_id = 5 intersect select t0.type as c0, t0.ship_id as c1 from ship as t0 join mission as t1 on t0.ship_id = t1.ship_id where t1.code like '%er: Sterli%') 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": "ship_mission", "sql": "select anon_1.c0, anon_1.c1 from (select t0.type as c0, t0.ship_id as c1 from ship as t0 join mission as t1 on t0.ship_id = t1.ship_id where t1.ship_id = 5 intersect select t0.type as c0, t0.ship_id as c1 from ship as t0 join mission as t1 on t0.ship_id = t...
{ "index": 1603, "split": "train" }
Find the teacher ID, date of assessment notes, student ID, detention summary, and detention end date for all records where the detention type is labeled "After School".
behavior_monitoring
select t0.teacher_id, t0.date_of_notes, t0.student_id, t2.detention_summary, t2.datetime_detention_end from assessment_notes as t0 join teachers as t1 on t0.teacher_id = t1.teacher_id join detention as t2 on t1.teacher_id = t2.teacher_id join ref_detention_type as t3 on t2.detention_type_code = t3.detention_type_code w...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select t0.teacher_id, t0.date_of_notes, t0.student_id, t2.detention_summary, t2.datetime_detention_end from assessment_notes as t0 join teachers as t1 on t0.teacher_id = t1.teacher_id join detention as t2 on t1.teacher_id = t2.teacher_id join ref_det...
{ "index": 1695, "split": "train" }
What are the ten highest customer IDs' minimum payment amounts, along with the date they became customers, for customers whose last names are not listed among the staff, sorted by customer ID in descending order?
driving_school
select min(t0.amount_payment), t1.date_became_customer, t1.customer_id as c0 from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where (not t1.last_name in (select staff.last_name as c1 from staff)) 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": "driving_school", "sql": "select min(t0.amount_payment), t1.date_became_customer, t1.customer_id as c0 from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where (not t1.last_name in (select staff.last_name as c1 from staff)) group by c0 order by c0...
{ "index": 1066, "split": "train" }
Among the end stations visited in trips starting with "8/26/2015 8" at the most frequently used start station, which three end stations had five or fewer trips, and for each, what is the maximum zip code among those trips?
bike_1
select t0.end_station_name as c2, count(*) as c0 from trip as t0, (select start_station_name as c1 from trip group by c1 order by count(*) desc limit 1) as t0 where t0.start_date like '8/26/2015 8%' and t0.start_station_name = t0.c1 group by c2 having c0 <= 5 order by max(t0.zip_code) asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select t0.end_station_name as c2, count(*) as c0 from trip as t0, (select start_station_name as c1 from trip group by c1 order by count(*) desc limit 1) as t0 where t0.start_date like '8/26/2015 8%' and t0.start_station_name = t0.c1 group by c2 having c0 <= 5 ord...
{ "index": 1161, "split": "train" }
What are the heights and person IDs of people whose gymnasts scored more than 57.398 but less than 57.649 in total points?
gymnast
select anon_1.c0, anon_1.c1 from (select t0.height as c0, t0.people_id as c1 from people as t0 join gymnast as t1 on t0.people_id = t1.gymnast_id where t1.total_points <= 57.398 except select t0.height as c0, t0.people_id as c1 from people as t0 join gymnast as t1 on t0.people_id = t1.gymnast_id where t1.total_points >...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "gymnast", "sql": "select anon_1.c0, anon_1.c1 from (select t0.height as c0, t0.people_id as c1 from people as t0 join gymnast as t1 on t0.people_id = t1.gymnast_id where t1.total_points <= 57.398 except select t0.height as c0, t0.people_id as c1 from people as t0 join gymnast as ...
{ "index": 1454, "split": "train" }
Among companies with IDs of 2 or less that have operated flights, which company's name comes last alphabetically, and what are its principal activities?
flight_company
select t0.principal_activities, t0.name as c0 from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t1.company_id <= 2 order by c0 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_company", "sql": "select t0.principal_activities, t0.name as c0 from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t1.company_id <= 2 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 367, "split": "train" }
List the staff IDs and last names of staff members who have a log entry with description 't' and are not linked to problems reported after May 20, 1970, 15:38:46, or on December 29, 1993, 23:22:21.
tracking_software_problems
select t0.staff_id, t0.staff_last_name from staff as t0 join problem_log as t1 on t0.staff_id = t1.assigned_to_staff_id where t1.log_entry_description = 't' and (not t1.problem_id in (select problems.problem_id as c0 from problems where problems.date_problem_reported > '1970-05-20 15:38:46' or problems.date_problem_rep...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.staff_id, t0.staff_last_name from staff as t0 join problem_log as t1 on t0.staff_id = t1.assigned_to_staff_id where t1.log_entry_description = 't' and (not t1.problem_id in (select problems.problem_id as c0 from problems where proble...
{ "index": 853, "split": "train" }
Which are the three stations with the highest maximum number of bikes available at each, according to their latest status reports?
bike_1
select station_id as c0, max(bikes_available) as c1 from status group by 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": "bike_1", "sql": "select station_id as c0, max(bikes_available) as c1 from status group by c0 order by c1 asc nulls last limit 3" }, "style": "rule" }
{ "index": 1581, "split": "train" }
Is there more than one student enrolled in course 8?
e_learning
select t0.c1 > 1 from (select count(distinct (t1.registration_id)) as c1 from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id where t0.course_id = 8 group by t0.course_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.c1 > 1 from (select count(distinct (t1.registration_id)) as c1 from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id where t0.course_id = 8 group by t0.course_id) as t0" }, "style": "rule" }
{ "index": 3296, "split": "train" }
What are the names and street addresses of buildings that are associated with institutions having enrollment between 650 and 1200, or with enrollment greater than the average enrollment across all institutions?
protein_institute
select t0.name, t0.street_address from building as t0 join institution as t1 on t0.building_id = t1.building_id, (select avg(enrollment) as c2 from institution) as t0 where t1.enrollment between 650 and 1200 or t1.enrollment > t0.c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "protein_institute", "sql": "select t0.name, t0.street_address from building as t0 join institution as t1 on t0.building_id = t1.building_id, (select avg(enrollment) as c2 from institution) as t0 where t1.enrollment between 650 and 1200 or t1.enrollment > t0.c2" }, "style": "r...
{ "index": 2467, "split": "train" }
What are the total ages and the number of students for each gender, and can you list the first five groups ordered by the number of students in each sex?
game_1
select sex as c1, sum(age), count(*) from student group by c1 order by count(distinct (sex)) asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_1", "sql": "select sex as c1, sum(age), count(*) from student group by c1 order by count(distinct (sex)) asc nulls last limit 5" }, "style": "rule" }
{ "index": 2416, "split": "train" }
Which Lieutenant Governors, election years, political parties, and committees are associated with counties that have populations under 79,000?
election
select t0.lieutenant_governor, t0.year, t1.party, t1.committee from party as t0 join election as t1 on t0.party_id = t1.party join county as t2 on t1.district = t2.county_id where t2.population < 79000.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": "election", "sql": "select t0.lieutenant_governor, t0.year, t1.party, t1.committee from party as t0 join election as t1 on t0.party_id = t1.party join county as t2 on t1.district = t2.county_id where t2.population < 79000.0" }, "style": "rule" }
{ "index": 650, "split": "train" }
Which premise detail containing the letter "b" is associated with the highest number of unique premises, and how many premises share it?
customers_campaigns_ecommerce
select t0.c1 as c0, count(distinct (t0.c2)) as c3 from (select premise_details as c1, premise_id as c2 from premises where c1 like '%b%') as t0 group by c0 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": "customers_campaigns_ecommerce", "sql": "select t0.c1 as c0, count(distinct (t0.c2)) as c3 from (select premise_details as c1, premise_id as c2 from premises where c1 like '%b%') as t0 group by c0 order by c3 desc limit 1" }, "style": "rule" }
{ "index": 3817, "split": "train" }
What is the year when Bob was friends with someone?
network_2
select year from personfriend where name = 'Bob'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 year from personfriend where name = 'Bob'" }, "style": "rule" }
{ "index": 3389, "split": "train" }
Which technician from a team ending with "E" has the highest number of unique repairs?
machine_repair
select t0.c0 as c1, count(distinct (t0.c0)) as c2 from (select technician_id as c0 from technician where team like '%E') as t0 group by c1 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": "machine_repair", "sql": "select t0.c0 as c1, count(distinct (t0.c0)) as c2 from (select technician_id as c0 from technician where team like '%E') as t0 group by c1 order by c2 desc limit 1" }, "style": "rule" }
{ "index": 3659, "split": "train" }
What is the percentage change in the average railway ID of trains arriving at 23:44 compared to those arriving at 09:08?
railway
select (sum(t0.c1) / cast(sum(t1.c1) as real) - 1) * 100 from (select avg(t1.railway_id) as c1 from railway as t0 join train as t1 on t0.railway_id = t1.railway_id where t1.arrival = '09:08' group by t0.railway_id) as t0, (select t0.railway_id, avg(t1.railway_id) as c1 from railway as t0 join train as t1 on t0.railway_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "railway", "sql": "select (sum(t0.c1) / cast(sum(t1.c1) as real) - 1) * 100 from (select avg(t1.railway_id) as c1 from railway as t0 join train as t1 on t0.railway_id = t1.railway_id where t1.arrival = '09:08' group by t0.railway_id) as t0, (select t0.railway_id, avg(t1.railway_id...
{ "index": 3945, "split": "train" }
Among players whose college IDs start with "co", who is the tallest, and what is their death year and player ID?
baseball_1
select t0.death_year from player as t0 join player_college as t1 on t0.player_id = t1.player_id where t1.college_id like 'co%' order by t0.height desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "baseball_1", "sql": "select t0.death_year from player as t0 join player_college as t1 on t0.player_id = t1.player_id where t1.college_id like 'co%' order by t0.height desc limit 1" }, "style": "rule" }
{ "index": 1791, "split": "train" }
Which countries do climbers come from, excluding those who have ascended the mountain with ID 5 and a name starting with "Ngaliem"?
climbing
select distinct country from climber where (not mountain_id in (select mountain_id as c0 from mountain where mountain_id = 5 and name like 'Ngaliem%'))
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "climbing", "sql": "select distinct country from climber where (not mountain_id in (select mountain_id as c0 from mountain where mountain_id = 5 and name like 'Ngaliem%'))" }, "style": "rule" }
{ "index": 2596, "split": "train" }
Can you tell me the market ID and country for each market, along with the type of film market estimation, specifically for the film with ID 3? Please organize the results by the estimation type alphabetically.
film_rank
select t0.market_id, t0.country, t1.type as c0 from market as t0 join film_market_estimation as t1 on t0.market_id = t1.market_id join film as t2 on t1.film_id = t2.film_id where t2.film_id = 3 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": "film_rank", "sql": "select t0.market_id, t0.country, t1.type as c0 from market as t0 join film_market_estimation as t1 on t0.market_id = t1.market_id join film as t2 on t1.film_id = t2.film_id where t2.film_id = 3 order by c0 asc nulls last" }, "style": "rule" }
{ "index": 1827, "split": "train" }
from August 21, 2017, to March 11, 2018, and from October 30, 2017, to March 22, 2018?
behavior_monitoring
select t1.c0 - t0.c0 from (select avg(t1.teacher_id) as c0 from ref_detention_type as t0 join detention as t1 on t0.detention_type_code = t1.detention_type_code where t0.detention_type_code = 'LUNCH' and t1.datetime_detention_start = '2017-08-21 06:41:29' and t1.datetime_detention_end between '2018-03-11 12:58:40' and ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t1.c0 - t0.c0 from (select avg(t1.teacher_id) as c0 from ref_detention_type as t0 join detention as t1 on t0.detention_type_code = t1.detention_type_code where t0.detention_type_code = 'LUNCH' and t1.datetime_detention_start = '2017-08-21 06:4...
{ "index": 3879, "split": "train" }
What are the invoice details and invoice number for the most recent shipment with a tracking number ending in "436", when sorted by invoice details in reverse alphabetical order?
tracking_orders
select t0.invoice_details as c0 from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where t1.shipment_tracking_number like '%436' order by c0 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.invoice_details as c0 from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where t1.shipment_tracking_number like '%436' order by c0 desc limit 1" }, "style": "rule" }
{ "index": 946, "split": "train" }
What are the track IDs and opening years of the ten tracks with the smallest seating capacities, ordered from the lowest to higher seating?
race_track
select track_id, year_opened from track order by seating 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": "race_track", "sql": "select track_id, year_opened from track order by seating asc nulls last limit 10" }, "style": "rule" }
{ "index": 2709, "split": "train" }
What are the connection types and IDs of the web client accelerators that are compatible with the least common browser, and what is the average year since they have been compatible?
browser_web
select t0.connection, t0.id as c1, avg(t1.compatible_since_year) from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id, (select browser_id as c3 from accelerator_compatible_browser group by c3 order by count(*) asc nulls last limit 1) as t0 where t1.browser_id = t0.c3 ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "browser_web", "sql": "select t0.connection, t0.id as c1, avg(t1.compatible_since_year) from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id, (select browser_id as c3 from accelerator_compatible_browser group by c3 order by count...
{ "index": 2142, "split": "train" }
What is the percentage change in the highest average customer ID for clients between October 4, 1986, and November 17, 1989?
cre_Drama_Workshop_Groups
select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select avg(t1.customer_id) as c0 from clients as t0 join bookings as t1 on t0.client_id = t1.customer_id where t1.actual_delivery_date = '1986-10-04 13:31:10' group by t0.client_id) as t0, (select avg(t1.customer_id) as c0 from clients as t0 join bookings 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": "cre_Drama_Workshop_Groups", "sql": "select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select avg(t1.customer_id) as c0 from clients as t0 join bookings as t1 on t0.client_id = t1.customer_id where t1.actual_delivery_date = '1986-10-04 13:31:10' group by t0.client_id)...
{ "index": 3015, "split": "train" }
Show the last names and first names of all students and faculty members.
activity_1
select anon_1.c2, anon_1.c1 from (select lname as c2, fname as c1 from student union select lname, fname from faculty) 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": "activity_1", "sql": "select anon_1.c2, anon_1.c1 from (select lname as c2, fname as c1 from student union select lname, fname from faculty) as anon_1" }, "style": "rule" }
{ "index": 1183, "split": "train" }
Find the name of a dorm that has an amenity with ID at least 909, choosing the one that comes first in alphabetical order based on gender restriction, placing any dorms with unspecified gender restrictions last.
dorm_1
select t0.dorm_name from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where t1.amenid >= 909 order by t0.gender 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": "dorm_1", "sql": "select t0.dorm_name from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where t1.amenid >= 909 order by t0.gender asc nulls last limit 1" }, "style": "rule" }
{ "index": 2959, "split": "train" }
What is the highest item ID associated with each order, and what is the order ID itself, for all orders placed by customers with IDs greater than 11?
department_store
select max(t0.order_id), t1.order_id as c0 from order_items as t0 join customer_orders as t1 on t0.order_id = t1.order_id where t1.customer_id > 11 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": "department_store", "sql": "select max(t0.order_id), t1.order_id as c0 from order_items as t0 join customer_orders as t1 on t0.order_id = t1.order_id where t1.customer_id > 11 group by c0" }, "style": "rule" }
{ "index": 1165, "split": "train" }
How many distinct products and total product details are associated with order number 5, and how are these counts sorted by the number of times order 5 appears?
customers_and_addresses
select count(distinct (t0.product_id)), count(t0.product_details) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_id = 5 order by count(t1.order_id) 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": "customers_and_addresses", "sql": "select count(distinct (t0.product_id)), count(t0.product_details) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_id = 5 order by count(t1.order_id) desc" }, "style": "rule" }
{ "index": 107, "split": "train" }
How much is the difference between the highest track ID in invoice lines and the track ID of the invoice line with ID 1823?
store_1
select t2.c0 - t0.c1 from (select max(track_id) as c0 from invoice_lines) as t2, (select track_id as c1 from invoice_lines where id = 1823) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t2.c0 - t0.c1 from (select max(track_id) as c0 from invoice_lines) as t2, (select track_id as c1 from invoice_lines where id = 1823) as t0" }, "style": "rule" }
{ "index": 3176, "split": "train" }
What is the percentage change in the number of unique customer events for customer 31 at property 445 on September 27, 2016, compared to a baseline of one event?
local_govt_and_lot
select (t0.c2 / cast(t0.c2 as real) - 1) * 100 from (select count(distinct (t1.customer_event_id)) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 31 and t1.date_moved_in = '2016-09-27 12:00:00' and t1.property_id = 445 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.c2 / cast(t0.c2 as real) - 1) * 100 from (select count(distinct (t1.customer_event_id)) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 31 and t1.date_moved_in = '2016-09-27 12...
{ "index": 3419, "split": "train" }
Which are the five campuses with the highest campus IDs that have degree counts, including their campus name, year, and county, where the discipline enrollments for graduates are greater than 156 or at least 596?
csu_1
select t0.degrees, t0.campus, t0.year, t1.county, t1.id as c4 from degrees as t0 join campuses as t1 on t0.campus = t1.id join discipline_enrollments as t2 on t1.id = t2.campus where t2.graduate > 156 or t2.graduate >= 596 order by c4 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": "csu_1", "sql": "select t0.degrees, t0.campus, t0.year, t1.county, t1.id as c4 from degrees as t0 join campuses as t1 on t0.campus = t1.id join discipline_enrollments as t2 on t1.id = t2.campus where t2.graduate > 156 or t2.graduate >= 596 order by c4 desc limit 5" }, "style":...
{ "index": 2573, "split": "train" }
What is the difference between the organization IDs associated with items 92 and 2?
local_govt_and_lot
select t1.c1 - t0.c1 from (select organization_id as c1 from things where thing_id = 2) as t1, (select organization_id as c1 from things where thing_id = 92) 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 t1.c1 - t0.c1 from (select organization_id as c1 from things where thing_id = 2) as t1, (select organization_id as c1 from things where thing_id = 92) as t0" }, "style": "rule" }
{ "index": 3611, "split": "train" }
Which enzyme locations are involved in interactions with the medicine that has ID 8?
medicine_enzyme_interaction
select distinct t0.location, t1.medicine_id as c1 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where c1 = 8
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select distinct t0.location, t1.medicine_id as c1 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where c1 = 8" }, "style": "rule" }
{ "index": 270, "split": "train" }
What are the names and number of floors of the three buildings associated with the most recently founded institutions, listed in reverse alphabetical order by building name?
protein_institute
select t0.name as c0, t0.floors from building as t0 join institution as t1 on t0.building_id = t1.building_id, (select max(founded) as c1 from institution) as t0 where t1.founded <= t0.c1 order by c0 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "protein_institute", "sql": "select t0.name as c0, t0.floors from building as t0 join institution as t1 on t0.building_id = t1.building_id, (select max(founded) as c1 from institution) as t0 where t1.founded <= t0.c1 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 1186, "split": "train" }
What are the genre ratings, genre names, artist countries, and file IDs for files that have either the least common duration or the most common duration among all files?
music_1
select t0.rating, t0.g_name, t1.country, t1.f_id from genre as t0 join song as t1 on t0.g_name = t1.genre_is join files as t2 on t1.f_id = t2.f_id, (select duration as c3 from files group by c3 order by count(*) asc nulls last limit 1) as t1, (select duration as c3 from files group by c3 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": "music_1", "sql": "select t0.rating, t0.g_name, t1.country, t1.f_id from genre as t0 join song as t1 on t0.g_name = t1.genre_is join files as t2 on t1.f_id = t2.f_id, (select duration as c3 from files group by c3 order by count(*) asc nulls last limit 1) as t1, (select duration as...
{ "index": 847, "split": "train" }
What are the number of shops, rankings, and districts for markets that carry phones with IDs containing "4", but excluding markets that are not listed in the phone market data?
phone_market
select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.num_of_shops as c0, t0.ranking as c1, t0.district as c2 from market as t0 join phone_market as t1 on t0.market_id = t1.market_id where t1.phone_id like '%4%' except select t0.num_of_shops as c0, t0.ranking as c1, t0.district as c2 from market as t0 join phone_marke...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "phone_market", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.num_of_shops as c0, t0.ranking as c1, t0.district as c2 from market as t0 join phone_market as t1 on t0.market_id = t1.market_id where t1.phone_id like '%4%' except select t0.num_of_shops as c0, t0.rank...
{ "index": 1007, "split": "train" }
Which active airline with the highest priority has an airport in Agri or a city ending with "oscow," sorted by active status in descending order?
flight_4
select t0.active as c0, t0.alid, t0.name from airlines as t0 join routes as t1 on t0.alid = t1.alid join airports as t2 on t1.src_apid = t2.apid where t2.city = 'Agri' or t2.city like '%oscow' order by c0 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t0.active as c0, t0.alid, t0.name from airlines as t0 join routes as t1 on t0.alid = t1.alid join airports as t2 on t1.src_apid = t2.apid where t2.city = 'Agri' or t2.city like '%oscow' order by c0 desc limit 1" }, "style": "rule" }
{ "index": 1067, "split": "train" }
Is the trust level from user 6 higher than that from user 3?
epinions_1
select t1.c2 > t0.c2 from (select trust as c2 from trust where source_u_id = 3) as t1, (select trust as c2 from trust where source_u_id = 6) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "epinions_1", "sql": "select t1.c2 > t0.c2 from (select trust as c2 from trust where source_u_id = 3) as t1, (select trust as c2 from trust where source_u_id = 6) as t0" }, "style": "rule" }
{ "index": 3547, "split": "train" }
What is the percentage increase or decrease in the maximum number of passengers at stations served by trains at 4:20 compared to those served at 4:49?
train_station
select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select t0.total_passengers as c0 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 = '04:20') as t0, (select t0.total_passengers as c0, t0.station_id from station as t0 j...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select t0.total_passengers as c0 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 = '04:20') as t0, (sele...
{ "index": 3063, "split": "train" }
For organizations that do not have contact individuals with last names ending in "s," what are their dates of formation?
e_government
select t0.date_formed from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where (not t1.individual_id in (select individuals.individual_id as c1 from individuals where individuals.individual_last_name like '%s'))
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_government", "sql": "select t0.date_formed from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where (not t1.individual_id in (select individuals.individual_id as c1 from individuals where individuals.individual_last_n...
{ "index": 1996, "split": "train" }
Does the airline id associated with route 61553 have a smaller value than the airline id associated with route 6300?
flight_4
select t1.c1 < t0.c1 from (select alid as c1 from routes where rid = 6300) as t1, (select alid as c1 from routes where rid = 61553) 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": "flight_4", "sql": "select t1.c1 < t0.c1 from (select alid as c1 from routes where rid = 6300) as t1, (select alid as c1 from routes where rid = 61553) as t0" }, "style": "rule" }
{ "index": 3933, "split": "train" }
Can you list the product names and IDs that include all products, combined with those that have been ordered by customers whose names contain "Hershe"?
tracking_orders
select anon_1.c0, anon_1.c1 from (select product_name as c0, product_id as c1 from products union select t0.product_name as c0, t0.product_id as c1 from products as t0 join order_items as t1 on t0.product_id = t1.product_id join orders as t2 on t1.order_id = t2.order_id join customers as t3 on t2.customer_id = t3.custo...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select anon_1.c0, anon_1.c1 from (select product_name as c0, product_id as c1 from products union select t0.product_name as c0, t0.product_id as c1 from products as t0 join order_items as t1 on t0.product_id = t1.product_id join orders as t2 on t1.order_...
{ "index": 2438, "split": "train" }
Which department has the fewest different credit values among courses whose descriptions end with "Statistical Applications"?
college_1
select dept_code as c0 from course where crs_description like '%Statistical Applications' group by c0 order by count(distinct (crs_credit)) 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": "college_1", "sql": "select dept_code as c0 from course where crs_description like '%Statistical Applications' group by c0 order by count(distinct (crs_credit)) asc nulls last limit 1" }, "style": "rule" }
{ "index": 1908, "split": "train" }
Which are the top 10 order quantities, along with the count of distinct order quantities and the highest product ID, for orders with IDs less than or equal to 6 or greater than or equal to 9, ordered by the highest product ID?
customers_and_products_contacts
select order_quantity as c0, count(distinct (order_quantity)), max(product_id) as c2 from order_items where order_id <= 6 or order_id >= 9 group by c0 order by c2 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select order_quantity as c0, count(distinct (order_quantity)), max(product_id) as c2 from order_items where order_id <= 6 or order_id >= 9 group by c0 order by c2 desc limit 10" }, "style": "rule" }
{ "index": 914, "split": "train" }
show the ranks of the bridges based on their length in feet, from longest to shortest, and identify which bridge has rank 11.?
architecture
select t1.c1, t1.c5 as c2 from (select row_number() over (order by length_feet desc) as c1, id as c5 from bridge) as t1 where c2 = 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": "architecture", "sql": "select t1.c1, t1.c5 as c2 from (select row_number() over (order by length_feet desc) as c1, id as c5 from bridge) as t1 where c2 = 11" }, "style": "rule" }
{ "index": 3460, "split": "train" }
Which are the first 10 countries, zip codes, and address contents for addresses linked to customers whose contact channels have been active since at least February 24, 2018, sorted alphabetically by country?
customers_and_addresses
select t0.country as c0, t0.zip_postcode, t0.address_content from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id join customers as t2 on t1.customer_id = t2.customer_id join customer_contact_channels as t3 on t2.customer_id = t3.customer_id where t3.active_to_date >= '2018-02-24 00:57:39...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t0.country as c0, t0.zip_postcode, t0.address_content from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id join customers as t2 on t1.customer_id = t2.customer_id join customer_contact_channels as t3 on t2.cu...
{ "index": 1956, "split": "train" }