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
Among the stays that started after May 2, 2008, which stay ID occurs most frequently?
hospital_1
select t0.c0 as c2, count(distinct (t0.c0)) as c1 from (select stayid as c0 from stay where staystart > '2008-05-02 00:00:00') as t0 group by c2 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": "hospital_1", "sql": "select t0.c0 as c2, count(distinct (t0.c0)) as c1 from (select stayid as c0 from stay where staystart > '2008-05-02 00:00:00') as t0 group by c2 order by c1 desc limit 1" }, "style": "rule" }
{ "index": 3657, "split": "train" }
What is the percentage change in the total number of unique documents with status codes containing "orki" between April 17, 1999, and April 3, 2015?
cre_Doc_Control_Systems
select (sum(t0.c2) / cast(sum(t1.c2) as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c2 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t1.receipt_date = '2015-04-03 09:36:19' and t0.document_status_code like '%orki%' group by t0.docume...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (sum(t0.c2) / cast(sum(t1.c2) as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c2 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t1.receipt_date = '2015-04...
{ "index": 3009, "split": "train" }
Did the student with ID 11 log in before the student with ID 15?
e_learning
select t1.c0 < t0.c0 from (select date_of_latest_logon as c0 from students where student_id = 11) as t1, (select date_of_latest_logon as c0 from students where student_id = 15) 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 t1.c0 < t0.c0 from (select date_of_latest_logon as c0 from students where student_id = 11) as t1, (select date_of_latest_logon as c0 from students where student_id = 15) as t0" }, "style": "rule" }
{ "index": 3134, "split": "train" }
Which parties have associated party forms with form types starting with "Basi" and are linked to the least common form named "Marriage Certificate" or ending with "tion"? For each such party, what are their Payment Method Code, Party ID, and Party Phone, along with the Form ID and Party ID from the related party forms?
e_government
select t0.payment_method_code, t0.party_id, t0.party_phone, t1.form_id, t1.party_id from parties as t0 join party_forms as t1 on t0.party_id = t1.party_id join forms as t2 on t1.form_id = t2.form_id, (select form_name as c2 from forms where c2 = 'Marriage Certificate' or c2 like '%tion' group by c2 order by count(*) as...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_government", "sql": "select t0.payment_method_code, t0.party_id, t0.party_phone, t1.form_id, t1.party_id from parties as t0 join party_forms as t1 on t0.party_id = t1.party_id join forms as t2 on t1.form_id = t2.form_id, (select form_name as c2 from forms where c2 = 'Marriage C...
{ "index": 2604, "split": "train" }
Which students have their highest assigned dorm ID at least 117, and what are their student IDs along with their highest dorm IDs, listed from the largest to the smallest?
dorm_1
select stuid as c0, max(dormid) as c1 from lives_in group by c0 having max(dormid) >= 117 order by c1 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": "dorm_1", "sql": "select stuid as c0, max(dormid) as c1 from lives_in group by c0 having max(dormid) >= 117 order by c1 desc" }, "style": "rule" }
{ "index": 1246, "split": "train" }
How many days passed between a catalog's publication date and its most recent revision date?
product_catalog
select julianday(t1.c3) - julianday(t0.c2) from (select date_of_publication as c3 from catalogs) as t1, (select date_of_latest_revision as c2 from catalogs where c2 = '2017-03-30 09:15:37' and c2 = '2017-03-30 09:15:37') 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.c3) - julianday(t0.c2) from (select date_of_publication as c3 from catalogs) as t1, (select date_of_latest_revision as c2 from catalogs where c2 = '2017-03-30 09:15:37' and c2 = '2017-03-30 09:15:37') as t0" }, "style": "rule" }
{ "index": 3730, "split": "train" }
List the names and carriers of up to ten phones available in markets ranked first or higher, showing the carriers in descending (reverse alphabetical) order.
phone_market
select t0.name, t0.carrier as c0 from phone as t0 join phone_market as t1 on t0.phone_id = t1.phone_id join market as t2 on t1.market_id = t2.market_id where t2.ranking >= 1 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": "phone_market", "sql": "select t0.name, t0.carrier as c0 from phone as t0 join phone_market as t1 on t0.phone_id = t1.phone_id join market as t2 on t1.market_id = t2.market_id where t2.ranking >= 1 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 2081, "split": "train" }
What are the lowest and highest average author IDs for subjects that include "Science" in their names?
e_learning
select min(t0.c0), max(t0.c0) from (select avg(t1.author_id) as c0 from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t0.subject_name like '%Science' group by t0.subject_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 min(t0.c0), max(t0.c0) from (select avg(t1.author_id) as c0 from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t0.subject_name like '%Science' group by t0.subject_id) as t0" }, "style": "rule" }
{ "index": 3966, "split": "train" }
What is the highest number of times a particular lesson status code occurs for vehicle ID 3, especially in relation to the highest prices?
driving_school
select count(t0.lesson_status_code) from lessons as t0 join vehicles as t1 on t0.vehicle_id = t1.vehicle_id where t1.vehicle_id = 3 order by count(t0.price) desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select count(t0.lesson_status_code) from lessons as t0 join vehicles as t1 on t0.vehicle_id = t1.vehicle_id where t1.vehicle_id = 3 order by count(t0.price) desc limit 1" }, "style": "rule" }
{ "index": 2367, "split": "train" }
What are the longitude, city, dock count, and current number of bikes available at stations where the number of bikes available is less than or equal to the highest number of bikes ever available at any station?
bike_1
select distinct t0.long, t0.city, t0.dock_count, t1.bikes_available as c0 from station as t0 join status as t1 on t0.id = t1.station_id, (select max(bikes_available) as c4 from status) as t0 where c0 <= t0.c4
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct t0.long, t0.city, t0.dock_count, t1.bikes_available as c0 from station as t0 join status as t1 on t0.id = t1.station_id, (select max(bikes_available) as c4 from status) as t0 where c0 <= t0.c4" }, "style": "rule" }
{ "index": 934, "split": "train" }
How much is the `y` value of airport 2164 greater than the smallest `y` value among airports in Tokyo?
flight_4
select t2.c3 - t0.c0 from (select min(y) as c3 from airports where city = 'Tokyo') as t2, (select y as c0 from airports where apid = 2164) 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 t2.c3 - t0.c0 from (select min(y) as c3 from airports where city = 'Tokyo') as t2, (select y as c0 from airports where apid = 2164) as t0" }, "style": "rule" }
{ "index": 3192, "split": "train" }
What are the names and zip codes of the top 10 counties, along with the party and delegate details of elections held in districts where the party has an ID of 2, sorted by delegate name in descending order?
election
select t0.county_name, t0.zip_code, t1.party, t1.delegate as c1 from county as t0 join election as t1 on t0.county_id = t1.district join party as t2 on t1.party = t2.party_id where t2.party_id = 2 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": "election", "sql": "select t0.county_name, t0.zip_code, t1.party, t1.delegate as c1 from county as t0 join election as t1 on t0.county_id = t1.district join party as t2 on t1.party = t2.party_id where t2.party_id = 2 order by c1 desc limit 10" }, "style": "rule" }
{ "index": 2769, "split": "train" }
What is the difference between the average length in meters of the bridges designed by architect 2 and 78 meters?
architecture
select t0.c0 - 78.0 from (select avg(t1.length_meters) as c0 from architect as t0 join bridge as t1 on t0.id = t1.architect_id where t0.id = 2 group by t0.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": "architecture", "sql": "select t0.c0 - 78.0 from (select avg(t1.length_meters) as c0 from architect as t0 join bridge as t1 on t0.id = t1.architect_id where t0.id = 2 group by t0.id) as t0" }, "style": "rule" }
{ "index": 3209, "split": "train" }
How many artworks have the ID of 6?
entertainment_awards
select count(*) from artwork where artwork_id = 6
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "entertainment_awards", "sql": "select count(*) from artwork where artwork_id = 6" }, "style": "rule" }
{ "index": 2084, "split": "train" }
Which game IDs, names, and types are there in the video game database that are not played by the student with ID 1002?
game_1
select anon_1.c2, anon_1.c0, anon_1.c1 from (select gameid as c2, gname as c0, gtype as c1 from video_games except select t0.gameid as c2, t0.gname as c0, t0.gtype as c1 from video_games as t0 join plays_games as t1 on t0.gameid = t1.gameid join student as t2 on t1.stuid = t2.stuid join sportsinfo as t3 on t2.stuid = t...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_1", "sql": "select anon_1.c2, anon_1.c0, anon_1.c1 from (select gameid as c2, gname as c0, gtype as c1 from video_games except select t0.gameid as c2, t0.gname as c0, t0.gtype as c1 from video_games as t0 join plays_games as t1 on t0.gameid = t1.gameid join student as t2 on ...
{ "index": 158, "split": "train" }
Which checkout dates have 250 or fewer reservations, and how many rate entries were recorded for each of these dates?
inn_1
select checkout as c0, count(rate) from reservations group by c0 having count(rate) <= 250.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": "inn_1", "sql": "select checkout as c0, count(rate) from reservations group by c0 having count(rate) <= 250.0" }, "style": "rule" }
{ "index": 1722, "split": "train" }
What is the change in the average product ID for product 117 between complaints raised on July 18, 2002, and complaints from July 11, 1987, where complaints in 1987 had a status containing "Open"?
customer_complaints
select t1.c1 - t0.c1 from (select avg(t1.product_id) as c1 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 117 and t1.date_complaint_raised = '2002-07-18 10:59:35' group by t0.product_id) as t1, (select t0.product_id, avg(t1.product_id) as c1 from products as t0 join com...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t1.c1 - t0.c1 from (select avg(t1.product_id) as c1 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 117 and t1.date_complaint_raised = '2002-07-18 10:59:35' group by t0.product_id) as t1, (selec...
{ "index": 3519, "split": "train" }
Show the cinema ID, cinema name, and schedule date for films whose titles start with "The C".
cinema
select t0.cinema_id, t0.name, t1.date from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id join film as t2 on t1.film_id = t2.film_id where t2.title like 'The 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": "cinema", "sql": "select t0.cinema_id, t0.name, t1.date from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id join film as t2 on t1.film_id = t2.film_id where t2.title like 'The C%'" }, "style": "rule" }
{ "index": 620, "split": "train" }
Which assets have associated parts that are involved in faults with short names ending with "W"? For each of these assets, what are their model, make, and disposal date, along with the part ID of the faulty part?
assets_maintenance
select t0.asset_model, t0.asset_make, t0.asset_disposed_date, t1.part_id from assets as t0 join asset_parts as t1 on t0.asset_id = t1.asset_id join parts as t2 on t1.part_id = t2.part_id join part_faults as t3 on t2.part_id = t3.part_id where t3.fault_short_name like '%W'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t0.asset_model, t0.asset_make, t0.asset_disposed_date, t1.part_id from assets as t0 join asset_parts as t1 on t0.asset_id = t1.asset_id join parts as t2 on t1.part_id = t2.part_id join part_faults as t3 on t2.part_id = t3.part_id where t3.fault...
{ "index": 723, "split": "train" }
Is the price for lesson 4 cheaper than the price for lesson 2?
driving_school
select t1.c2 < t0.c2 from (select price as c2 from lessons where lesson_id = 2) as t1, (select price as c2 from lessons where lesson_id = 4) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select t1.c2 < t0.c2 from (select price as c2 from lessons where lesson_id = 2) as t1, (select price as c2 from lessons where lesson_id = 4) as t0" }, "style": "rule" }
{ "index": 3566, "split": "train" }
What is the difference in length, in meters, between the bridge with ID 8 and the bridge with ID 1?
architecture
select t1.c1 - t0.c1 from (select length_meters as c1 from bridge where id = 8) as t1, (select length_meters as c1 from bridge where id = 1) 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": "architecture", "sql": "select t1.c1 - t0.c1 from (select length_meters as c1 from bridge where id = 8) as t1, (select length_meters as c1 from bridge where id = 1) as t0" }, "style": "rule" }
{ "index": 3582, "split": "train" }
Did customer 4's maximum property ID on March 27, 2015, experience a percentage change greater than the variation observed among other customers who moved into properties with IDs over 605 on that same date?
local_govt_and_lot
select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c4 from (select max(t1.property_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 4 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t2, (select abs((count(distinct (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": "local_govt_and_lot", "sql": "select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c4 from (select max(t1.property_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 4 and t1.date_moved_in = '2015-03-27 12:00:00'...
{ "index": 3445, "split": "train" }
What are the customer IDs, names, and average savings balances for accounts with names starting with "B", listed in order from the highest to the lowest customer ID?
small_bank_1
select avg(t0.balance), t1.name as c1, t1.custid as c0 from savings as t0 join accounts as t1 on t0.custid = t1.custid where c1 like 'B%' group by c0 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": "small_bank_1", "sql": "select avg(t0.balance), t1.name as c1, t1.custid as c0 from savings as t0 join accounts as t1 on t0.custid = t1.custid where c1 like 'B%' group by c0 order by c0 desc" }, "style": "rule" }
{ "index": 2025, "split": "train" }
What are the nationalities and years of experience of journalists, along with the type of work they did and the event IDs of news reports related to events that had exactly 369 attendees?
news_report
select t0.nationality, t0.years_working, t1.work_type, t1.event_id from journalist as t0 join news_report as t1 on t0.journalist_id = t1.journalist_id join event as t2 on t1.event_id = t2.event_id where t2.event_attendance between 369 and 369
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "news_report", "sql": "select t0.nationality, t0.years_working, t1.work_type, t1.event_id from journalist as t0 join news_report as t1 on t0.journalist_id = t1.journalist_id join event as t2 on t1.event_id = t2.event_id where t2.event_attendance between 369 and 369" }, "style"...
{ "index": 2427, "split": "train" }
What are the country and name of each airline, along with the source airport ID, for routes that originate from airports located in countries containing "Nig" and with elevation less than or equal to 1378 meters?
flight_4
select t0.country, t0.name, t1.src_apid 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.country like '%Nig%' and t2.elevation <= 1378
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t0.country, t0.name, t1.src_apid 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.country like '%Nig%' and t2.elevation <= 1378" }, "style": "rule" }
{ "index": 2432, "split": "train" }
Is the booking end date for the rental with ID 15 later than the booking end date for the rental with ID 5?
products_for_hire
select t1.c1 > t0.c1 from (select booking_end_date as c1 from bookings where booking_id = 15) as t1, (select booking_end_date as c1 from bookings where booking_id = 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": "products_for_hire", "sql": "select t1.c1 > t0.c1 from (select booking_end_date as c1 from bookings where booking_id = 15) as t1, (select booking_end_date as c1 from bookings where booking_id = 5) as t0" }, "style": "rule" }
{ "index": 3094, "split": "train" }
Which workshop group's ID, currency code, store name, and city are associated with addresses that either have an address ID of 230 or higher, or fall between 286 and 369, focusing on the one with the highest workshop group ID?
cre_Drama_Workshop_Groups
select t0.workshop_group_id as c3, t0.currency_code, t0.store_name, t1.city_town from drama_workshop_groups as t0 join addresses as t1 on t0.address_id = t1.address_id join stores as t2 on t1.address_id = t2.address_id where t2.address_id >= 230 or t2.address_id between 286 and 369 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": "cre_Drama_Workshop_Groups", "sql": "select t0.workshop_group_id as c3, t0.currency_code, t0.store_name, t1.city_town from drama_workshop_groups as t0 join addresses as t1 on t0.address_id = t1.address_id join stores as t2 on t1.address_id = t2.address_id where t2.address_id >= 23...
{ "index": 672, "split": "train" }
What are the descriptions of the first 10 colors associated with products whose category code ends with "erbs" or begins with "He", sorted alphabetically by color description?
products_gen_characteristics
select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.product_category_code like '%erbs' or t1.product_category_code like 'He%' 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": "products_gen_characteristics", "sql": "select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.product_category_code like '%erbs' or t1.product_category_code like 'He%' order by c0 asc nulls last limit 10" }, "styl...
{ "index": 639, "split": "train" }
Which players and their corresponding teams are listed in either the player records or the match season records?
match_season
select anon_1.c1, anon_1.c0 from (select player as c1, team as c0 from player union select player, team from match_season) 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": "match_season", "sql": "select anon_1.c1, anon_1.c0 from (select player as c1, team as c0 from player union select player, team from match_season) as anon_1" }, "style": "rule" }
{ "index": 2864, "split": "train" }
Find the family names and address line 1 of course authors and tutors who have authored courses with names ending in "anced database" or starting with "Spa".
e_learning
select t0.family_name, t0.address_line_1 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_name like '%anced database' or t1.course_name like 'Spa%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.family_name, t0.address_line_1 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_name like '%anced database' or t1.course_name like 'Spa%'" }, "style": "rule" }
{ "index": 2808, "split": "train" }
Can you tell me which five VIP accounts have the fewest number of transactions, and what the average invoice number is for each of those accounts?
customers_and_invoices
select count(t0.transaction_id) as c0, avg(t0.invoice_number) from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.other_account_details like 'VIP%' order by c0 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select count(t0.transaction_id) as c0, avg(t0.invoice_number) from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.other_account_details like 'VIP%' order by c0 asc nulls last limit 5" }, "style": "ru...
{ "index": 1398, "split": "train" }
What are the names of the three products that had problems reported before June 26, 1978, ordered alphabetically by product name?
tracking_software_problems
select t0.product_name as c0 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t1.date_problem_reported < '1978-06-26 19:10:17' order by c0 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t0.product_name as c0 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t1.date_problem_reported < '1978-06-26 19:10:17' order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 2471, "split": "train" }
What is the potential rating of the player with ID 60354?
soccer_1
select potential from player_attributes where id = 60354
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select potential from player_attributes where id = 60354" }, "style": "rule" }
{ "index": 3396, "split": "train" }
Which investors have made transactions with an amount of exactly 29.3534, but have not conducted any transactions with a type code that includes "R"?
tracking_share_transactions
select anon_1.c0, anon_1.c1 from (select t0.investor_id as c0, t0.investor_details as c1 from investors as t0 join transactions as t1 on t0.investor_id = t1.investor_id where t1.amount_of_transaction = 29.3534 except select t0.investor_id as c0, t0.investor_details as c1 from investors as t0 join transactions as t1 on ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select anon_1.c0, anon_1.c1 from (select t0.investor_id as c0, t0.investor_details as c1 from investors as t0 join transactions as t1 on t0.investor_id = t1.investor_id where t1.amount_of_transaction = 29.3534 except select t0.investor_id as ...
{ "index": 683, "split": "train" }
For each product quantity where the average product ID exceeds 5, what are the five highest product quantities and their average product IDs, sorted from largest to smallest?
customers_and_invoices
select product_quantity as c0, avg(product_id) from order_items group by c0 having avg(product_id) > 5 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": "customers_and_invoices", "sql": "select product_quantity as c0, avg(product_id) from order_items group by c0 having avg(product_id) > 5 order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2082, "split": "train" }
What are the highest 10 medication doses prescribed, listed in order from the patient with the most prescriptions to the ones with fewer?
hospital_1
select dose from prescribes order by patient 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": "hospital_1", "sql": "select dose from prescribes order by patient desc limit 10" }, "style": "rule" }
{ "index": 2378, "split": "train" }
What are the "Date Valid To" dates and card IDs for customer cards with IDs 4 or 5, along with the number of accounts associated with each card, sorted by the number of accounts?
customers_card_transactions
select t0.date_valid_to, t0.card_id as c1, count(t1.account_id) as c2 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.card_id between 4 and 5 group by c1 order by c2 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select t0.date_valid_to, t0.card_id as c1, count(t1.account_id) as c2 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.card_id between 4 and 5 group by c1 order by c2 asc nulls last" }, "sty...
{ "index": 508, "split": "train" }
Which are the top three stations named "San Salvador at 1st" that have the highest total number of bikes available, and what are their dock counts and station IDs?
bike_1
select sum(t0.bikes_available) as c2, t1.dock_count, t1.id as c0 from status as t0 join station as t1 on t0.station_id = t1.id where t1.name = 'San Salvador at 1st' group by c0 order by c2 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select sum(t0.bikes_available) as c2, t1.dock_count, t1.id as c0 from status as t0 join station as t1 on t0.station_id = t1.id where t1.name = 'San Salvador at 1st' group by c0 order by c2 desc limit 3" }, "style": "rule" }
{ "index": 929, "split": "train" }
What are the characteristic type codes and product IDs for characteristics with IDs less than or equal to the highest characteristic ID present in the product characteristics?
products_gen_characteristics
select t0.characteristic_type_code, t1.product_id from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id, (select max(characteristic_id) as c2 from product_characteristics) as t0 where t1.characteristic_id <= 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": "products_gen_characteristics", "sql": "select t0.characteristic_type_code, t1.product_id from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id, (select max(characteristic_id) as c2 from product_characteristics) as t0 where t1...
{ "index": 2504, "split": "train" }
Did train 7's scheduled time occur before train 4's scheduled time?
station_weather
select t1.c1 < t0.c1 from (select time as c1 from train where id = 7) as t1, (select time as c1 from train where id = 4) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select t1.c1 < t0.c1 from (select time as c1 from train where id = 7) as t1, (select time as c1 from train where id = 4) as t0" }, "style": "rule" }
{ "index": 3144, "split": "train" }
Which are the ten performers’ phone numbers, their address IDs, along with the city and state or county where the drama workshop groups that have store phone numbers ending with "303" are located? Please list these results sorted by state or county in descending order.
cre_Drama_Workshop_Groups
select t0.customer_phone, t0.address_id, t1.city_town, t1.state_county as c0 from performers as t0 join addresses as t1 on t0.address_id = t1.address_id join drama_workshop_groups as t2 on t1.address_id = t2.address_id where t2.store_phone like '%303' 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": "cre_Drama_Workshop_Groups", "sql": "select t0.customer_phone, t0.address_id, t1.city_town, t1.state_county as c0 from performers as t0 join addresses as t1 on t0.address_id = t1.address_id join drama_workshop_groups as t2 on t1.address_id = t2.address_id where t2.store_phone like...
{ "index": 2839, "split": "train" }
How many weddings took place at the church with the ID of 1?
wedding
select count(*) from wedding where church_id = 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "wedding", "sql": "select count(*) from wedding where church_id = 1" }, "style": "rule" }
{ "index": 2294, "split": "train" }
What are the three institution types with the highest types in reverse alphabetical order among those with institution IDs ending in "10," and for each, what is the total number of entries, the number of institutions, and the number of unique locations?
protein_institute
select type as c1, count(*), count(institution), count(distinct (location)) from institution where institution_id like '%10' group by c1 order by c1 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "protein_institute", "sql": "select type as c1, count(*), count(institution), count(distinct (location)) from institution where institution_id like '%10' group by c1 order by c1 desc limit 3" }, "style": "rule" }
{ "index": 1140, "split": "train" }
What are the order IDs, product IDs, and customer IDs for the order that has the fewest items, as well as for all orders that include items?
department_store
select distinct t0.order_id as c0, t0.product_id, t1.customer_id from order_items as t0 join customer_orders as t1 on t0.order_id = t1.order_id, (select order_id as c3 from customer_orders group by c3 order by count(*) asc nulls last limit 1) as t1 where t1.order_id = t1.c3 or t1.order_id in (select c0 as c0 from order...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select distinct t0.order_id as c0, t0.product_id, t1.customer_id from order_items as t0 join customer_orders as t1 on t0.order_id = t1.order_id, (select order_id as c3 from customer_orders group by c3 order by count(*) asc nulls last limit 1) as t1 wher...
{ "index": 2284, "split": "train" }
Did the song "Tumi robe nirobe" come out before "Shukno patar nupur pae"?
music_1
select t1.c2 < t0.c2 from (select releasedate as c2 from song where song_name = 'Tumi robe nirobe') as t1, (select releasedate as c2 from song where song_name = 'Shukno patar nupur pae') as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t1.c2 < t0.c2 from (select releasedate as c2 from song where song_name = 'Tumi robe nirobe') as t1, (select releasedate as c2 from song where song_name = 'Shukno patar nupur pae') as t0" }, "style": "rule" }
{ "index": 3135, "split": "train" }
What is the budget for the English department, listed in order of the building they are located in, with any departments lacking building information appearing last?
college_2
select t0.budget from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.dept_name = 'English' order by t0.building 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": "college_2", "sql": "select t0.budget from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.dept_name = 'English' order by t0.building asc nulls last" }, "style": "rule" }
{ "index": 1648, "split": "train" }
Which performance ID appears most frequently in the records?
performance_attendance
select performance_id as c2, count(distinct (performance_id)) as c0 from performance group by c2 order by c0 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "performance_attendance", "sql": "select performance_id as c2, count(distinct (performance_id)) as c0 from performance group by c2 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 3873, "split": "train" }
Which catalog publisher, most recent revision date, and catalog name are associated with catalog levels whose names end with "ct" or start with "Sub-Cate"?
product_catalog
select t0.catalog_publisher, t0.date_of_latest_revision, t0.catalog_name from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_level_name like '%ct' or t1.catalog_level_name like 'Sub-Cate%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_publisher, t0.date_of_latest_revision, t0.catalog_name from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_level_name like '%ct' or t1.catalog_level_name like 'Sub-Cate%'" }, "style": "...
{ "index": 314, "split": "train" }
Which three manufacturers that produce furniture ending with "ookcase" have the fewest shops? For each, what is their opening year and manufacturer ID, and how are they ordered by manufacturer ID?
manufacturer
select t0.num_of_shops, t0.open_year, t0.manufacturer_id as c2 from manufacturer as t0 join furniture_manufacte as t1 on t0.manufacturer_id = t1.manufacturer_id join furniture as t2 on t1.furniture_id = t2.furniture_id where t2.name like '%ookcase' order by c2 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": "manufacturer", "sql": "select t0.num_of_shops, t0.open_year, t0.manufacturer_id as c2 from manufacturer as t0 join furniture_manufacte as t1 on t0.manufacturer_id = t1.manufacturer_id join furniture as t2 on t1.furniture_id = t2.furniture_id where t2.name like '%ookcase' order by...
{ "index": 424, "split": "train" }
Which media types are associated with tracks that have a duration of at least 272,352 milliseconds or less than 564,893 milliseconds?
store_1
select t0.name from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.milliseconds >= 272352 or t1.milliseconds < 564893
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t0.name from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.milliseconds >= 272352 or t1.milliseconds < 564893" }, "style": "rule" }
{ "index": 402, "split": "train" }
Which document type codes are associated with grants numbered between 6 and 11, or with the latest grant in the system?
tracking_grants_for_research
select t0.document_type_code, t1.document_type_code from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code, (select max(grant_id) as c1 from documents) as t0 where t1.grant_id between 6 and 11 or t1.grant_id >= t0.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t0.document_type_code, t1.document_type_code from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code, (select max(grant_id) as c1 from documents) as t0 where t1.grant_id between 6 and 11 or t1.g...
{ "index": 1768, "split": "train" }
Which aircraft with fewer than two flights has the lowest total flight price, and what are its name and aid?
flight_1
select t0.name, t0.aid as c0 from aircraft as t0 join flight as t1 on t0.aid = t1.aid where c0 in (select t1.aid as c1 from flight) group by c0 having count(*) < 2 order by sum(t1.price) 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_1", "sql": "select t0.name, t0.aid as c0 from aircraft as t0 join flight as t1 on t0.aid = t1.aid where c0 in (select t1.aid as c1 from flight) group by c0 having count(*) < 2 order by sum(t1.price) asc nulls last limit 1" }, "style": "rule" }
{ "index": 406, "split": "train" }
Which seasons did team 4 participate in, and how many unique draft pick numbers were recorded for each season?
match_season
select season as c1, count(distinct (draft_pick_number)) from match_season where team = 4 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": "match_season", "sql": "select season as c1, count(distinct (draft_pick_number)) from match_season where team = 4 group by c1" }, "style": "rule" }
{ "index": 1607, "split": "train" }
Which cities participated in the match with ID 6, excluding those that took place in a month or year containing "ly 19"? For these cities, what are their regional populations, GDPs, city IDs, and names?
city_record
select anon_1.c2, anon_1.c1, anon_1.c0, anon_1.c3 from (select t0.regional_population as c2, t0.gdp as c1, t0.city_id as c0, t0.city as c3 from city as t0 join hosting_city as t1 on t0.city_id = t1.host_city join match as t2 on t1.match_id = t2.match_id where t2.match_id = 6 except select t0.regional_population as 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": "city_record", "sql": "select anon_1.c2, anon_1.c1, anon_1.c0, anon_1.c3 from (select t0.regional_population as c2, t0.gdp as c1, t0.city_id as c0, t0.city as c3 from city as t0 join hosting_city as t1 on t0.city_id = t1.host_city join match as t2 on t1.match_id = t2.match_id wher...
{ "index": 2934, "split": "train" }
What is the result of subtracting 4 from the lot ID in the transactions_lots record where the transaction ID is 15?
tracking_share_transactions
select lot_id - 4 from transactions_lots where transaction_id = 15
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select lot_id - 4 from transactions_lots where transaction_id = 15" }, "style": "rule" }
{ "index": 3259, "split": "train" }
Find all the unique product names and IDs for products named "food".
tracking_orders
select distinct product_name as c0, product_id from products where c0 = 'food'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct product_name as c0, product_id from products where c0 = 'food'" }, "style": "rule" }
{ "index": 1797, "split": "train" }
Is the attribute ID linked to catalog entry 6 greater than the attribute ID linked to catalog entry 1?
product_catalog
select t1.c1 > t0.c1 from (select attribute_id as c1 from catalog_contents_additional_attributes where catalog_entry_id = 1) as t1, (select attribute_id as c1 from catalog_contents_additional_attributes where catalog_entry_id = 6) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select t1.c1 > t0.c1 from (select attribute_id as c1 from catalog_contents_additional_attributes where catalog_entry_id = 1) as t1, (select attribute_id as c1 from catalog_contents_additional_attributes where catalog_entry_id = 6) as t0" }, "style": ...
{ "index": 3936, "split": "train" }
What is the highest rating percentage among all channels, and how many channels are there in total?
program_share
select max(rating_in_percent), count(*) from channel
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "program_share", "sql": "select max(rating_in_percent), count(*) from channel" }, "style": "rule" }
{ "index": 200, "split": "train" }
Show the building manager and address for each apartment building that has apartments with either exactly 3 bedrooms or more bedrooms than the average number of bedrooms in apartments with 3 or 4 bedrooms.
apartment_rentals
select t0.building_manager, t0.building_address from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id, (select avg(bedroom_count) as c1 from apartments where bedroom_count = 3 or bedroom_count between 4 and 4) as t0 where t1.bedroom_count = 3 or t1.bedroom_count > 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": "apartment_rentals", "sql": "select t0.building_manager, t0.building_address from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id, (select avg(bedroom_count) as c1 from apartments where bedroom_count = 3 or bedroom_count between 4 and 4) as t0 wh...
{ "index": 2964, "split": "train" }
What are the order date, order status, and order ID, along with the average invoice number for orders shipped after April 1, 1991, at 3:24:24 PM?
tracking_orders
select t0.date_order_placed, t0.order_status, t0.order_id as c1, avg(t1.invoice_number) from orders as t0 join shipments as t1 on t0.order_id = t1.order_id where t1.shipment_date > '1991-04-01 15:24:24' 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": "tracking_orders", "sql": "select t0.date_order_placed, t0.order_status, t0.order_id as c1, avg(t1.invoice_number) from orders as t0 join shipments as t1 on t0.order_id = t1.order_id where t1.shipment_date > '1991-04-01 15:24:24' group by c1" }, "style": "rule" }
{ "index": 1705, "split": "train" }
What are the budgets, department names, and instructor department names for the top three instructors whose salaries are between 45,538.32 and 72,140.88 and whose IDs end with "0643," ordered by department name from Z to A?
college_2
select t0.budget, t0.dept_name, t1.dept_name as c0 from department as t0 join instructor as t1 on t0.dept_name = t1.dept_name where t1.salary between 45538.32 and 72140.88 and t1.id like '%0643' 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": "college_2", "sql": "select t0.budget, t0.dept_name, t1.dept_name as c0 from department as t0 join instructor as t1 on t0.dept_name = t1.dept_name where t1.salary between 45538.32 and 72140.88 and t1.id like '%0643' order by c0 desc limit 3" }, "style": "rule" }
{ "index": 198, "split": "train" }
Is the number of stories of the building with ID 8 less than 67?
company_office
select stories < 67 from buildings where id = 8
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select stories < 67 from buildings where id = 8" }, "style": "rule" }
{ "index": 3332, "split": "train" }
Can you list the names of all cities and counties that appear in either the city table or the county public safety table?
county_public_safety
select anon_1.c1 from (select name as c1 from city union select name from county_public_safety) 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": "county_public_safety", "sql": "select anon_1.c1 from (select name as c1 from city union select name from county_public_safety) as anon_1" }, "style": "rule" }
{ "index": 1531, "split": "train" }
Which product names are associated with problems reported either by staff member with ID 2 or by staff members whose IDs are greater than or equal to the total number of problem reports?
tracking_software_problems
select t0.product_name from product as t0 join problems as t1 on t0.product_id = t1.product_id, (select count(reported_by_staff_id) as c0 from problems) as t0 where t1.reported_by_staff_id = 2 or t1.reported_by_staff_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": "tracking_software_problems", "sql": "select t0.product_name from product as t0 join problems as t1 on t0.product_id = t1.product_id, (select count(reported_by_staff_id) as c0 from problems) as t0 where t1.reported_by_staff_id = 2 or t1.reported_by_staff_id >= t0.c0" }, "style...
{ "index": 2473, "split": "train" }
Show the names, artwork IDs, and types of the top 5 artworks along with their nomination artwork IDs for festivals attended by audiences larger than 155, ordered by artwork ID in descending order.
entertainment_awards
select t0.name, t0.artwork_id, t0.type, t1.artwork_id as c0 from artwork as t0 join nomination as t1 on t0.artwork_id = t1.artwork_id join festival_detail as t2 on t1.festival_id = t2.festival_id where t2.num_of_audience > 155 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": "entertainment_awards", "sql": "select t0.name, t0.artwork_id, t0.type, t1.artwork_id as c0 from artwork as t0 join nomination as t1 on t0.artwork_id = t1.artwork_id join festival_detail as t2 on t1.festival_id = t2.festival_id where t2.num_of_audience > 155 order by c0 desc limit...
{ "index": 1498, "split": "train" }
Which addresses are linked to customer IDs 14 or 6 and have no more than two customers associated with them? For these addresses, what are the zip code, city, and address ID?
customers_and_addresses
select t0.zip_postcode, t0.city, t0.address_id as c2 from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id where t1.customer_id = 14 or t1.customer_id = 6 group by c2 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": "customers_and_addresses", "sql": "select t0.zip_postcode, t0.city, t0.address_id as c2 from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id where t1.customer_id = 14 or t1.customer_id = 6 group by c2 having count(*) <= 2" }, "style": "rule" }
{ "index": 1385, "split": "train" }
Can you tell me the order IDs, quantities, and product IDs for all orders that include an Americano?
customers_and_addresses
select distinct t0.product_id, t0.order_quantity, t0.order_id from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_id = 1 and t1.product_details = 'Americano'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct t0.product_id, t0.order_quantity, t0.order_id from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_id = 1 and t1.product_details = 'Americano'" }, "style": "rule" }
{ "index": 1230, "split": "train" }
What is the latest completion date for the student who has the highest student ID among those with registration ID 13?
e_learning
select t0.date_of_completion, t0.student_id as c2 from student_course_enrolment as t0, (select max(student_id) as c1 from student_course_enrolment where registration_id = 13) as t1 where c2 = t1.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.date_of_completion, t0.student_id as c2 from student_course_enrolment as t0, (select max(student_id) as c1 from student_course_enrolment where registration_id = 13) as t1 where c2 = t1.c1" }, "style": "rule" }
{ "index": 3943, "split": "train" }
Which are the top 10 wrestlers or moves that most frequently eliminated others, when looking at the eliminations from teams with the highest number of eliminations?
wrestler
select eliminated_by from elimination order by team 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": "wrestler", "sql": "select eliminated_by from elimination order by team desc limit 10" }, "style": "rule" }
{ "index": 2832, "split": "train" }
What are the album IDs, titles, artist IDs, and associated track album IDs for albums that have tracks with media types named "Purchased AAC audio file" or starting with "Purchased"?
chinook_1
select t0.albumid, t0.title, t0.artistid, t1.albumid from album as t0 join track as t1 on t0.albumid = t1.albumid join mediatype as t2 on t1.mediatypeid = t2.mediatypeid where t2.name = 'Purchased AAC audio file' or t2.name like 'Purchased%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "chinook_1", "sql": "select t0.albumid, t0.title, t0.artistid, t1.albumid from album as t0 join track as t1 on t0.albumid = t1.albumid join mediatype as t2 on t1.mediatypeid = t2.mediatypeid where t2.name = 'Purchased AAC audio file' or t2.name like 'Purchased%'" }, "style": "...
{ "index": 484, "split": "train" }
Find the author IDs and course descriptions for the first three courses that students enrolled in before August 2, 2017, sorted by author ID.
e_learning
select t0.author_id as c1, t0.course_description from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id where t1.date_of_enrolment < '2017-08-02 17:21:44' 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": "e_learning", "sql": "select t0.author_id as c1, t0.course_description from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id where t1.date_of_enrolment < '2017-08-02 17:21:44' order by c1 asc nulls last limit 3" }, "style": "rule" }
{ "index": 224, "split": "train" }
Can you identify the top three forms—specifically their names and types—and the associated party IDs and form IDs, for parties that either have the most common phone number or have phone numbers starting with '0'? The results should be ordered by form name in reverse alphabetical order.
e_government
select t0.form_name as c3, t0.form_type_code, t1.party_id, t1.form_id from forms as t0 join party_forms as t1 on t0.form_id = t1.form_id join parties as t2 on t1.party_id = t2.party_id, (select party_phone as c1 from parties group by c1 order by count(*) asc nulls last limit 1) as t0 where t2.party_phone = t0.c1 or t2....
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_government", "sql": "select t0.form_name as c3, t0.form_type_code, t1.party_id, t1.form_id from forms as t0 join party_forms as t1 on t0.form_id = t1.form_id join parties as t2 on t1.party_id = t2.party_id, (select party_phone as c1 from parties group by c1 order by count(*) as...
{ "index": 2799, "split": "train" }
What is the checking account balance for the customer with ID 1?
small_bank_1
select balance from checking where custid = 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 balance from checking where custid = 1" }, "style": "rule" }
{ "index": 3395, "split": "train" }
What are the block floors and block codes where appointments took place involving medications with code 1 and names containing "n", prescribed to patients by nurses on call in those blocks?
hospital_1
select t0.blockfloor, t0.blockcode, t3.appointmentid from block as t0 join on_call as t1 on t0.blockfloor = t1.blockfloor join nurse as t2 on t1.nurse = t2.employeeid join appointment as t3 on t2.employeeid = t3.prepnurse join patient as t4 on t3.patient = t4.ssn join prescribes as t5 on t4.ssn = t5.patient join medica...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.blockfloor, t0.blockcode, t3.appointmentid from block as t0 join on_call as t1 on t0.blockfloor = t1.blockfloor join nurse as t2 on t1.nurse = t2.employeeid join appointment as t3 on t2.employeeid = t3.prepnurse join patient as t4 on t3.patient = t4...
{ "index": 1427, "split": "train" }
List each book author whose name starts with "Dave G" along with the total number of issues, the number of books they have written, and the total count of their book entries, all sorted by the author's name from Z to A.
book_2
select writer as c0, sum(issues), count(*), count(book_id) from book where c0 like 'Dave G%' group by c0 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": "book_2", "sql": "select writer as c0, sum(issues), count(*), count(book_id) from book where c0 like 'Dave G%' group by c0 order by c0 desc" }, "style": "rule" }
{ "index": 1965, "split": "train" }
Can you list the details of the ten manufacturers with the fewest factories, including their manufacturer IDs and names, along with the IDs of their furniture items? For each, show the manufacturer ID and furniture ID of furniture that either isn't made by a manufacturer whose name starts with "IKEA" or "Dod" or isn't ...
manufacturer
select t0.num_of_factories as c2, t0.manufacturer_id, t0.name as c3, t1.manufacturer_id, t1.furniture_id from manufacturer as t0 join furniture_manufacte as t1 on t0.manufacturer_id = t1.manufacturer_id join furniture as t2 on t1.furniture_id = t2.furniture_id where (not t2.name in (select c3 as c3 from manufacturer wh...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "manufacturer", "sql": "select t0.num_of_factories as c2, t0.manufacturer_id, t0.name as c3, t1.manufacturer_id, t1.furniture_id from manufacturer as t0 join furniture_manufacte as t1 on t0.manufacturer_id = t1.manufacturer_id join furniture as t2 on t1.furniture_id = t2.furniture...
{ "index": 697, "split": "train" }
Which gender codes and guest IDs belong to guests with guest IDs of 4 or less who also have the most frequently used booking status code?
apartment_rentals
select t0.gender_code, t0.guest_id from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id, (select booking_status_code as c0 from apartment_bookings group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.guest_id <= 4 and t1.booking_status_code = 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": "apartment_rentals", "sql": "select t0.gender_code, t0.guest_id from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id, (select booking_status_code as c0 from apartment_bookings group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.guest_id <= ...
{ "index": 2116, "split": "train" }
Which are the top 5 card IDs and card numbers for customers with IDs less than or equal to 8, sorted by the highest card number first?
customers_card_transactions
select t0.card_id, t0.card_number as c1 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id join accounts as t2 on t1.account_id = t2.account_id where t2.customer_id <= 8 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": "customers_card_transactions", "sql": "select t0.card_id, t0.card_number as c1 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id join accounts as t2 on t1.account_id = t2.account_id where t2.customer_id <= 8 order by c1 desc limit 5" }, "s...
{ "index": 6, "split": "train" }
Which claim header IDs have a paid amount of at least 582.03?
insurance_and_eClaims
select distinct claim_header_id from claim_headers where amount_piad >= 582.03
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_and_eClaims", "sql": "select distinct claim_header_id from claim_headers where amount_piad >= 582.03" }, "style": "rule" }
{ "index": 1715, "split": "train" }
Which are the five most recent dates where the average support rate for candidates was at least 34%, ordered from highest to lowest average support?
candidate_poll
select date as c0, avg(consider_rate) as c1 from candidate group by c0 having avg(consider_rate) >= 0.34 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": "candidate_poll", "sql": "select date as c0, avg(consider_rate) as c1 from candidate group by c0 having avg(consider_rate) >= 0.34 order by c1 desc limit 5" }, "style": "rule" }
{ "index": 565, "split": "train" }
What are the names of the first three people alphabetically who have a minimum weight between 45.0 and 80.0, given they weigh more than 75.0 or between 75.0 and 76.0?
entrepreneur
select min(weight) from people where weight > 75.0 or weight between 75.0 and 76.0 group by name having min(weight) between 45.0 and 80.0 order by name 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": "entrepreneur", "sql": "select min(weight) from people where weight > 75.0 or weight between 75.0 and 76.0 group by name having min(weight) between 45.0 and 80.0 order by name asc nulls last limit 3" }, "style": "rule" }
{ "index": 1802, "split": "train" }
What are the top five customers who became clients on or before April 8, 2016, along with the number of different staff members who taught each of them, ordered by their customer ID in descending order?
driving_school
select count(distinct (t0.staff_id)), t1.date_of_birth from lessons as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_became_customer <= '2016-04-08 00:28:15' group by t1.customer_id order by t1.customer_id desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select count(distinct (t0.staff_id)), t1.date_of_birth from lessons as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_became_customer <= '2016-04-08 00:28:15' group by t1.customer_id order by t1.customer_id desc limit 5" }, "...
{ "index": 1714, "split": "train" }
When was the latest date for the document associated with the project that has the highest project ID among the documents with document ID 192?
cre_Docs_and_Epenses
select t0.document_date, t0.project_id as c3 from documents as t0, (select max(project_id) as c2 from documents where document_id = 192) as t1 where c3 = t1.c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Docs_and_Epenses", "sql": "select t0.document_date, t0.project_id as c3 from documents as t0, (select max(project_id) as c2 from documents where document_id = 192) as t1 where c3 = t1.c2" }, "style": "rule" }
{ "index": 3753, "split": "train" }
Is the expiration date of the card with ID 15 later than the expiration date of the card with ID 14?
customers_card_transactions
select t1.c2 > t0.c2 from (select date_valid_to as c2 from customers_cards where card_id = 15) as t1, (select date_valid_to as c2 from customers_cards where card_id = 14) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select t1.c2 > t0.c2 from (select date_valid_to as c2 from customers_cards where card_id = 15) as t1, (select date_valid_to as c2 from customers_cards where card_id = 14) as t0" }, "style": "rule" }
{ "index": 3081, "split": "train" }
What are the titles and worldwide gross earnings of the top three movies produced or associated with the company named Culture China Cargo, sorted from highest to lowest gross?
culture_company
select t0.title, t0.gross_worldwide as c1 from movie as t0 join culture_company as t1 on t0.movie_id = t1.movie_id where t1.company_name = 'Culture China Cargo' order by c1 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "culture_company", "sql": "select t0.title, t0.gross_worldwide as c1 from movie as t0 join culture_company as t1 on t0.movie_id = t1.movie_id where t1.company_name = 'Culture China Cargo' order by c1 desc limit 3" }, "style": "rule" }
{ "index": 1826, "split": "train" }
Among accounts belonging to customer 8, what are the three accounts with the fewest distinct transactions, and for each, what is the count of transactions and the smallest card ID used?
customers_card_transactions
select count(distinct (t0.account_id)), min(t0.card_id) from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.customer_id = 8 group by t1.account_id order by t1.account_id asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select count(distinct (t0.account_id)), min(t0.card_id) from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.customer_id = 8 group by t1.account_id order by t1.account_id asc nulls last limit 3" },...
{ "index": 1946, "split": "train" }
What are the earliest compatible since years for the five browsers or accelerator combinations that support the fewest unique accelerators?
browser_web
select min(compatible_since_year) from accelerator_compatible_browser order by count(distinct (accelerator_id)) asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "browser_web", "sql": "select min(compatible_since_year) from accelerator_compatible_browser order by count(distinct (accelerator_id)) asc nulls last limit 5" }, "style": "rule" }
{ "index": 665, "split": "train" }
Which person, whose name contains "c" or starts with "D," has the earliest average year of friendship, and what is that average year?
network_2
select avg(t0.year) as c1, t1.name as c0 from personfriend as t0 join person as t1 on t0.friend = t1.name where c0 like '%c%' or c0 like 'D%' group by c0 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": "network_2", "sql": "select avg(t0.year) as c1, t1.name as c0 from personfriend as t0 join person as t1 on t0.friend = t1.name where c0 like '%c%' or c0 like 'D%' group by c0 order by c1 asc nulls last limit 1" }, "style": "rule" }
{ "index": 1260, "split": "train" }
?
apartment_rentals
select t0.apt_id, t0.booking_status_code from apartment_bookings as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.bathroom_count between 1 and 3 order by t0.booking_start_date 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": "apartment_rentals", "sql": "select t0.apt_id, t0.booking_status_code from apartment_bookings as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.bathroom_count between 1 and 3 order by t0.booking_start_date asc nulls last limit 5" }, "style": "rule" }
{ "index": 168, "split": "train" }
Was the song "Tumi robe nirobe" released after the song "Ami opar hoye"?
music_1
select t1.c2 > t0.c2 from (select releasedate as c2 from song where song_name = 'Tumi robe nirobe') as t1, (select releasedate as c2 from song where song_name = 'Ami opar hoye') as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t1.c2 > t0.c2 from (select releasedate as c2 from song where song_name = 'Tumi robe nirobe') as t1, (select releasedate as c2 from song where song_name = 'Ami opar hoye') as t0" }, "style": "rule" }
{ "index": 3089, "split": "train" }
Looking at the research grants, what are the organization IDs, grant amounts, and grant IDs for each grant, along with how many documents related to each grant have document types ending with "G" or starting with "RE"?
tracking_grants_for_research
select t0.organisation_id, t0.grant_amount, t0.grant_id as c0, count(*) from grants as t0 join documents as t1 on t0.grant_id = t1.grant_id where t1.document_type_code like '%G' or t1.document_type_code like 'RE%' 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": "tracking_grants_for_research", "sql": "select t0.organisation_id, t0.grant_amount, t0.grant_id as c0, count(*) from grants as t0 join documents as t1 on t0.grant_id = t1.grant_id where t1.document_type_code like '%G' or t1.document_type_code like 'RE%' group by c0" }, "style"...
{ "index": 1875, "split": "train" }
Find the titles and item IDs of items that have reviews with a rank of at least 1 or at most 3.
epinions_1
select t0.title from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.rank >= 1 or t1.rank <= 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": "epinions_1", "sql": "select t0.title from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.rank >= 1 or t1.rank <= 3" }, "style": "rule" }
{ "index": 169, "split": "train" }
Is the lot ID associated with transaction 6 smaller than the total count of all lots?
tracking_share_transactions
select t2.c1 < t1.c3 from (select lot_id as c1 from transactions_lots where transaction_id = 6) as t2, (select count(lot_id) as c3 from transactions_lots) as t1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select t2.c1 < t1.c3 from (select lot_id as c1 from transactions_lots where transaction_id = 6) as t2, (select count(lot_id) as c3 from transactions_lots) as t1" }, "style": "rule" }
{ "index": 3325, "split": "train" }
Which are the top 10 grades in reverse alphabetical order, and how many enrollments and unique course IDs are associated with each grade?
college_3
select grade as c0, count(*), count(cid) from enrolled_in 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": "college_3", "sql": "select grade as c0, count(*), count(cid) from enrolled_in group by c0 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 1576, "split": "train" }
What are the locations, products, and types of interactions between medicines with ID 1 and the enzymes involved in heme biosynthesis?
medicine_enzyme_interaction
select t0.location, t0.product, t1.interaction_type from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.medicine_id = 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select t0.location, t0.product, t1.interaction_type from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.medicine_id = 1" }, "style": "rule" }
{ "index": 2597, "split": "train" }
What is the highest airport ID and the total number of distinct velocities for flights operated by companies with principal activities that are either the most common among those with group equity shareholding over 45% and ID 5, or that start with "Ai"?
flight_company
select max(t0.airport_id), count(distinct (t0.velocity)) from flight as t0 join operate_company as t1 on t0.company_id = t1.id, (select principal_activities as c1 from operate_company where group_equity_shareholding > 45.0 and id = 5 group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.principal_activit...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 max(t0.airport_id), count(distinct (t0.velocity)) from flight as t0 join operate_company as t1 on t0.company_id = t1.id, (select principal_activities as c1 from operate_company where group_equity_shareholding > 45.0 and id = 5 group by c1 order by ...
{ "index": 2328, "split": "train" }
What are the details of the top 3 products—specifically their prices, names, and IDs—based on the highest product ID among orders with ID 13 or above?
department_store
select t0.product_price, t0.product_name, t0.product_id as c3, max(t1.product_id) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_id >= 13 group by c3 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": "department_store", "sql": "select t0.product_price, t0.product_name, t0.product_id as c3, max(t1.product_id) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_id >= 13 group by c3 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 160, "split": "train" }
What are the earliest and latest years when the minimum estimated market value was less than 53.0 across different markets?
film_rank
select min(t0.c3), max(t0.c3) from (select min(t1.year) as c3 from market as t0 join film_market_estimation as t1 on t0.market_id = t1.market_id where t1.high_estimate < 53.0 group by t0.market_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": "film_rank", "sql": "select min(t0.c3), max(t0.c3) from (select min(t1.year) as c3 from market as t0 join film_market_estimation as t1 on t0.market_id = t1.market_id where t1.high_estimate < 53.0 group by t0.market_id) as t0" }, "style": "rule" }
{ "index": 3641, "split": "train" }
Did the player with ID 6361 have a birthday that occurred after the birthday of the player with ID 6637?
soccer_1
select t1.c1 > t0.c1 from (select birthday as c1 from player where id = 6361) as t1, (select birthday as c1 from player where id = 6637) 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": "soccer_1", "sql": "select t1.c1 > t0.c1 from (select birthday as c1 from player where id = 6361) as t1, (select birthday as c1 from player where id = 6637) as t0" }, "style": "rule" }
{ "index": 3096, "split": "train" }
Show the state, county, address ID, and city for addresses associated with customers whose customer numbers start with "5".
customers_and_products_contacts
select t0.state_province_county, t0.address_id, t0.city from addresses as t0 join customer_address_history as t1 on t0.address_id = t1.address_id join customers as t2 on t1.customer_id = t2.customer_id where t2.customer_number like '5%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select t0.state_province_county, t0.address_id, t0.city from addresses as t0 join customer_address_history as t1 on t0.address_id = t1.address_id join customers as t2 on t1.customer_id = t2.customer_id where t2.customer_number like '5%'" ...
{ "index": 83, "split": "train" }