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
Can you list the carriers, device models, software platforms, and device IDs for all devices, excluding those that are available in shops opened in 2011 or later?
device
select anon_1.c1, anon_1.c2, anon_1.c0, anon_1.c3 from (select carrier as c1, device as c2, software_platform as c0, device_id as c3 from device except select t0.carrier as c1, t0.device as c2, t0.software_platform as c0, t0.device_id as c3 from device as t0 join stock as t1 on t0.device_id = t1.device_id join shop 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": "device", "sql": "select anon_1.c1, anon_1.c2, anon_1.c0, anon_1.c3 from (select carrier as c1, device as c2, software_platform as c0, device_id as c3 from device except select t0.carrier as c1, t0.device as c2, t0.software_platform as c0, t0.device_id as c3 from device as t0 join...
{ "index": 1939, "split": "train" }
What is the change in Organization ID for service 29 between the timestamp in late November 2016 and the timestamp in late May 2016?
local_govt_and_lot
select t1.c1 - t0.c1 from (select t0.organization_id as c1 from services as t0 join organizations as t1 on t0.organization_id = t1.organization_id join things as t2 on t1.organization_id = t2.organization_id join timed_status_of_things as t3 on t2.thing_id = t3.thing_id where t0.service_id = 29 and t3.date_and_date = '...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t1.c1 - t0.c1 from (select t0.organization_id as c1 from services as t0 join organizations as t1 on t0.organization_id = t1.organization_id join things as t2 on t1.organization_id = t2.organization_id join timed_status_of_things as t3 on t2.thi...
{ "index": 3523, "split": "train" }
How many missions have the code VMV-3?
ship_mission
select count(*) from mission where code = 'VMV-3'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "ship_mission", "sql": "select count(*) from mission where code = 'VMV-3'" }, "style": "rule" }
{ "index": 722, "split": "train" }
Can you tell me the three order entries for the most popular product, including their order IDs, quantities, and product IDs, sorted by product ID?
customers_and_addresses
select t0.order_id, t0.order_quantity, t0.product_id as c3 from order_items as t0 join products as t1 on t0.product_id = t1.product_id, (select product_details as c2 from products group by c2 order by count(*) desc limit 1) as t0 where t1.product_details = t0.c2 order by c3 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_and_addresses", "sql": "select t0.order_id, t0.order_quantity, t0.product_id as c3 from order_items as t0 join products as t1 on t0.product_id = t1.product_id, (select product_details as c2 from products group by c2 order by count(*) desc limit 1) as t0 where t1.product...
{ "index": 419, "split": "train" }
Can you list all the budget types and their descriptions from the reference codes, excluding those that are linked via expenses and documents to accounts with account details starting with "6352.0"?
cre_Docs_and_Epenses
select anon_1.c1, anon_1.c0 from (select budget_type_code as c1, budget_type_description as c0 from ref_budget_codes except select t0.budget_type_code as c1, t0.budget_type_description as c0 from ref_budget_codes as t0 join documents_with_expenses as t1 on t0.budget_type_code = t1.budget_type_code join documents as 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": "cre_Docs_and_Epenses", "sql": "select anon_1.c1, anon_1.c0 from (select budget_type_code as c1, budget_type_description as c0 from ref_budget_codes except select t0.budget_type_code as c1, t0.budget_type_description as c0 from ref_budget_codes as t0 join documents_with_expenses a...
{ "index": 1551, "split": "train" }
What are the city name, longitude, and station ID for the station with station ID 66?
bike_1
select t0.city, t0.long, t1.station_id as c2 from station as t0 join status as t1 on t0.id = t1.station_id where c2 = 66
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select t0.city, t0.long, t1.station_id as c2 from station as t0 join status as t1 on t0.id = t1.station_id where c2 = 66" }, "style": "rule" }
{ "index": 467, "split": "train" }
What are the names and IDs of the ten subjects with the fewest unique authors participating in courses that share the most common course description, and what is that course description?
e_learning
select t0.subject_name, t0.subject_id as c1 from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id, (select course_description as c0 from courses group by c0 order by count(author_id) desc limit 1) as t0 where t1.course_description = t0.c0 group by c1 order by count(distinct (t1.author_id)) asc nulls l...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.subject_name, t0.subject_id as c1 from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id, (select course_description as c0 from courses group by c0 order by count(author_id) desc limit 1) as t0 where t1.course_description = t0.c0 gr...
{ "index": 2295, "split": "train" }
How many different companies have offices in the building with ID 8?
company_office
select count(distinct (company_id)) from office_locations where building_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 count(distinct (company_id)) from office_locations where building_id = 8" }, "style": "rule" }
{ "index": 2151, "split": "train" }
What is the percentage change in the average of the earliest train IDs for all railways between trains arriving at 13:04 and those arriving at 23:39?
railway
select (avg(t0.c0) / cast(avg(t1.c0) as real) - 1) * 100 from (select min(t1.railway_id) as c0 from railway as t0 join train as t1 on t0.railway_id = t1.railway_id where t1.arrival = '13:04' group by t0.railway_id) as t0, (select t0.railway_id, min(t1.railway_id) as c0 from railway as t0 join train as t1 on t0.railway_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "railway", "sql": "select (avg(t0.c0) / cast(avg(t1.c0) as real) - 1) * 100 from (select min(t1.railway_id) as c0 from railway as t0 join train as t1 on t0.railway_id = t1.railway_id where t1.arrival = '13:04' group by t0.railway_id) as t0, (select t0.railway_id, min(t1.railway_id...
{ "index": 3043, "split": "train" }
What are the budget, building, department name, and the number of distinct instructor salaries (for instructors earning up to 51,647.57) for each department that has five or fewer instructors with salaries at or below that amount?
college_2
select t0.budget, t0.building, t0.dept_name as c2, count(distinct (t1.salary)) from department as t0 join instructor as t1 on t0.dept_name = t1.dept_name where t1.salary <= 51647.57 group by c2 having count(*) <= 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": "college_2", "sql": "select t0.budget, t0.building, t0.dept_name as c2, count(distinct (t1.salary)) from department as t0 join instructor as t1 on t0.dept_name = t1.dept_name where t1.salary <= 51647.57 group by c2 having count(*) <= 5" }, "style": "rule" }
{ "index": 1798, "split": "train" }
Find the host ID, nationality, and name of each host, along with their associated party's host ID and party ID, for parties that either started in a year containing the digit "4" or in the least common first year. List the results ordered by the host ID.
party_host
select t0.host_id as c5, t0.nationality, t0.name, t1.host_id, t1.party_id from host as t0 join party_host as t1 on t0.host_id = t1.host_id join party as t2 on t1.party_id = t2.party_id, (select first_year as c2 from party group by c2 order by count(*) asc nulls last limit 1) as t0 where t2.first_year like '%4%' or t2.f...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "party_host", "sql": "select t0.host_id as c5, t0.nationality, t0.name, t1.host_id, t1.party_id from host as t0 join party_host as t1 on t0.host_id = t1.host_id join party as t2 on t1.party_id = t2.party_id, (select first_year as c2 from party group by c2 order by count(*) asc nul...
{ "index": 1351, "split": "train" }
For the architect or architects who built the mill with ID 5, what are their genders, names, IDs, and the earliest year they built that mill?
architecture
select t0.gender, t0.name, t0.id as c0, min(t1.built_year) from architect as t0 join mill as t1 on t0.id = t1.architect_id where t1.id = 5 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": "architecture", "sql": "select t0.gender, t0.name, t0.id as c0, min(t1.built_year) from architect as t0 join mill as t1 on t0.id = t1.architect_id where t1.id = 5 group by c0" }, "style": "rule" }
{ "index": 125, "split": "train" }
For product ID 3, how many stores carry it, and can you list up to 10 product IDs with their store counts, ordered by product ID?
store_product
select product_id as c1, count(distinct (store_id)) from store_product where c1 = 3 group by c1 order by c1 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select product_id as c1, count(distinct (store_id)) from store_product where c1 = 3 group by c1 order by c1 asc nulls last limit 10" }, "style": "rule" }
{ "index": 2626, "split": "train" }
What are the service type and departure time for trains, along with the station and train identifiers, at stations in Glasgow that have more than 12 platforms?
train_station
select t0.service, t0.time, t1.station_id, t1.train_id from train as t0 join train_station as t1 on t0.train_id = t1.train_id join station as t2 on t1.station_id = t2.station_id where t2.number_of_platforms > 12 and t2.location like 'Glasg%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "train_station", "sql": "select t0.service, t0.time, t1.station_id, t1.train_id from train as t0 join train_station as t1 on t0.train_id = t1.train_id join station as t2 on t1.station_id = t2.station_id where t2.number_of_platforms > 12 and t2.location like 'Glasg%'" }, "style...
{ "index": 1852, "split": "train" }
What are the checking account balances and customer IDs for customers, along with their customer IDs and names, where the savings account balances are less than 230,000 or less than 240?
small_bank_1
select t0.balance, t0.custid, t1.custid, t1.name from checking as t0 join accounts as t1 on t0.custid = t1.custid join savings as t2 on t1.custid = t2.custid where t2.balance < 230000.0 or t2.balance < 240.0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select t0.balance, t0.custid, t1.custid, t1.name from checking as t0 join accounts as t1 on t0.custid = t1.custid join savings as t2 on t1.custid = t2.custid where t2.balance < 230000.0 or t2.balance < 240.0" }, "style": "rule" }
{ "index": 563, "split": "train" }
How many attendance records are there in total?
performance_attendance
select count(*) from member_attendance
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(*) from member_attendance" }, "style": "rule" }
{ "index": 1442, "split": "train" }
Which playlists, identified by name and ID, include tracks from albums where the artist's ID is either at least 5 or between 95 and 269?
store_1
select t0.name, t0.id, t1.playlist_id from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id join tracks as t2 on t1.track_id = t2.id join albums as t3 on t2.album_id = t3.id where t3.artist_id >= 5 or t3.artist_id between 95 and 269
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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, t0.id, t1.playlist_id from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id join tracks as t2 on t1.track_id = t2.id join albums as t3 on t2.album_id = t3.id where t3.artist_id >= 5 or t3.artist_id between 95 and 269" }, "...
{ "index": 812, "split": "train" }
Is the percentage change in the average customer ID for customer 5 on March 27, 2015, at noon greater than the variation among other customers associated with property 748 who moved in at the same time?
local_govt_and_lot
select abs((t2.c1 / cast(t2.c1 as real) - 1) * 100) > t1.c0 from (select avg(t1.customer_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 5 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t2, (select abs((count(distinct (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": "local_govt_and_lot", "sql": "select abs((t2.c1 / cast(t2.c1 as real) - 1) * 100) > t1.c0 from (select avg(t1.customer_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 5 and t1.date_moved_in = '2015-03-27 12:00:00'...
{ "index": 3951, "split": "train" }
What are the statement IDs and statement details for statements that are linked to accounts with statement IDs of at least 57 and also linked to accounts with statement IDs greater than 57?
cre_Docs_and_Epenses
select anon_1.c0, anon_1.c1 from (select t0.statement_id as c0, t0.statement_details as c1 from statements as t0 join accounts as t1 on t0.statement_id = t1.statement_id where t1.statement_id >= 57 intersect select t0.statement_id as c0, t0.statement_details as c1 from statements as t0 join accounts as t1 on t0.stateme...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c1 from (select t0.statement_id as c0, t0.statement_details as c1 from statements as t0 join accounts as t1 on t0.statement_id = t1.statement_id where t1.statement_id >= 57 intersect select t0.statement_id as c0, t0.statemen...
{ "index": 547, "split": "train" }
Did customer 2 become a customer before customer 13?
customer_deliveries
select t1.c2 < t0.c2 from (select date_became_customer as c2 from customers where customer_id = 2) as t1, (select date_became_customer as c2 from customers where customer_id = 13) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_deliveries", "sql": "select t1.c2 < t0.c2 from (select date_became_customer as c2 from customers where customer_id = 2) as t1, (select date_became_customer as c2 from customers where customer_id = 13) as t0" }, "style": "rule" }
{ "index": 3121, "split": "train" }
What are the ten projects with the highest number of scientists assigned, listed in reverse alphabetical order?
scientist_1
select project as c1, count(project) from assignedto group by c1 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": "scientist_1", "sql": "select project as c1, count(project) from assignedto group by c1 order by c1 desc limit 10" }, "style": "rule" }
{ "index": 1784, "split": "train" }
Can you list the products along with their IDs and the report dates for problems that either mention "x" in the description or are associated with the most frequently reported problem description?
tracking_software_problems
select t0.product_name, t0.product_id, t1.date_problem_reported from product as t0 join problems as t1 on t0.product_id = t1.product_id, (select problem_description as c0 from problems group by c0 order by count(*) desc limit 1) as t0 where t1.problem_description like '%x%' or t1.problem_description = 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, t0.product_id, t1.date_problem_reported from product as t0 join problems as t1 on t0.product_id = t1.product_id, (select problem_description as c0 from problems group by c0 order by count(*) desc limit 1) as t0 where t1...
{ "index": 2322, "split": "train" }
Which service and event have details associated with the most frequently occurring participant, and what are their details, sorted from Z to A?
local_govt_in_alabama
select t0.service_id, t0.event_id, t0.event_details as c1 from events as t0 join participants_in_events as t1 on t0.event_id = t1.event_id join participants as t2 on t1.participant_id = t2.participant_id, (select participant_details as c2 from participants group by c2 order by count(*) desc limit 1) as t0 where t2.part...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_in_alabama", "sql": "select t0.service_id, t0.event_id, t0.event_details as c1 from events as t0 join participants_in_events as t1 on t0.event_id = t1.event_id join participants as t2 on t1.participant_id = t2.participant_id, (select participant_details as c2 from part...
{ "index": 1713, "split": "train" }
What are the top five characteristics (by their characteristic IDs) that appear exactly twice in the product characteristics, excluding those with a characteristic type code containing "ade" and a name starting with "war"? Additionally, for each of these characteristics, what is the total number of associated product c...
products_gen_characteristics
select t0.characteristic_id as c1, sum(t1.characteristic_id) from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where (not t1.characteristic_id in (select c1 as c1 from characteristics where t0.characteristic_type_code like '%ade%' and t0.characteristic_name lik...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_id as c1, sum(t1.characteristic_id) from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where (not t1.characteristic_id in (select c1 as c1 from characteristic...
{ "index": 2338, "split": "train" }
Who are the first 10 players from colleges in Arizona or with Arizona in their state name, along with their high school scores, yellow card counts, tryout decisions, and tryout IDs, listed in order of their player IDs?
soccer_2
select t0.pid as c4, t0.hs, t0.ycard, t1.decision, t1.pid from player as t0 join tryout as t1 on t0.pid = t1.pid join college as t2 on t1.cname = t2.cname where t2.state = 'AZ' or t2.state like '%AZ%' order by c4 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": "soccer_2", "sql": "select t0.pid as c4, t0.hs, t0.ycard, t1.decision, t1.pid from player as t0 join tryout as t1 on t0.pid = t1.pid join college as t2 on t1.cname = t2.cname where t2.state = 'AZ' or t2.state like '%AZ%' order by c4 asc nulls last limit 10" }, "style": "rule" ...
{ "index": 2129, "split": "train" }
Did player 'stonest01' receive an award in a year that is later than the total number of awards given before 1934?
baseball_1
select t2.c3 > t1.c2 from (select year as c3 from player_award where player_id = 'stonest01') as t2, (select count(year) as c2 from player_award where year < 1934) 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": "baseball_1", "sql": "select t2.c3 > t1.c2 from (select year as c3 from player_award where player_id = 'stonest01') as t2, (select count(year) as c2 from player_award where year < 1934) as t1" }, "style": "rule" }
{ "index": 3262, "split": "train" }
What are the name, ID, and details of each customer, along with the total number of their orders?
tracking_orders
select t0.customer_name, t0.customer_id as c2, t0.customer_details, sum(t2.order_id) from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id join shipments as t2 on t1.order_id = t2.order_id group by c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.customer_name, t0.customer_id as c2, t0.customer_details, sum(t2.order_id) from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id join shipments as t2 on t1.order_id = t2.order_id group by c2" }, "style": "rule" }
{ "index": 1633, "split": "train" }
Can you tell me the top 5 records from the weekly weather data that show the lowest temperatures along with the highest temperatures and the day of the week, including the services and local authority of the stations? These stations are associated with trains scheduled to depart at exactly 21:49 or starting with 11:3, ...
station_weather
select t0.low_temperature as c1, t0.high_temperature, t0.day_of_week, t1.services, t1.local_authority from weekly_weather as t0 join station as t1 on t0.station_id = t1.id join route as t2 on t1.id = t2.station_id join train as t3 on t2.train_id = t3.id where t3.time = '21:49' or t3.time like '11:3%' order by c1 desc l...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select t0.low_temperature as c1, t0.high_temperature, t0.day_of_week, t1.services, t1.local_authority from weekly_weather as t0 join station as t1 on t0.station_id = t1.id join route as t2 on t1.id = t2.station_id join train as t3 on t2.train_id = t3.id ...
{ "index": 1635, "split": "train" }
List the shop names and their most recent open years for shops with ID 8 where the latest opening year was before 2017, showing up to 10 such shops sorted by their latest open year.
device
select shop_name as c1, max(open_year) as c0 from shop where shop_id = 8 group by c1 having max(open_year) < 2017 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": "device", "sql": "select shop_name as c1, max(open_year) as c0 from shop where shop_id = 8 group by c1 having max(open_year) < 2017 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 2192, "split": "train" }
Which city and city ID correspond to the most frequently occurring postal code, and what is the highest city ID among those cities?
sakila_1
select t0.city, t0.city_id as c0, max(t1.city_id) from city as t0 join address as t1 on t0.city_id = t1.city_id, (select postal_code as c3 from address group by c3 order by count(*) asc nulls last limit 1) as t0 where t1.postal_code = t0.c3 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": "sakila_1", "sql": "select t0.city, t0.city_id as c0, max(t1.city_id) from city as t0 join address as t1 on t0.city_id = t1.city_id, (select postal_code as c3 from address group by c3 order by count(*) asc nulls last limit 1) as t0 where t1.postal_code = t0.c3 group by c0" }, ...
{ "index": 1402, "split": "train" }
How many body builders are listed in the database?
body_builder
select count(*) from body_builder
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "body_builder", "sql": "select count(*) from body_builder" }, "style": "rule" }
{ "index": 1168, "split": "train" }
Which airport with an IATA code containing "S" has the highest average flight velocity, and what is that average velocity along with the airport's ID?
flight_company
select avg(t0.velocity) as c1, t1.id as c0 from flight as t0 join airport as t1 on t0.airport_id = t1.id where t1.iata like '%S%' group by c0 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": "flight_company", "sql": "select avg(t0.velocity) as c1, t1.id as c0 from flight as t0 join airport as t1 on t0.airport_id = t1.id where t1.iata like '%S%' group by c0 order by c1 desc limit 1" }, "style": "rule" }
{ "index": 800, "split": "train" }
What is the difference in the highest customer ID associated with customer 91 at exactly 12:00 PM on September 27, 2016, before and after considering only properties with IDs greater than 669?
local_govt_and_lot
select t1.c1 - t0.c1 from (select max(t1.customer_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 91 and t1.date_moved_in = '2016-09-27 12:00:00' group by t0.customer_id) as t1, (select t0.customer_id, max(t1.customer_id) as c1 from customers as t0 joi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t1.c1 - t0.c1 from (select max(t1.customer_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 91 and t1.date_moved_in = '2016-09-27 12:00:00' group by t0.customer_id) as t1, (sele...
{ "index": 3836, "split": "train" }
What are the top five countries of birth for players who received a manager award and have a player ID ending with '01', listed in reverse alphabetical order?
baseball_1
select t0.birth_country as c0 from player as t0 join manager_award as t1 on t0.player_id = t1.player_id where t1.player_id like '%01' order by c0 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "baseball_1", "sql": "select t0.birth_country as c0 from player as t0 join manager_award as t1 on t0.player_id = t1.player_id where t1.player_id like '%01' order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2829, "split": "train" }
How does product ID 120 rank in terms of the highest to lowest average staff ID involved in complaints among products with category codes ending in "e"?
customer_complaints
select t1.c5, t1.c0 as c3 from (select row_number() over (order by t0.c2 desc) as c5, t0.c4 as c0 from (select t0.product_id as c4, avg(t1.staff_id) as c2 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_category_code like '%e' group by c4) as t0) as t1 where c3 = 120
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c5, t1.c0 as c3 from (select row_number() over (order by t0.c2 desc) as c5, t0.c4 as c0 from (select t0.product_id as c4, avg(t1.staff_id) as c2 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_cat...
{ "index": 3472, "split": "train" }
How does the 'APP' document type rank based on the highest minimum grant ID among grants numbered 10 to 13?
tracking_grants_for_research
select t1.c2, t1.c3 as c1 from (select row_number() over (order by t0.c5 desc) as c2, t0.c0 as c3 from (select t0.document_type_code as c0, min(t1.grant_id) as c5 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.grant_id between 10 and 13 group by c0) as t0) 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_grants_for_research", "sql": "select t1.c2, t1.c3 as c1 from (select row_number() over (order by t0.c5 desc) as c2, t0.c0 as c3 from (select t0.document_type_code as c0, min(t1.grant_id) as c5 from document_types as t0 join documents as t1 on t0.document_type_code = t1.d...
{ "index": 3507, "split": "train" }
What are the product IDs, order item IDs, and statuses of order items that are shipped in shipments with invoice number 5?
tracking_orders
select t0.product_id, t0.order_item_id, t0.order_item_status from order_items as t0 join orders as t1 on t0.order_id = t1.order_id join shipments as t2 on t1.order_id = t2.order_id where t2.invoice_number = 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.product_id, t0.order_item_id, t0.order_item_status from order_items as t0 join orders as t1 on t0.order_id = t1.order_id join shipments as t2 on t1.order_id = t2.order_id where t2.invoice_number = 5" }, "style": "rule" }
{ "index": 778, "split": "train" }
Which dorms and amenities are associated with students whose sex is either the most common among all students or contains the letter "F," listed in order of the amenity ID?
dorm_1
select t0.dormid, t0.amenid as c2 from has_amenity as t0 join dorm as t1 on t0.dormid = t1.dormid join lives_in as t2 on t1.dormid = t2.dormid join student as t3 on t2.stuid = t3.stuid, (select sex as c0 from student group by c0 order by count(*) asc nulls last limit 1) as t0 where t3.sex = t0.c0 or t3.sex like '%F%' o...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select t0.dormid, t0.amenid as c2 from has_amenity as t0 join dorm as t1 on t0.dormid = t1.dormid join lives_in as t2 on t1.dormid = t2.dormid join student as t3 on t2.stuid = t3.stuid, (select sex as c0 from student group by c0 order by count(*) asc nulls last l...
{ "index": 627, "split": "train" }
Is the savings balance for customer 4 higher than that for customer 1?
small_bank_1
select t1.c0 > t0.c0 from (select balance as c0 from savings where custid = 1) as t1, (select balance as c0 from savings where custid = 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": "small_bank_1", "sql": "select t1.c0 > t0.c0 from (select balance as c0 from savings where custid = 1) as t1, (select balance as c0 from savings where custid = 4) as t0" }, "style": "rule" }
{ "index": 3555, "split": "train" }
What is the difference between the highest customer ID for lessons taught by staff member 5 and the number 6?
driving_school
select t0.c2 - 6 from (select max(t1.customer_id) as c2 from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t0.staff_id = 5 group by t0.staff_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select t0.c2 - 6 from (select max(t1.customer_id) as c2 from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t0.staff_id = 5 group by t0.staff_id) as t0" }, "style": "rule" }
{ "index": 3232, "split": "train" }
Can you identify the ten film IDs from the market estimations that have a market ID of either 1 or greater than 2, arranged in order based on their market type, with entries where the type is unknown appearing last?
film_rank
select film_id from film_market_estimation where market_id <= 1 or market_id >= 2 order by type 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": "film_rank", "sql": "select film_id from film_market_estimation where market_id <= 1 or market_id >= 2 order by type asc nulls last limit 10" }, "style": "rule" }
{ "index": 891, "split": "train" }
What are the customer IDs and channel codes for customer contact channels belonging to customer number 14, or for the customer with the highest customer ID who does not have an address on file?
customers_and_addresses
select customer_id as c1, channel_code from customer_contact_channels where c1 = 14 or (not c1 in (select c1 as c2 from customer_addresses)) 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": "customers_and_addresses", "sql": "select customer_id as c1, channel_code from customer_contact_channels where c1 = 14 or (not c1 in (select c1 as c2 from customer_addresses)) order by c1 desc limit 1" }, "style": "rule" }
{ "index": 2497, "split": "train" }
How much has the largest number of employees in any role changed, in percentage, between employees born on December 11, 1980, and those born on April 4, 1973?
cre_Doc_Tracking_DB
select (max(t0.c2) / cast(max(t1.c2) as real) - 1) * 100 from (select count(distinct (t1.employee_id)) as c2 from roles as t0 join employees as t1 on t0.role_code = t1.role_code where t1.date_of_birth = '1980-12-11 20:28:20' group by t0.role_code) as t0, (select t0.role_code, count(distinct (t1.employee_id)) as c2 from...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Tracking_DB", "sql": "select (max(t0.c2) / cast(max(t1.c2) as real) - 1) * 100 from (select count(distinct (t1.employee_id)) as c2 from roles as t0 join employees as t1 on t0.role_code = t1.role_code where t1.date_of_birth = '1980-12-11 20:28:20' group by t0.role_code) as...
{ "index": 3961, "split": "train" }
How many acceptance entries are there in total?
workshop_paper
select count(*) from acceptance
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "workshop_paper", "sql": "select count(*) from acceptance" }, "style": "rule" }
{ "index": 2118, "split": "train" }
What are the top three most common cross-reference IDs, and how many times does each occur in the CMI Cross References table?
local_govt_mdm
select count(cmi_cross_ref_id) as c0 from cmi_cross_references 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": "local_govt_mdm", "sql": "select count(cmi_cross_ref_id) as c0 from cmi_cross_references order by c0 desc limit 3" }, "style": "rule" }
{ "index": 55, "split": "train" }
Which are the ten most recent broadcasts of the program with ID 3? Please provide the channel name, channel owner, program ID, and broadcast time, sorted from the latest to the earliest.
program_share
select t0.name, t0.owner, t1.program_id, t1.time_of_day as c2 from channel as t0 join broadcast as t1 on t0.channel_id = t1.channel_id join program as t2 on t1.program_id = t2.program_id where t2.program_id = 3 order by c2 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "program_share", "sql": "select t0.name, t0.owner, t1.program_id, t1.time_of_day as c2 from channel as t0 join broadcast as t1 on t0.channel_id = t1.channel_id join program as t2 on t1.program_id = t2.program_id where t2.program_id = 3 order by c2 desc limit 10" }, "style": "r...
{ "index": 1592, "split": "train" }
Which Phone IDs are listed in the Phone Market database?
phone_market
select phone_id from phone_market
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 phone_id from phone_market" }, "style": "rule" }
{ "index": 978, "split": "train" }
What is the latitude of the station with ID 60?
bike_1
select lat from station where id = 60
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 lat from station where id = 60" }, "style": "rule" }
{ "index": 3358, "split": "train" }
Can you tell me the top 5 regular seasons in the ACC where the total home wins were 14–2, and the average school ID for those seasons is 5 or less? I'd like the results ordered alphabetically by the season name. --- This version clarifies the filtering criteria, the grouping, and the ordering in a way that sounds nat...
university_basketball
select acc_regular_season as c1, avg(school_id) from basketball_match where all_home = '14–2' group by c1 having avg(school_id) <= 5 order by c1 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "university_basketball", "sql": "select acc_regular_season as c1, avg(school_id) from basketball_match where all_home = '14–2' group by c1 having avg(school_id) <= 5 order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2131, "split": "train" }
For the first three orders based on order ID, what are the total sums of customer IDs associated with each order?
customers_and_addresses
select sum(customer_id) from customer_orders group by order_id order by order_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_and_addresses", "sql": "select sum(customer_id) from customer_orders group by order_id order by order_id asc nulls last limit 3" }, "style": "rule" }
{ "index": 2300, "split": "train" }
Which three skills that have the letter "e" in their description are listed first alphabetically? Provide their skill IDs and descriptions.
assets_maintenance
select t0.skill_id, t1.skill_description as c0 from engineer_skills as t0 join skills as t1 on t0.skill_id = t1.skill_id where c0 like '%e%' 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": "assets_maintenance", "sql": "select t0.skill_id, t1.skill_description as c0 from engineer_skills as t0 join skills as t1 on t0.skill_id = t1.skill_id where c0 like '%e%' order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 1475, "split": "train" }
Which roles are associated with only one club, and what is the total sum of club IDs for those roles?
club_1
select position as c0, sum(clubid) from member_of_club group by c0 having sum(clubid) = 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "club_1", "sql": "select position as c0, sum(clubid) from member_of_club group by c0 having sum(clubid) = 1" }, "style": "rule" }
{ "index": 2113, "split": "train" }
Which are the three lots owned by investors with IDs between 16 and 20 that have the lowest total sum of transaction lot IDs, along with their corresponding total sums?
tracking_share_transactions
select sum(t0.lot_id) as c1, t1.lot_id as c0 from transactions_lots as t0 join lots as t1 on t0.lot_id = t1.lot_id where t1.investor_id between 16 and 20 group by c0 order by c1 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select sum(t0.lot_id) as c1, t1.lot_id as c0 from transactions_lots as t0 join lots as t1 on t0.lot_id = t1.lot_id where t1.investor_id between 16 and 20 group by c0 order by c1 asc nulls last limit 3" }, "style": "rule" }
{ "index": 2787, "split": "train" }
What is the percentage change in the average customer ID for clients who made bookings on August 20, 1976, compared to those who booked on May 11, 1971?
cre_Drama_Workshop_Groups
select (count(distinct (t0.c0)) / cast(count(distinct (t1.c0)) as real) - 1) * 100 from (select avg(t1.customer_id) as c0 from clients as t0 join bookings as t1 on t0.client_id = t1.customer_id where t1.order_date = '1976-08-20 00:33:08' group by t0.client_id) as t0, (select avg(t1.customer_id) as c0 from clients as t0...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Drama_Workshop_Groups", "sql": "select (count(distinct (t0.c0)) / cast(count(distinct (t1.c0)) as real) - 1) * 100 from (select avg(t1.customer_id) as c0 from clients as t0 join bookings as t1 on t0.client_id = t1.customer_id where t1.order_date = '1976-08-20 00:33:08' group ...
{ "index": 3992, "split": "train" }
Which countries and song durations are associated with files that are either approximately 10 MB in size or exactly 4.58 MB?
music_1
select t0.country, t1.duration from song as t0 join files as t1 on t0.f_id = t1.f_id where t1.file_size like '%10 MB%' or t1.file_size = '4.58 MB'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t0.country, t1.duration from song as t0 join files as t1 on t0.f_id = t1.f_id where t1.file_size like '%10 MB%' or t1.file_size = '4.58 MB'" }, "style": "rule" }
{ "index": 1788, "split": "train" }
What is the smallest and largest number of unique locations in countries where the state or province name starts with "Mahar"?
hr_1
select min(t0.c1), max(t0.c1) from (select count(distinct (t1.location_id)) as c1 from countries as t0 join locations as t1 on t0.country_id = t1.country_id where t1.state_province like 'Mahar%' group by t0.country_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": "hr_1", "sql": "select min(t0.c1), max(t0.c1) from (select count(distinct (t1.location_id)) as c1 from countries as t0 join locations as t1 on t0.country_id = t1.country_id where t1.state_province like 'Mahar%' group by t0.country_id) as t0" }, "style": "rule" }
{ "index": 3642, "split": "train" }
Is the maximum staff ID associated with staff ID 12, based on lessons, greater than the total sum of the highest staff IDs of staff who joined after August 30, 2017?
driving_school
select t2.c2 > t1.c3 from (select max(t1.staff_id) as c2 from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t0.staff_id = 12 group by t0.staff_id) as t2, (select sum(t0.c2) as c3 from (select max(t1.staff_id) as c2 from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t0.date_joined...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c2 > t1.c3 from (select max(t1.staff_id) as c2 from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t0.staff_id = 12 group by t0.staff_id) as t2, (select sum(t0.c2) as c3 from (select max(t1.staff_id) as c2 from staff as t0 joi...
{ "index": 3272, "split": "train" }
List the last names and IDs of staff members, along with the number of log entries assigned to them, for those staff whose staff IDs are less than 4.
tracking_software_problems
select t0.staff_last_name, t0.staff_id as c1, count(*) from staff as t0 join problem_log as t1 on t0.staff_id = t1.assigned_to_staff_id where t1.assigned_to_staff_id < 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": "tracking_software_problems", "sql": "select t0.staff_last_name, t0.staff_id as c1, count(*) from staff as t0 join problem_log as t1 on t0.staff_id = t1.assigned_to_staff_id where t1.assigned_to_staff_id < 4 group by c1" }, "style": "rule" }
{ "index": 1569, "split": "train" }
What are the target user IDs and trust scores from the trust relationships, along with the user IDs and names of user accounts that have reviews by user ID 1?
epinions_1
select t0.target_u_id, t0.trust, t1.u_id, t1.name from trust as t0 join useracct as t1 on t0.source_u_id = t1.u_id join review as t2 on t1.u_id = t2.u_id where t2.u_id between 1 and 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": "epinions_1", "sql": "select t0.target_u_id, t0.trust, t1.u_id, t1.name from trust as t0 join useracct as t1 on t0.source_u_id = t1.u_id join review as t2 on t1.u_id = t2.u_id where t2.u_id between 1 and 1" }, "style": "rule" }
{ "index": 2702, "split": "train" }
List the names, ages, and years of experience of the ten most experienced journalists who reported on events held at venues including "Platense" or exactly at "Motagua," sorted by their years of working in descending order.
news_report
select t0.name, t0.age, t0.years_working as c2 from journalist as t0 join news_report as t1 on t0.journalist_id = t1.journalist_id join event as t2 on t1.event_id = t2.event_id where t2.venue like '%Platense%' or t2.venue = 'Motagua' order by c2 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "news_report", "sql": "select t0.name, t0.age, t0.years_working as c2 from journalist as t0 join news_report as t1 on t0.journalist_id = t1.journalist_id join event as t2 on t1.event_id = t2.event_id where t2.venue like '%Platense%' or t2.venue = 'Motagua' order by c2 desc limit 1...
{ "index": 904, "split": "train" }
What are the address details—such as city, country, state, address content, and zip code—for customers who pay with checks, excluding those whose names start with 'Al'?
customers_and_addresses
select anon_1.c4, anon_1.c3, anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.city as c4, t0.country as c3, t0.state_province_county as c0, t0.address_content as c2, t0.zip_postcode as c1 from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id join customers as t2 on t1.customer_id = t2.custo...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select anon_1.c4, anon_1.c3, anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.city as c4, t0.country as c3, t0.state_province_county as c0, t0.address_content as c2, t0.zip_postcode as c1 from addresses as t0 join customer_addresses as t1 on t0.ad...
{ "index": 2069, "split": "train" }
Can you tell me the first five districts along with their number of shops that have phones priced at $480 or less, sorted alphabetically by district?
phone_market
select t0.district as c0, t0.num_of_shops from market as t0 join phone_market as t1 on t0.market_id = t1.market_id join phone as t2 on t1.phone_id = t2.phone_id where t2.price <= 480.0 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": "phone_market", "sql": "select t0.district as c0, t0.num_of_shops from market as t0 join phone_market as t1 on t0.market_id = t1.market_id join phone as t2 on t1.phone_id = t2.phone_id where t2.price <= 480.0 order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 584, "split": "train" }
Can you tell me the transaction type code, description, and the investor ID for the transaction with ID 6 that took place between November 1, 1983, and October 8, 1985?
tracking_share_transactions
select t0.transaction_type_code, t0.transaction_type_description, t1.investor_id from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.date_of_transaction between '1983-11-01 17:57:27' and '1985-10-08 13:13:39' and t1.transaction_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": "tracking_share_transactions", "sql": "select t0.transaction_type_code, t0.transaction_type_description, t1.investor_id from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.date_of_transaction between '1983-11-01 ...
{ "index": 1383, "split": "train" }
What are the prices, codes, manufacturers, and names of products made by manufacturers with 'ony' in their names, along with products whose manufacturers' names are not listed among the manufacturers of any products?
manufactory_1
select anon_1.c3, anon_1.c1, anon_1.c0, anon_1.c2 from (select t0.price as c3, t0.code as c1, t0.manufacturer as c0, t0.name as c2 from products as t0 join manufacturers as t1 on t0.manufacturer = t1.code where t1.name like '%ony%' union select t0.price as c3, t0.code as c1, t0.manufacturer as c0, t0.name as c2 from pr...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "manufactory_1", "sql": "select anon_1.c3, anon_1.c1, anon_1.c0, anon_1.c2 from (select t0.price as c3, t0.code as c1, t0.manufacturer as c0, t0.name as c2 from products as t0 join manufacturers as t1 on t0.manufacturer = t1.code where t1.name like '%ony%' union select t0.price as...
{ "index": 1179, "split": "train" }
List all the names of people and churches.
wedding
select anon_1.c1 from (select name as c1 from people union select name from church) 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": "wedding", "sql": "select anon_1.c1 from (select name as c1 from people union select name from church) as anon_1" }, "style": "rule" }
{ "index": 14, "split": "train" }
Which five teachers with addresses numbered less than 19 have the fewest detention records, and what are their teacher IDs along with the count of their detention records?
behavior_monitoring
select count(distinct (t0.teacher_id)) as c1, t1.teacher_id as c0 from detention as t0 join teachers as t1 on t0.teacher_id = t1.teacher_id where t1.address_id < 19 group by c0 order by c1 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select count(distinct (t0.teacher_id)) as c1, t1.teacher_id as c0 from detention as t0 join teachers as t1 on t0.teacher_id = t1.teacher_id where t1.address_id < 19 group by c0 order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2830, "split": "train" }
Can you provide the Market ID, market details, opening hours, and the corresponding tourist attraction ID for attractions that have a feature with ID 955?
cre_Theme_park
select t0.market_id, t0.market_details, t1.opening_hours, t1.tourist_attraction_id from street_markets as t0 join tourist_attractions as t1 on t0.market_id = t1.tourist_attraction_id join tourist_attraction_features as t2 on t1.tourist_attraction_id = t2.tourist_attraction_id join features as t3 on t2.feature_id = t3.f...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Theme_park", "sql": "select t0.market_id, t0.market_details, t1.opening_hours, t1.tourist_attraction_id from street_markets as t0 join tourist_attractions as t1 on t0.market_id = t1.tourist_attraction_id join tourist_attraction_features as t2 on t1.tourist_attraction_id = t2....
{ "index": 1387, "split": "train" }
Which building has the fewest stories and houses offices either for company 2 or for the company with the most office locations? Please provide the building's height and name. --- This wording clearly explains the filtering criteria and the focus on the building's stories and identification, aligning with the origina...
company_office
select t0.height, t0.name from buildings as t0 join office_locations as t1 on t0.id = t1.building_id, (select company_id as c2 from office_locations group by c2 order by count(*) desc limit 1) as t0 where t1.company_id = 2 or t1.company_id = t0.c2 order by t0.stories 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": "company_office", "sql": "select t0.height, t0.name from buildings as t0 join office_locations as t1 on t0.id = t1.building_id, (select company_id as c2 from office_locations group by c2 order by count(*) desc limit 1) as t0 where t1.company_id = 2 or t1.company_id = t0.c2 order b...
{ "index": 1931, "split": "train" }
Which three most recent dates had four or fewer stadiums hosting games, based on the number of stadiums involved in matches on those days?
game_injury
select count(stadium_id) from game group by date having count(stadium_id) <= 4 order by date desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_injury", "sql": "select count(stadium_id) from game group by date having count(stadium_id) <= 4 order by date desc limit 3" }, "style": "rule" }
{ "index": 2536, "split": "train" }
What are the names of the three products affected by problem 4, listed in reverse alphabetical order?
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.problem_id = 4 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": "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.problem_id = 4 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 1558, "split": "train" }
Who are the people who have Zach listed as their friend?
network_2
select t0.name from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.friend = 'Zach'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select t0.name from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.friend = 'Zach'" }, "style": "rule" }
{ "index": 1898, "split": "train" }
Which campuses have faculty members, and what are the faculty counts and associated campus names, for campuses where the number of graduate students in a discipline is between 49 and 133?
csu_1
select t0.campus, t0.faculty, t1.campus from faculty as t0 join campuses as t1 on t0.campus = t1.id join discipline_enrollments as t2 on t1.id = t2.campus where t2.graduate between 49 and 133
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "csu_1", "sql": "select t0.campus, t0.faculty, t1.campus from faculty as t0 join campuses as t1 on t0.campus = t1.id join discipline_enrollments as t2 on t1.id = t2.campus where t2.graduate between 49 and 133" }, "style": "rule" }
{ "index": 30, "split": "train" }
What is the expiration date for the customer who had the highest customer ID among those whose card became valid on or after August 20, 2008 at 5:59:51 PM?
customers_card_transactions
select t0.date_valid_to, t0.customer_id as c0 from customers_cards as t0, (select max(customer_id) as c3 from customers_cards where date_valid_from >= '2008-08-20 17:59:51') as t1 where c0 = t1.c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select t0.date_valid_to, t0.customer_id as c0 from customers_cards as t0, (select max(customer_id) as c3 from customers_cards where date_valid_from >= '2008-08-20 17:59:51') as t1 where c0 = t1.c3" }, "style": "rule" }
{ "index": 3988, "split": "train" }
When was the latest time recorded for the train with the highest train number greater than or equal to 16526?
station_weather
select t0.time, t0.train_number as c1 from train as t0, (select max(train_number) as c0 from train where train_number >= 16526) as t1 where c1 = t1.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select t0.time, t0.train_number as c1 from train as t0, (select max(train_number) as c0 from train where train_number >= 16526) as t1 where c1 = t1.c0" }, "style": "rule" }
{ "index": 3793, "split": "train" }
For each insurance policy, listed by its Policy ID in descending order, can you tell me the total number of records, the number of non-null policy IDs, and the number of unique dates on which the policy was closed?
insurance_fnol
select policy_id as c1, count(*), count(policy_id), count(distinct (date_closed)) from customers_policies group by c1 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": "insurance_fnol", "sql": "select policy_id as c1, count(*), count(policy_id), count(distinct (date_closed)) from customers_policies group by c1 order by c1 desc" }, "style": "rule" }
{ "index": 1954, "split": "train" }
What are the names of countries that either have an ID not used in any league or have an ID of 7809?
soccer_1
select name from country where (not id in (select country_id as c1 from league)) or id = 7809
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 name from country where (not id in (select country_id as c1 from league)) or id = 7809" }, "style": "rule" }
{ "index": 1223, "split": "train" }
What are the ten bookings with the lowest booked amounts for the product with ID 2, including the booking ID and product name, ordered from the smallest to the larger booked amounts?
products_for_hire
select t0.booked_amount as c1, t0.booking_id, t1.product_name from products_booked as t0 join products_for_hire as t1 on t0.product_id = t1.product_id join view_product_availability as t2 on t1.product_id = t2.product_id where t2.product_id = 2 order by c1 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select t0.booked_amount as c1, t0.booking_id, t1.product_name from products_booked as t0 join products_for_hire as t1 on t0.product_id = t1.product_id join view_product_availability as t2 on t1.product_id = t2.product_id where t2.product_id = 2 order b...
{ "index": 57, "split": "train" }
What is the highest architect ID associated with architect 4's bridges that are 70 meters or shorter in length?
architecture
select t0.c2 from (select max(t1.architect_id) as c2 from architect as t0 join bridge as t1 on t0.id = t1.architect_id where t0.id = 4 and t1.length_meters <= 70.0 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.c2 from (select max(t1.architect_id) as c2 from architect as t0 join bridge as t1 on t0.id = t1.architect_id where t0.id = 4 and t1.length_meters <= 70.0 group by t0.id) as t0" }, "style": "rule" }
{ "index": 3354, "split": "train" }
Can you tell me if the lowest mountain ID for photos taken with camera lens 10 (where the photo name contains 'r') is smaller than the lowest mountain ID for photos taken with camera lens 5?
mountain_photos
select t1.c2 < t0.c2 from (select min(t1.mountain_id) as c2 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t0.id = 10 and t1.name like '%r%' group by t0.id) as t1, (select t0.id, min(t1.mountain_id) as c2 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t0.id = 5 ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "mountain_photos", "sql": "select t1.c2 < t0.c2 from (select min(t1.mountain_id) as c2 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t0.id = 10 and t1.name like '%r%' group by t0.id) as t1, (select t0.id, min(t1.mountain_id) as c2 from camera_lens as ...
{ "index": 3569, "split": "train" }
For browsers with ID 4, what are their names, the number of records for each, and the smallest market share among them?
browser_web
select name as c2, count(name), min(market_share) from browser where id = 4 or id = 4 group by c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "browser_web", "sql": "select name as c2, count(name), min(market_share) from browser where id = 4 or id = 4 group by c2" }, "style": "rule" }
{ "index": 2693, "split": "train" }
Which albums and their artist IDs are associated with tracks that use the most common media type in the store?
chinook_1
select anon_1.c2, anon_1.c1 from (select albumid as c2, artistid as c1 from album intersect select t0.albumid as c2, t0.artistid as c1 from album as t0 join track as t1 on t0.albumid = t1.albumid join mediatype as t2 on t1.mediatypeid = t2.mediatypeid, (select mediatypeid as c0 from mediatype group by c0 order by count...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c2, anon_1.c1 from (select albumid as c2, artistid as c1 from album intersect select t0.albumid as c2, t0.artistid as c1 from album as t0 join track as t1 on t0.albumid = t1.albumid join mediatype as t2 on t1.mediatypeid = t2.mediatypeid, (select...
{ "index": 981, "split": "train" }
What are the IDs and full names of colleges that had players receiving awards before 1970?
baseball_1
select anon_1.c1, anon_1.c0 from (select college_id as c1, name_full as c0 from college union select t0.college_id as c1, t0.name_full as c0 from college as t0 join player_college as t1 on t0.college_id = t1.college_id join player as t2 on t1.player_id = t2.player_id join player_award as t3 on t2.player_id = t3.player_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "baseball_1", "sql": "select anon_1.c1, anon_1.c0 from (select college_id as c1, name_full as c0 from college union select t0.college_id as c1, t0.name_full as c0 from college as t0 join player_college as t1 on t0.college_id = t1.college_id join player as t2 on t1.player_id = t2.p...
{ "index": 2476, "split": "train" }
Which climbers have ascended the mountain with ID 1, and what are their points, country, name, and mountain ID?
climbing
select anon_1.c2, anon_1.c1, anon_1.c0, anon_1.c3 from (select points as c2, country as c1, name as c0, mountain_id as c3 from climber intersect select t0.points as c2, t0.country as c1, t0.name as c0, t0.mountain_id as c3 from climber as t0 join mountain as t1 on t0.mountain_id = t1.mountain_id where t1.mountain_id = ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "climbing", "sql": "select anon_1.c2, anon_1.c1, anon_1.c0, anon_1.c3 from (select points as c2, country as c1, name as c0, mountain_id as c3 from climber intersect select t0.points as c2, t0.country as c1, t0.name as c0, t0.mountain_id as c3 from climber as t0 join mountain as t1...
{ "index": 2679, "split": "train" }
What are the details of the counties, numbers, and appellations for all appellations, excluding those that are associated with wines made from grapes not found in the wine records?
wine_1
select anon_1.c3, anon_1.c2, anon_1.c1 from (select county as c3, no as c2, appelation as c1 from appellations except select t0.county as c3, t0.no as c2, t0.appelation as c1 from appellations as t0 join wine as t1 on t0.appelation = t1.appelation join grapes as t2 on t1.grape = t2.grape where (not t2.grape in (select ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "wine_1", "sql": "select anon_1.c3, anon_1.c2, anon_1.c1 from (select county as c3, no as c2, appelation as c1 from appellations except select t0.county as c3, t0.no as c2, t0.appelation as c1 from appellations as t0 join wine as t1 on t0.appelation = t1.appelation join grapes as ...
{ "index": 1001, "split": "train" }
Which students, who completed course 4 between early March 2018 and early March 2018, have their middle names and student IDs listed, along with the earliest student ID among their enrollments in that period?
e_learning
select t0.middle_name, t0.student_id as c2, min(t1.student_id) from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_completion between '2018-03-01 07:12:39' and '2018-03-06 00:27:09' and t1.course_id = 4 group by c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.middle_name, t0.student_id as c2, min(t1.student_id) from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_completion between '2018-03-01 07:12:39' and '2018-03-06 00:27:09' and t1.course_id = 4 gr...
{ "index": 792, "split": "train" }
a fac," what are the descriptions and codes of those document structures?
document_management
select t0.document_structure_description, t0.document_structure_code as c1 from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code where t1.document_name like '%nity: a fac%' group by c1 having count(*) = 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": "document_management", "sql": "select t0.document_structure_description, t0.document_structure_code as c1 from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code where t1.document_name like '%nity: a fac%' group by c1 having c...
{ "index": 1329, "split": "train" }
Which customers have a policy with ID 630? Please provide their names and customer IDs.
insurance_fnol
select anon_1.c0, anon_1.c1 from (select customer_name as c0, customer_id as c1 from customers intersect select t0.customer_name as c0, t0.customer_id as c1 from customers as t0 join customers_policies as t1 on t0.customer_id = t1.customer_id join available_policies as t2 on t1.policy_id = t2.policy_id where t2.policy_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_fnol", "sql": "select anon_1.c0, anon_1.c1 from (select customer_name as c0, customer_id as c1 from customers intersect select t0.customer_name as c0, t0.customer_id as c1 from customers as t0 join customers_policies as t1 on t0.customer_id = t1.customer_id join availab...
{ "index": 248, "split": "train" }
What is the percentage change in the average property ID for customer 19 from March 27, 2015, to September 27, 2016?
local_govt_and_lot
select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select avg(t1.property_id) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t0, (select t0.customer_id, avg(t1.property_id) as 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": "local_govt_and_lot", "sql": "select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select avg(t1.property_id) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0...
{ "index": 3944, "split": "train" }
Which aircraft's distance and ID are not linked to employees earning a salary of 227,489 or less?
flight_1
select anon_1.c1, anon_1.c0 from (select distance as c1, aid as c0 from aircraft except select t0.distance as c1, t0.aid as c0 from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid where t2.salary <= 227489) 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": "flight_1", "sql": "select anon_1.c1, anon_1.c0 from (select distance as c1, aid as c0 from aircraft except select t0.distance as c1, t0.aid as c0 from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid where t2.salary <= 227489) as ano...
{ "index": 1929, "split": "train" }
In the Rent Arrears data, what are the council tax ID and cross-reference IDs for the record linked to electoral register entries with cmi cross reference IDs of at least 100? Among these, which record has the lowest council tax ID?
local_govt_mdm
select t0.council_tax_id as c0, t0.cmi_cross_ref_id, t1.cmi_cross_ref_id from rent_arrears as t0 join cmi_cross_references as t1 on t0.cmi_cross_ref_id = t1.cmi_cross_ref_id join electoral_register as t2 on t1.cmi_cross_ref_id = t2.cmi_cross_ref_id where t2.cmi_cross_ref_id >= 100 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_mdm", "sql": "select t0.council_tax_id as c0, t0.cmi_cross_ref_id, t1.cmi_cross_ref_id from rent_arrears as t0 join cmi_cross_references as t1 on t0.cmi_cross_ref_id = t1.cmi_cross_ref_id join electoral_register as t2 on t1.cmi_cross_ref_id = t2.cmi_cross_ref_id where ...
{ "index": 830, "split": "train" }
Which are the five addresses with the fewest outstanding amounts, among those where customers became clients between September 4, 2016, and October 5, 2017, including their state province county, zip code, and address ID?
driving_school
select t0.state_province_county, t0.zip_postcode, t0.address_id as c2 from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id where t1.date_became_customer between '2016-09-04 23:08:20' and '2017-10-05 14:15:46' group by c2 order by count(distinct (t1.amount_outstanding)) asc nulls last limi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select t0.state_province_county, t0.zip_postcode, t0.address_id as c2 from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id where t1.date_became_customer between '2016-09-04 23:08:20' and '2017-10-05 14:15:46' group by c2 ord...
{ "index": 1299, "split": "train" }
What are the last five railway locations when listed in descending alphabetical order?
railway
select location as c0 from railway 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": "railway", "sql": "select location as c0 from railway order by c0 desc limit 5" }, "style": "rule" }
{ "index": 1253, "split": "train" }
Which media type ID and name are associated with the most popular genre among genre IDs 15 and 20?
chinook_1
select t0.mediatypeid, t0.name from mediatype as t0 join track as t1 on t0.mediatypeid = t1.mediatypeid join genre as t2 on t1.genreid = t2.genreid, (select name as c1 from genre where genreid = 15 or genreid = 20 group by c1 order by count(*) desc limit 1) as t0 where t2.name = 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": "chinook_1", "sql": "select t0.mediatypeid, t0.name from mediatype as t0 join track as t1 on t0.mediatypeid = t1.mediatypeid join genre as t2 on t1.genreid = t2.genreid, (select name as c1 from genre where genreid = 15 or genreid = 20 group by c1 order by count(*) desc limit 1) as...
{ "index": 907, "split": "train" }
What are the profits in billions and main industries of the top five companies with the highest profits that operate gas stations managed by Jon Rowe?
gas_company
select t0.profits_billion as c1, t0.main_industry from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id where t2.manager_name = 'Jon Rowe' order by c1 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "gas_company", "sql": "select t0.profits_billion as c1, t0.main_industry from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id where t2.manager_name = 'Jon Rowe' order by c1 asc nulls last limit 5" ...
{ "index": 1556, "split": "train" }
What is the name of the product (or products) with the highest total price, when summing prices for each product name, sorted in reverse alphabetical order?
manufactory_1
select name as c0, sum(price) from products group by c0 order by c0 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "manufactory_1", "sql": "select name as c0, sum(price) from products group by c0 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 2510, "split": "train" }
In the hospital's room records, what is the block code and availability status of the room, along with the block code of the associated block that has an on-call assignment, specifically for the block with the highest block code among those with on-call coverage?
hospital_1
select t0.blockcode as c1, t0.unavailable, t1.blockcode as c2 from room as t0 join block as t1 on t0.blockfloor = t1.blockfloor join on_call as t2 on t1.blockfloor = t2.blockfloor where t2.blockcode in (select c1 as c1 from room) order by c2 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "hospital_1", "sql": "select t0.blockcode as c1, t0.unavailable, t1.blockcode as c2 from room as t0 join block as t1 on t0.blockfloor = t1.blockfloor join on_call as t2 on t1.blockfloor = t2.blockfloor where t2.blockcode in (select c1 as c1 from room) order by c2 desc limit 1" }...
{ "index": 2708, "split": "train" }
Which addresses in the database are not associated with customer ID 3? Specifically, what are their state or province or county, address details, city, and zip code?
customers_and_addresses
select anon_1.c1, anon_1.c2, anon_1.c0, anon_1.c3 from (select state_province_county as c1, address_content as c2, city as c0, zip_postcode as c3 from addresses except select t0.state_province_county as c1, t0.address_content as c2, t0.city as c0, t0.zip_postcode as c3 from addresses as t0 join customer_addresses 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": "customers_and_addresses", "sql": "select anon_1.c1, anon_1.c2, anon_1.c0, anon_1.c3 from (select state_province_county as c1, address_content as c2, city as c0, zip_postcode as c3 from addresses except select t0.state_province_county as c1, t0.address_content as c2, t0.city as c0...
{ "index": 1554, "split": "train" }
How many factories does each manufacturer have in total?
manufacturer
select manufacturer_id as c0, sum(num_of_factories) from manufacturer 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": "manufacturer", "sql": "select manufacturer_id as c0, sum(num_of_factories) from manufacturer group by c0" }, "style": "rule" }
{ "index": 1215, "split": "train" }
How much fewer are the unique 'Hard Drive' documents compared to the highest number of documents shipped by the 'US' shipping agent across all document types?
cre_Doc_Control_Systems
select t2.c0 - t0.c2 from (select max(t1.c2) as c0 from (select count(distinct (t1.document_id)) as c2 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.shipping_agent_code = 'US' group by t0.document_type_code) as t1) as t2, (select t0.document_type_code, coun...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c0 - t0.c2 from (select max(t1.c2) as c0 from (select count(distinct (t1.document_id)) as c2 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.shipping_agent_code = 'US' group b...
{ "index": 3162, "split": "train" }
For the asset that has the most parts associated with it, what are the maintenance contract IDs, asset IDs, and the highest part ID? List the top 5 records sorted by maintenance contract ID from newest to oldest.
assets_maintenance
select t0.maintenance_contract_id as c1, t0.asset_id as c2, max(t1.part_id) from assets as t0 join asset_parts as t1 on t0.asset_id = t1.asset_id, (select asset_id as c3 from asset_parts group by c3 order by count(*) asc nulls last limit 1) as t0 where t1.asset_id = t0.c3 group by c2 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": "assets_maintenance", "sql": "select t0.maintenance_contract_id as c1, t0.asset_id as c2, max(t1.part_id) from assets as t0 join asset_parts as t1 on t0.asset_id = t1.asset_id, (select asset_id as c3 from asset_parts group by c3 order by count(*) asc nulls last limit 1) as t0 wher...
{ "index": 1481, "split": "train" }