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
What is the highest address ID associated with address 5 in the customer address history records that ended before March 16, 2018, 2:49:28 PM?
customers_and_products_contacts
select t0.c0 from (select max(t1.address_id) as c0 from addresses as t0 join customer_address_history as t1 on t0.address_id = t1.address_id where t0.address_id = 5 and t1.date_to < '2018-03-16 14:49:28' group by t0.address_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select t0.c0 from (select max(t1.address_id) as c0 from addresses as t0 join customer_address_history as t1 on t0.address_id = t1.address_id where t0.address_id = 5 and t1.date_to < '2018-03-16 14:49:28' group by t0.address_id) as t0" }...
{ "index": 3371, "split": "train" }
What is the percentage change in the highest maintenance contract company ID between the contracts ending on March 15, 2018, and those ending on February 27, 2018?
assets_maintenance
select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select maintenance_contract_company_id as c0 from maintenance_contracts where contract_end_date = '2018-03-15 06:45:00') as t0, (select maintenance_contract_company_id as c0 from maintenance_contracts where contract_end_date = '2018-02-27 17:36:59') 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": "assets_maintenance", "sql": "select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select maintenance_contract_company_id as c0 from maintenance_contracts where contract_end_date = '2018-03-15 06:45:00') as t0, (select maintenance_contract_company_id as c0 from maintenan...
{ "index": 3003, "split": "train" }
Is the average company ID for flights at airport 1 less than 5.33?
flight_company
select t0.c1 < 5.33 from (select avg(t1.company_id) as c1 from airport as t0 join flight as t1 on t0.id = t1.airport_id where t0.id = 1 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": "flight_company", "sql": "select t0.c1 < 5.33 from (select avg(t1.company_id) as c1 from airport as t0 join flight as t1 on t0.id = t1.airport_id where t0.id = 1 group by t0.id) as t0" }, "style": "rule" }
{ "index": 3341, "split": "train" }
Which characteristic details and names are shared between all characteristics and those associated specifically with products having the least common color?
products_gen_characteristics
select anon_1.c1, anon_1.c2 from (select other_characteristic_details as c1, characteristic_name as c2 from characteristics intersect select t0.other_characteristic_details as c1, t0.characteristic_name as c2 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id jo...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c1, anon_1.c2 from (select other_characteristic_details as c1, characteristic_name as c2 from characteristics intersect select t0.other_characteristic_details as c1, t0.characteristic_name as c2 from characteristics as t0 join ...
{ "index": 1779, "split": "train" }
Is the percentage increase in the total number of students with IDs less than or equal to 10 involved in violence incidents between March 6 and March 19, 2018, greater than the number of unique incident types recorded on those dates?
behavior_monitoring
select t5.c4 > t2.c0 from (select abs((t3.c1 / cast(t4.c1 as real) - 1) * 100) as c4 from (select sum(t1.student_id) as c1 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t0.incident_type_code = 'VIOLENCE' and t1.date_incident_end = '2018-03-19 02:35:39' ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select t5.c4 > t2.c0 from (select abs((t3.c1 / cast(t4.c1 as real) - 1) * 100) as c4 from (select sum(t1.student_id) as c1 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t0.incident_ty...
{ "index": 3433, "split": "train" }
What are the numbers of bikes currently available, the station IDs, and the station identifiers for stations whose names end with "dero at Sansome"?
bike_1
select t0.bikes_available, t0.station_id, t1.id from status as t0 join station as t1 on t0.station_id = t1.id where t1.name like '%dero at Sansome'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.bikes_available, t0.station_id, t1.id from status as t0 join station as t1 on t0.station_id = t1.id where t1.name like '%dero at Sansome'" }, "style": "rule" }
{ "index": 1396, "split": "train" }
Which three stations with dock counts between 15 and 23 have the highest maximum number of bikes available, and what are their IDs?
bike_1
select t0.id as c0 from station as t0 join status as t1 on t0.id = t1.station_id where t0.dock_count between 15 and 23 group by c0 order by max(t1.bikes_available) desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select t0.id as c0 from station as t0 join status as t1 on t0.id = t1.station_id where t0.dock_count between 15 and 23 group by c0 order by max(t1.bikes_available) desc limit 3" }, "style": "rule" }
{ "index": 33, "split": "train" }
Which artists, identified by their year of joining, country, and artist ID, have participated in exhibitions associated with artist IDs less than 4 and also with artist IDs 2 or 3?
theme_gallery
select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.year_join as c0, t0.country as c1, t0.artist_id as c2 from artist as t0 join exhibition as t1 on t0.artist_id = t1.artist_id where t1.artist_id < 4 intersect select t0.year_join as c0, t0.country as c1, t0.artist_id as c2 from artist as t0 join exhibition as t1 on ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "theme_gallery", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.year_join as c0, t0.country as c1, t0.artist_id as c2 from artist as t0 join exhibition as t1 on t0.artist_id = t1.artist_id where t1.artist_id < 4 intersect select t0.year_join as c0, t0.country as c1...
{ "index": 2487, "split": "train" }
Which professors have taught classes that include students with student numbers up to 321452, and what are their employee numbers, office locations, department codes, along with the classrooms and class codes of those classes?
college_1
select t0.emp_num, t0.prof_office, t0.dept_code, t2.class_room, t2.class_code from professor as t0 join employee as t1 on t0.emp_num = t1.emp_num join class as t2 on t1.emp_num = t2.prof_num join enroll as t3 on t2.class_code = t3.class_code where t3.stu_num <= 321452
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_1", "sql": "select t0.emp_num, t0.prof_office, t0.dept_code, t2.class_room, t2.class_code from professor as t0 join employee as t1 on t0.emp_num = t1.emp_num join class as t2 on t1.emp_num = t2.prof_num join enroll as t3 on t2.class_code = t3.class_code where t3.stu_num <...
{ "index": 1467, "split": "train" }
How many more or fewer unique documents did US ship compared to four?
cre_Doc_Control_Systems
select t0.c2 - 4 from (select count(distinct (t1.document_id)) as c2 from ref_shipping_agents as t0 join documents as t1 on t0.shipping_agent_code = t1.shipping_agent_code where t0.shipping_agent_code = 'US' group by t0.shipping_agent_code) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Control_Systems", "sql": "select t0.c2 - 4 from (select count(distinct (t1.document_id)) as c2 from ref_shipping_agents as t0 join documents as t1 on t0.shipping_agent_code = t1.shipping_agent_code where t0.shipping_agent_code = 'US' group by t0.shipping_agent_code) as t0...
{ "index": 3218, "split": "train" }
What are the bottom three claim IDs and their total created dates for claims whose created date matches the most recent created date of claim ID 45, grouping the results by claim ID and sorting them in order?
insurance_and_eClaims
select t0.claim_id as c2, sum(t0.created_date) from claims_documents as t0, (select max(created_date) as c0 from claims_documents where claim_id = 45) as t0 where t0.created_date = t0.c0 group by c2 order by c2 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_and_eClaims", "sql": "select t0.claim_id as c2, sum(t0.created_date) from claims_documents as t0, (select max(created_date) as c0 from claims_documents where claim_id = 45) as t0 where t0.created_date = t0.c0 group by c2 order by c2 asc nulls last limit 3" }, "style...
{ "index": 651, "split": "train" }
What are the actual delivery dates, order dates, and order IDs for customer orders that contain order items with quantities ending in '1', but excluding orders with IDs less than 7?
cre_Drama_Workshop_Groups
select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.actual_delivery_date as c0, t0.order_date as c2, t0.order_id as c1 from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.order_quantity like '%1' except select t0.actual_delivery_date as c0, t0.order_date as c2, t0.order_id as c1 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_Drama_Workshop_Groups", "sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.actual_delivery_date as c0, t0.order_date as c2, t0.order_id as c1 from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.order_quantity like '%1' except se...
{ "index": 476, "split": "train" }
What are the names of activities that currently have no students participating, and can you list them in reverse alphabetical order?
activity_1
select t0.activity_name as c0 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where (not t1.actid in (select participates_in.actid as c1 from participates_in)) order by c0 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "activity_1", "sql": "select t0.activity_name as c0 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where (not t1.actid in (select participates_in.actid as c1 from participates_in)) order by c0 desc" }, "style": "rule" }
{ "index": 1858, "split": "train" }
What is the percentage change in the average project ID for leaders who served before the start of 2004, comparing their average at the time they served until March 19, 1983, to their average during their service until September 25, 2008?
tracking_grants_for_research
select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select avg(t1.project_id) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'leader' and t1.date_to = '1983-03-19 16:06:31' and t1.date_from <= '2004-11-01 23:52:38' group by t0.role_code) as t0, (select t0.role...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select avg(t1.project_id) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'leader' and t1.date_to = '1983-03-19 16:06:31' and t1.d...
{ "index": 3425, "split": "train" }
Which parties' took office dates, IDs, and names are associated with regions whose labels include 'a', except for those from regions named 'United Kingdom'?
party_people
select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.took_office as c0, t0.party_id as c1, t0.party_name as c2 from party as t0 join region as t1 on t0.region_id = t1.region_id where t1.label like '%a%' except select t0.took_office as c0, t0.party_id as c1, t0.party_name as c2 from party as t0 join region as t1 on 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": "party_people", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.took_office as c0, t0.party_id as c1, t0.party_name as c2 from party as t0 join region as t1 on t0.region_id = t1.region_id where t1.label like '%a%' except select t0.took_office as c0, t0.party_id as c...
{ "index": 245, "split": "train" }
What is the result of subtracting 49.0 from the group equity shareholding of the company with ID 1?
flight_company
select group_equity_shareholding - 49.0 from operate_company where id = 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_company", "sql": "select group_equity_shareholding - 49.0 from operate_company where id = 1" }, "style": "rule" }
{ "index": 3238, "split": "train" }
Can you show me the names, group equity shareholding percentages, and IDs of the first three operate companies that have flights departing from airports located in cities containing the words "im" or "to"? For each of these flights, please also include the date and pilot's name, ordering the results by pilot in alphabe...
flight_company
select t0.name, t0.group_equity_shareholding, t0.id, t1.date, t1.pilot as c1 from operate_company as t0 join flight as t1 on t0.id = t1.company_id join airport as t2 on t1.airport_id = t2.id where t2.city like '%im%' or t2.city like '%to%' order by c1 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_company", "sql": "select t0.name, t0.group_equity_shareholding, t0.id, t1.date, t1.pilot as c1 from operate_company as t0 join flight as t1 on t0.id = t1.company_id join airport as t2 on t1.airport_id = t2.id where t2.city like '%im%' or t2.city like '%to%' order by c1 asc...
{ "index": 878, "split": "train" }
Which are the top three artists named Shrikanta with gender ending in "ale," showing the total resolution of their songs and the smallest file ID, sorted by the highest total resolution?
music_1
select sum(t0.resolution) as c1, min(t0.f_id), t1.artist_name as c0 from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where t1.gender like '%ale' and c0 = 'Shrikanta' group by c0 order by c1 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select sum(t0.resolution) as c1, min(t0.f_id), t1.artist_name as c0 from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where t1.gender like '%ale' and c0 = 'Shrikanta' group by c0 order by c1 desc limit 3" }, "style": "rule" }
{ "index": 2721, "split": "train" }
For each political party, what is the smallest regional identifier associated with that party?
party_people
select party_id as c0, min(region_id) from party 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": "party_people", "sql": "select party_id as c0, min(region_id) from party group by c0" }, "style": "rule" }
{ "index": 1163, "split": "train" }
Which dorms have students with IDs 1033 or 1019 living in them, and what are the gender restrictions, dorm IDs, and names of those dorms, along with the dorm ID and student ID of the corresponding students?
dorm_1
select t0.gender, t0.dormid, t0.dorm_name, t1.dormid, t1.stuid from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid join student as t2 on t1.stuid = t2.stuid where t2.stuid = 1033 or t2.stuid = 1019
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select t0.gender, t0.dormid, t0.dorm_name, t1.dormid, t1.stuid from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid join student as t2 on t1.stuid = t2.stuid where t2.stuid = 1033 or t2.stuid = 1019" }, "style": "rule" }
{ "index": 238, "split": "train" }
What is the percentage change in the maximum circuit ID for circuits that hosted races on October 1, 1978, compared to September 7, 1958?
formula_1
select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select max(t1.circuitid) as c0 from circuits as t0 join races as t1 on t0.circuitid = t1.circuitid where t1.date = '1978-10-01' group by t0.circuitid) as t0, (select t0.circuitid, max(t1.circuitid) as c0 from circuits as t0 join races as t1 on t0.circuitid ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "formula_1", "sql": "select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select max(t1.circuitid) as c0 from circuits as t0 join races as t1 on t0.circuitid = t1.circuitid where t1.date = '1978-10-01' group by t0.circuitid) as t0, (select t0.circuitid, max(t1.circuitid)...
{ "index": 3035, "split": "train" }
What are the five countries with the most different mountain prominences?
climbing
select count(distinct (prominence)) from mountain group by country order by country 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": "climbing", "sql": "select count(distinct (prominence)) from mountain group by country order by country asc nulls last limit 5" }, "style": "rule" }
{ "index": 2516, "split": "train" }
What are the checking account balances, checking account custids, customer custids, and customer names for customers whose savings account balance exceeds 60.0?
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 > 60.0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select t0.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 > 60.0" }, "style": "rule" }
{ "index": 755, "split": "train" }
In hosting cities, which match has the lowest match ID where the March temperature is either equal to 26.1 or at least as high as the minimum March temperature recorded?
city_record
select t0.match_id as c2, t0.host_city from hosting_city as t0 join city as t1 on t0.host_city = t1.city_id join temperature as t2 on t1.city_id = t2.city_id, (select min(mar) as c1 from temperature) as t0 where t2.mar >= t0.c1 or t2.mar = 26.1 order by c2 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": "city_record", "sql": "select t0.match_id as c2, t0.host_city from hosting_city as t0 join city as t1 on t0.host_city = t1.city_id join temperature as t2 on t1.city_id = t2.city_id, (select min(mar) as c1 from temperature) as t0 where t2.mar >= t0.c1 or t2.mar = 26.1 order by c2 a...
{ "index": 1285, "split": "train" }
Which companies have profits of a few billion, and what are their IDs and the IDs of their office buildings located in buildings that are between 150 and 300 meters tall and have names containing "rativo BBVA Banco"?
company_office
select t0.profits_billion, t0.id, t1.building_id from companies as t0 join office_locations as t1 on t0.id = t1.company_id join buildings as t2 on t1.building_id = t2.id where t2.height between 150 and 300 and t2.name like '%rativo BBVA Banco%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.profits_billion, t0.id, t1.building_id from companies as t0 join office_locations as t1 on t0.id = t1.company_id join buildings as t2 on t1.building_id = t2.id where t2.height between 150 and 300 and t2.name like '%rativo BBVA Banco%'" }, "s...
{ "index": 2853, "split": "train" }
How many days passed between when a claim was made and when it was settled for claims with a settlement amount over 1085?
insurance_policies
select julianday(t1.c0) - julianday(t0.c3) from (select date_claim_made as c0 from claims) as t1, (select date_claim_settled as c3 from claims where amount_settled > 1085 and amount_settled > 1085) 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": "insurance_policies", "sql": "select julianday(t1.c0) - julianday(t0.c3) from (select date_claim_made as c0 from claims) as t1, (select date_claim_settled as c3 from claims where amount_settled > 1085 and amount_settled > 1085) as t0" }, "style": "rule" }
{ "index": 3922, "split": "train" }
Which investors made purchases with transaction IDs 9 or 14?
tracking_share_transactions
select t0.investor_id from transactions as t0 join purchases as t1 on t0.transaction_id = t1.purchase_transaction_id where t1.purchase_transaction_id = 9 or t1.purchase_transaction_id = 14
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select t0.investor_id from transactions as t0 join purchases as t1 on t0.transaction_id = t1.purchase_transaction_id where t1.purchase_transaction_id = 9 or t1.purchase_transaction_id = 14" }, "style": "rule" }
{ "index": 1769, "split": "train" }
What are the smallest and largest part IDs associated with asset number 14?
assets_maintenance
select min(part_id), max(part_id) from asset_parts where asset_id = 14
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 min(part_id), max(part_id) from asset_parts where asset_id = 14" }, "style": "rule" }
{ "index": 3634, "split": "train" }
Which products have a width and price in dollars, where the catalog they belong to has an ID less than 8 or greater than 1?
product_catalog
select t0.width, t0.price_in_dollars from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_id < 8 or t1.catalog_id > 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select t0.width, t0.price_in_dollars from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_id < 8 or t1.catalog_id > 1" }, "style": "rule" }
{ "index": 144, "split": "train" }
Which are the first 3 customers with the highest customer IDs who have an invoice that includes invoice line 255? List their customer IDs and the date of those invoices.
store_1
select t0.customer_id as c0, t0.invoice_date from invoices as t0 join invoice_lines as t1 on t0.id = t1.invoice_id where t1.id = 255 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": "store_1", "sql": "select t0.customer_id as c0, t0.invoice_date from invoices as t0 join invoice_lines as t1 on t0.id = t1.invoice_id where t1.id = 255 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 1614, "split": "train" }
Which are the five phone chip models with the highest (most recent) model identifiers, listed from Z to A?
phone_1
select chip_model as c0 from phone 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": "phone_1", "sql": "select chip_model as c0 from phone order by c0 desc limit 5" }, "style": "rule" }
{ "index": 577, "split": "train" }
How many days pass between when a claim was made (after August 3, 2017) and when it was settled?
insurance_policies
select julianday(t1.c0) - julianday(t0.c3) from (select date_claim_made as c0 from claims where c0 > '2017-08-03 00:00:00' and c0 > '2017-08-03 00:00:00') as t1, (select date_claim_settled as c3 from claims) 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": "insurance_policies", "sql": "select julianday(t1.c0) - julianday(t0.c3) from (select date_claim_made as c0 from claims where c0 > '2017-08-03 00:00:00' and c0 > '2017-08-03 00:00:00') as t1, (select date_claim_settled as c3 from claims) as t0" }, "style": "rule" }
{ "index": 3816, "split": "train" }
What is the name of the playlist that has the ID of 11?
store_1
select t0.name from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id where t1.playlist_id = 11
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t0.name from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id where t1.playlist_id = 11" }, "style": "rule" }
{ "index": 2331, "split": "train" }
Which countries and airline IDs are associated with airlines that operate routes to the most common destination airport, or to destination airports whose codes include the letter "A"? Additionally, what is the highest destination airport ID for each of these airlines?
flight_4
select t0.country, t0.alid as c3, max(t1.dst_apid) from airlines as t0 join routes as t1 on t0.alid = t1.alid, (select dst_ap as c1 from routes group by c1 order by count(alid) desc limit 1) as t0 where t1.dst_ap = t0.c1 or t1.dst_ap like '%A%' group by 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": "flight_4", "sql": "select t0.country, t0.alid as c3, max(t1.dst_apid) from airlines as t0 join routes as t1 on t0.alid = t1.alid, (select dst_ap as c1 from routes group by c1 order by count(alid) desc limit 1) as t0 where t1.dst_ap = t0.c1 or t1.dst_ap like '%A%' group by c3" }...
{ "index": 1139, "split": "train" }
How many first names are associated with actor ID 75, and how many unique last names does this actor have?
sakila_1
select count(t0.first_name), count(distinct (t0.last_name)) from actor as t0 join film_actor as t1 on t0.actor_id = t1.actor_id where t1.actor_id = 75
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(t0.first_name), count(distinct (t0.last_name)) from actor as t0 join film_actor as t1 on t0.actor_id = t1.actor_id where t1.actor_id = 75" }, "style": "rule" }
{ "index": 377, "split": "train" }
Which farm competitions took place in cities with a population of 5,706 or less, considering only the competitions that are recorded in the farm_competition table and are held in these smaller cities? Specifically, what are the years they occurred, the hosts involved, and the city IDs of those host cities?
farm
select anon_1.c1, anon_1.c0, anon_1.c2 from (select year as c1, hosts as c0, host_city_id as c2 from farm_competition intersect select t0.year as c1, t0.hosts as c0, t0.host_city_id as c2 from farm_competition as t0 join city as t1 on t0.host_city_id = t1.city_id where t1.population <= 5706.0) 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": "farm", "sql": "select anon_1.c1, anon_1.c0, anon_1.c2 from (select year as c1, hosts as c0, host_city_id as c2 from farm_competition intersect select t0.year as c1, t0.hosts as c0, t0.host_city_id as c2 from farm_competition as t0 join city as t1 on t0.host_city_id = t1.city_id w...
{ "index": 2480, "split": "train" }
How many unique transaction lots are there for each lot ID that shares the most common lot details of lot ID 1 and are not owned by any investor with a transaction history?
tracking_share_transactions
select count(distinct (t0.lot_id)), t1.lot_id as c3 from transactions_lots as t0 join lots as t1 on t0.lot_id = t1.lot_id, (select lot_details as c2 from lots where lot_id = 1 group by c2 order by count(*) asc nulls last limit 1) as t1 where t1.lot_details = t1.c2 and (not t1.investor_id in (select transactions.investo...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(distinct (t0.lot_id)), t1.lot_id as c3 from transactions_lots as t0 join lots as t1 on t0.lot_id = t1.lot_id, (select lot_details as c2 from lots where lot_id = 1 group by c2 order by count(*) asc nulls last limit 1) as t1 where ...
{ "index": 2145, "split": "train" }
Which are the top three papers, including their titles and IDs, along with the associated institution IDs and author IDs, where the authors have last names containing "Turo" or share the most common last name in the database? The results should be sorted by author ID from highest to lowest.
icfp_1
select t0.title, t0.paperid, t1.instid, t1.authid as c1 from papers as t0 join authorship as t1 on t0.paperid = t1.paperid join authors as t2 on t1.authid = t2.authid, (select lname as c2 from authors group by c2 order by count(*) desc limit 1) as t0 where t2.lname like '%Turo%' or t2.lname = t0.c2 order by c1 desc lim...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "icfp_1", "sql": "select t0.title, t0.paperid, t1.instid, t1.authid as c1 from papers as t0 join authorship as t1 on t0.paperid = t1.paperid join authors as t2 on t1.authid = t2.authid, (select lname as c2 from authors group by c2 order by count(*) desc limit 1) as t0 where t2.lna...
{ "index": 450, "split": "train" }
How many happy hours are scheduled in July across all the coffee shop locations?
coffee_shop
select count(*) from happy_hour where month = 'July'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "coffee_shop", "sql": "select count(*) from happy_hour where month = 'July'" }, "style": "rule" }
{ "index": 777, "split": "train" }
Which are the top five regions affected by storms that had exactly three deaths and maximum wind speeds over 983, listed starting from the highest region IDs?
storm_record
select t0.region_name, t0.region_id as c1 from region as t0 join affected_region as t1 on t0.region_id = t1.region_id join storm as t2 on t1.storm_id = t2.storm_id where t2.number_deaths = 3 and t2.max_speed > 983 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": "storm_record", "sql": "select t0.region_name, t0.region_id as c1 from region as t0 join affected_region as t1 on t0.region_id = t1.region_id join storm as t2 on t1.storm_id = t2.storm_id where t2.number_deaths = 3 and t2.max_speed > 983 order by c1 desc limit 5" }, "style": "...
{ "index": 2962, "split": "train" }
Which submissions include their college, author, scores, and submission ID, and also include submissions accepted into workshops held at venues starting with 'New'?
workshop_paper
select anon_1.c0, anon_1.c2, anon_1.c3, anon_1.c1 from (select college as c0, author as c2, scores as c3, submission_id as c1 from submission union select t0.college as c0, t0.author as c2, t0.scores as c3, t0.submission_id as c1 from submission as t0 join acceptance as t1 on t0.submission_id = t1.submission_id join wo...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c2, anon_1.c3, anon_1.c1 from (select college as c0, author as c2, scores as c3, submission_id as c1 from submission union select t0.college as c0, t0.author as c2, t0.scores as c3, t0.submission_id as c1 from submission as t0 joi...
{ "index": 2412, "split": "train" }
Which fault log entries, recorded between late February and mid-March 2018, have a recorded-by staff ID less than or equal to the total sum of all recorded-by staff IDs across all fault logs?
assets_maintenance
select t0.fault_log_entry_id from engineer_visits as t0 join fault_log as t1 on t0.fault_log_entry_id = t1.fault_log_entry_id, (select sum(recorded_by_staff_id) as c0 from fault_log) as t0 where t1.fault_log_entry_datetime between '2018-02-28 20:15:25' and '2018-03-11 14:00:39' and t1.recorded_by_staff_id <= t0.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t0.fault_log_entry_id from engineer_visits as t0 join fault_log as t1 on t0.fault_log_entry_id = t1.fault_log_entry_id, (select sum(recorded_by_staff_id) as c0 from fault_log) as t0 where t1.fault_log_entry_datetime between '2018-02-28 20:15:25...
{ "index": 2613, "split": "train" }
What are the open dates and organizers of the first five churches that hosted weddings involving women whose countries include the letter "w", sorted alphabetically by the organizer's name?
wedding
select t0.open_date, t0.organized_by as c1 from church as t0 join wedding as t1 on t0.church_id = t1.church_id join people as t2 on t1.female_id = t2.people_id where t2.country like '%w%' 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": "wedding", "sql": "select t0.open_date, t0.organized_by as c1 from church as t0 join wedding as t1 on t0.church_id = t1.church_id join people as t2 on t1.female_id = t2.people_id where t2.country like '%w%' order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2515, "split": "train" }
Can you provide the names and IDs of customers who do not have the policy with ID 630?
insurance_fnol
select anon_1.c0, anon_1.c1 from (select customer_name as c0, customer_id as c1 from customers except 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_id ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_fnol", "sql": "select anon_1.c0, anon_1.c1 from (select customer_name as c0, customer_id as c1 from customers except 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_...
{ "index": 757, "split": "train" }
Which technicians are assigned to repair machines that have below-average value points, and what are their names, IDs, and ages?
machine_repair
select t0.name, t0.technician_id, t0.age from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id join machine as t2 on t1.machine_id = t2.machine_id, (select avg(value_points) as c0 from machine) as t0 where t2.value_points < 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": "machine_repair", "sql": "select t0.name, t0.technician_id, t0.age from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id join machine as t2 on t1.machine_id = t2.machine_id, (select avg(value_points) as c0 from machine) as t0 where t2.value_poin...
{ "index": 2791, "split": "train" }
When you rank catalog entries with levels between 1 and 9 in order of their catalog level number, where does the entry with ID 5 fall in that ranking?
product_catalog
select t1.c2, t1.c5 as c4 from (select row_number() over (order by catalog_level_number asc nulls last) as c2, catalog_entry_id as c5 from catalog_contents_additional_attributes where catalog_level_number between 1 and 9) as t1 where c4 = 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": "product_catalog", "sql": "select t1.c2, t1.c5 as c4 from (select row_number() over (order by catalog_level_number asc nulls last) as c2, catalog_entry_id as c5 from catalog_contents_additional_attributes where catalog_level_number between 1 and 9) as t1 where c4 = 5" }, "styl...
{ "index": 3495, "split": "train" }
What are the year and category of book clubs, along with the associated movie IDs that end with "5" and belong to companies incorporated in countries containing "ng"?
culture_company
select t0.year, t0.category, t1.movie_id as c1 from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where c1 like '%5' and t1.incorporated_in like '%ng%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "culture_company", "sql": "select t0.year, t0.category, t1.movie_id as c1 from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where c1 like '%5' and t1.incorporated_in like '%ng%'" }, "style": "rule" }
{ "index": 2753, "split": "train" }
Can you tell me the names and genders of the first five people who are friends with Zach, where the friendship began in year 6 or later, sorted alphabetically by gender?
network_2
select t0.name, t0.gender as c1 from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name = 'Zach' and t1.year >= 6 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": "network_2", "sql": "select t0.name, t0.gender as c1 from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name = 'Zach' and t1.year >= 6 order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2354, "split": "train" }
Which products and store details are associated with the store that has the fewest districts among those with district IDs 3 or 4 (or less than or equal to 4), as well as the store with store ID 1?
store_product
select t0.product_id, t0.store_id, t1.store_name from store_product as t0 join store as t1 on t0.store_id = t1.store_id join store_district as t2 on t1.store_id = t2.store_id, (select store_id as c1 from store_district where district_id between 3 and 4 or district_id <= 4 group by c1 order by count(*) asc nulls last li...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select t0.product_id, t0.store_id, t1.store_name from store_product as t0 join store as t1 on t0.store_id = t1.store_id join store_district as t2 on t1.store_id = t2.store_id, (select store_id as c1 from store_district where district_id between 3 and 4 or ...
{ "index": 884, "split": "train" }
Can you list the names of employees who are certified for aircrafts with aid 12 or 10?
flight_1
select t0.name from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.aid = 12 or t1.aid = 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_1", "sql": "select t0.name from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.aid = 12 or t1.aid = 10" }, "style": "rule" }
{ "index": 1973, "split": "train" }
For each owner of channel ID 7, what is the owner’s name and the highest percentage share their channel has?
program_share
select owner as c1, max(share_in_percent) from channel where channel_id = 7 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": "program_share", "sql": "select owner as c1, max(share_in_percent) from channel where channel_id = 7 group by c1" }, "style": "rule" }
{ "index": 293, "split": "train" }
Which are the three genres with the smallest total file IDs among genres named 'pop' or containing 'der', and how many distinct resolutions do they have?
music_1
select sum(t0.f_id) as c0, count(distinct (t0.resolution)), t1.g_name as c2 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where c2 = 'pop' or c2 like '%der%' group by c2 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": "music_1", "sql": "select sum(t0.f_id) as c0, count(distinct (t0.resolution)), t1.g_name as c2 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where c2 = 'pop' or c2 like '%der%' group by c2 order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 120, "split": "train" }
Who is the technician assigned to machine number 2?
machine_repair
select t0.name from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id where t1.machine_id = 2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "machine_repair", "sql": "select t0.name from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id where t1.machine_id = 2" }, "style": "rule" }
{ "index": 2320, "split": "train" }
How much higher is the latest project ID assigned to researchers compared to 15?
tracking_grants_for_research
select t0.c2 - 15 from (select max(t1.project_id) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'researcher' group by t0.role_code) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t0.c2 - 15 from (select max(t1.project_id) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'researcher' group by t0.role_code) as t0" }, "style": "rule" }
{ "index": 3257, "split": "train" }
Which playlist contains track 2462 with the lowest playlist ID?
store_1
select t0.track_id as c0 from playlist_tracks as t0 join playlists as t1 on t0.playlist_id = t1.id where c0 = 2462 order by t1.id 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": "store_1", "sql": "select t0.track_id as c0 from playlist_tracks as t0 join playlists as t1 on t0.playlist_id = t1.id where c0 = 2462 order by t1.id asc nulls last limit 1" }, "style": "rule" }
{ "index": 1924, "split": "train" }
What are the invoice details, invoice date, and invoice number, along with the number of related shipments shipped on or before October 12, 1999, at 10:41:49?
tracking_orders
select t0.invoice_details, t0.invoice_date, t0.invoice_number as c0, count(*) from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where t1.shipment_date <= '1999-10-12 10:41:49' group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.invoice_details, t0.invoice_date, t0.invoice_number as c0, count(*) from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where t1.shipment_date <= '1999-10-12 10:41:49' group by c0" }, "style": "rule" }
{ "index": 588, "split": "train" }
Which are the top 10 airline IDs for airlines whose names contain the letter "i", sorted by the number of destination airports they operate to?
flight_4
select t0.alid as c0 from airlines as t0 join routes as t1 on t0.alid = t1.alid where t0.name like '%i%' group by c0 order by count(t1.dst_apid) desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t0.alid as c0 from airlines as t0 join routes as t1 on t0.alid = t1.alid where t0.name like '%i%' group by c0 order by count(t1.dst_apid) desc limit 10" }, "style": "rule" }
{ "index": 1337, "split": "train" }
What is the percentage change in the minimum number of annual interchanges at stations served by trains at 06:30 compared to those served at 11:15?
train_station
select (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select t0.annual_interchanges as c0 from station as t0 join train_station as t1 on t0.station_id = t1.station_id join train as t2 on t1.train_id = t2.train_id where t2.time = '06:30') as t0, (select t0.annual_interchanges as c0, t0.station_id from station a...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "train_station", "sql": "select (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select t0.annual_interchanges as c0 from station as t0 join train_station as t1 on t0.station_id = t1.station_id join train as t2 on t1.train_id = t2.train_id where t2.time = '06:30') as t0, (s...
{ "index": 3062, "split": "train" }
What are the three most recent movie IDs and the countries where the companies are incorporated for book clubs with ID 5 or starting with "1", ordered from the most recently incorporated to the least?
culture_company
select movie_id, incorporated_in as c0 from culture_company where book_club_id = 5 or book_club_id like '1%' 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": "culture_company", "sql": "select movie_id, incorporated_in as c0 from culture_company where book_club_id = 5 or book_club_id like '1%' order by c0 desc limit 3" }, "style": "rule" }
{ "index": 2993, "split": "train" }
Is the receipt date of document 17 earlier than the receipt date of document 23?
cre_Doc_Control_Systems
select t1.c2 < t0.c2 from (select receipt_date as c2 from documents where document_id = 17) as t1, (select receipt_date as c2 from documents where document_id = 23) 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_Doc_Control_Systems", "sql": "select t1.c2 < t0.c2 from (select receipt_date as c2 from documents where document_id = 17) as t1, (select receipt_date as c2 from documents where document_id = 23) as t0" }, "style": "rule" }
{ "index": 3118, "split": "train" }
What is the average customer ID for complaints handled by staff member 117 concerning products with IDs up to 119?
customer_complaints
select t0.c0 from (select avg(t1.customer_id) as c0 from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id where t0.staff_id = 117 and t1.product_id <= 119 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": "customer_complaints", "sql": "select t0.c0 from (select avg(t1.customer_id) as c0 from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id where t0.staff_id = 117 and t1.product_id <= 119 group by t0.staff_id) as t0" }, "style": "rule" }
{ "index": 3367, "split": "train" }
Which country with a country ID less than 48 has a city containing the letter 'e', and is last in reverse alphabetical order? Please provide the country's name and ID.
sakila_1
select t0.country as c1, t1.country_id as c0 from country as t0 join city as t1 on t0.country_id = t1.country_id where t1.city like '%e%' and c0 < 48 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": "sakila_1", "sql": "select t0.country as c1, t1.country_id as c0 from country as t0 join city as t1 on t0.country_id = t1.country_id where t1.city like '%e%' and c0 < 48 order by c1 desc limit 1" }, "style": "rule" }
{ "index": 180, "split": "train" }
Can you find the top 5 enrollment grades along with the highest student numbers for each grade, considering only enrollments where the student number is either the largest student number below 324257 or less than or equal to 321452? The results should be grouped by enrollment grade, include only those groups where the ...
college_1
select t0.enroll_grade as c0, max(t0.stu_num) as c1 from enroll as t0, (select max(stu_num) as c1 from enroll where stu_num < 324257) as t0 where t0.stu_num = t0.c1 or t0.stu_num <= 321452 group by c0 having c1 <= 324257 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": "college_1", "sql": "select t0.enroll_grade as c0, max(t0.stu_num) as c1 from enroll as t0, (select max(stu_num) as c1 from enroll where stu_num < 324257) as t0 where t0.stu_num = t0.c1 or t0.stu_num <= 321452 group by c0 having c1 <= 324257 order by c0 desc limit 5" }, "style...
{ "index": 1834, "split": "train" }
Can you tell me the rank of airline 96 when airlines are ordered from least to most in total source airports used across their routes?
flight_4
select t1.c5, t1.c0 as c1 from (select row_number() over (order by t0.c4 asc nulls last) as c5, t0.c2 as c0 from (select t0.alid as c2, sum(t1.src_apid) as c4 from airlines as t0 join routes as t1 on t0.alid = t1.alid group by c2) as t0) as t1 where c1 = 96
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t1.c5, t1.c0 as c1 from (select row_number() over (order by t0.c4 asc nulls last) as c5, t0.c2 as c0 from (select t0.alid as c2, sum(t1.src_apid) as c4 from airlines as t0 join routes as t1 on t0.alid = t1.alid group by c2) as t0) as t1 where c1 = 96" ...
{ "index": 3486, "split": "train" }
What are the order details (customer ID, order status, and order date) for the customer with the smallest customer ID who has a contact channel that includes "e" or "Ema"?
customers_and_addresses
select t0.customer_id, t0.order_status, t0.order_date, t1.customer_id as c2 from customer_orders as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_contact_channels as t2 on t1.customer_id = t2.customer_id where t2.channel_code like '%e%' or t2.channel_code like '%Ema%' order by c2 asc nulls la...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.customer_id, t0.order_status, t0.order_date, t1.customer_id as c2 from customer_orders as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_contact_channels as t2 on t1.customer_id = t2.customer_id where t2.channe...
{ "index": 524, "split": "train" }
List the customer IDs, order statuses, and order IDs for orders with IDs between 3 and 4 or with order IDs greater than or equal to the highest shipment ID, along with the maximum order ID in this set.
tracking_orders
select t0.customer_id, t0.order_status, t0.order_id as c3, max(t1.order_id) as c0 from orders as t0 join shipments as t1 on t0.order_id = t1.order_id, (select max(order_id) as c0 from shipments) as t0 where t1.order_id between 3 and 4 or t1.order_id >= t0.c0 group by 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": "tracking_orders", "sql": "select t0.customer_id, t0.order_status, t0.order_id as c3, max(t1.order_id) as c0 from orders as t0 join shipments as t1 on t0.order_id = t1.order_id, (select max(order_id) as c0 from shipments) as t0 where t1.order_id between 3 and 4 or t1.order_id >= t...
{ "index": 381, "split": "train" }
What are the first five pairs of faculty ID and activity ID from the participation records, where the activity ID is either at least 771 or less than 790, sorted by faculty ID?
activity_1
select t0.actid, t0.facid as c0 from faculty_participates_in as t0 join activity as t1 on t0.actid = t1.actid join participates_in as t2 on t1.actid = t2.actid where t2.actid >= 771 or t2.actid < 790 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": "activity_1", "sql": "select t0.actid, t0.facid as c0 from faculty_participates_in as t0 join activity as t1 on t0.actid = t1.actid join participates_in as t2 on t1.actid = t2.actid where t2.actid >= 771 or t2.actid < 790 order by c0 asc nulls last limit 5" }, "style": "rule" ...
{ "index": 2266, "split": "train" }
For each type of medicine-enzyme interaction, how many different interaction types are recorded?
medicine_enzyme_interaction
select interaction_type as c1, count(distinct (interaction_type)) from medicine_enzyme_interaction 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": "medicine_enzyme_interaction", "sql": "select interaction_type as c1, count(distinct (interaction_type)) from medicine_enzyme_interaction group by c1" }, "style": "rule" }
{ "index": 2139, "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": 3893, "split": "train" }
What are the highest potential and the largest player API ID for each player who is either 165.1 cm or shorter, or whose height falls between 162.56 cm and 195.58 cm?
soccer_1
select max(t0.potential), max(t0.player_api_id), t1.id as c2 from player_attributes as t0 join player as t1 on t0.player_api_id = t1.player_api_id where t1.height <= 165.1 or t1.height between 162.56 and 195.58 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": "soccer_1", "sql": "select max(t0.potential), max(t0.player_api_id), t1.id as c2 from player_attributes as t0 join player as t1 on t0.player_api_id = t1.player_api_id where t1.height <= 165.1 or t1.height between 162.56 and 195.58 group by c2" }, "style": "rule" }
{ "index": 2854, "split": "train" }
For the top three zip codes with the most addresses, how many different states and countries are associated with those zip codes?
driving_school
select zip_postcode as c1, count(distinct (state_province_county)), count(country) from addresses group by c1 order by count(*) 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": "driving_school", "sql": "select zip_postcode as c1, count(distinct (state_province_county)), count(country) from addresses group by c1 order by count(*) desc limit 3" }, "style": "rule" }
{ "index": 870, "split": "train" }
Does the average `src_apid` for airport with ID 5515 exceed the number of airports located in cities with names containing "Blyth"?
flight_4
select t2.c0 > t1.c3 from (select avg(t1.src_apid) as c0 from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t0.apid = 5515 group by t0.apid) as t2, (select count(t0.c0) as c3 from (select avg(t1.src_apid) as c0 from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t0.city like '%Blyth%'...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t2.c0 > t1.c3 from (select avg(t1.src_apid) as c0 from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t0.apid = 5515 group by t0.apid) as t2, (select count(t0.c0) as c3 from (select avg(t1.src_apid) as c0 from airports as t0 join routes ...
{ "index": 3275, "split": "train" }
What are the allergies and their types for the student with ID 1021?
allergy_1
select t0.allergy, t0.allergytype, t1.stuid from allergy_type as t0 join has_allergy as t1 on t0.allergy = t1.allergy join student as t2 on t1.stuid = t2.stuid where t2.stuid = 1021
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "allergy_1", "sql": "select t0.allergy, t0.allergytype, t1.stuid from allergy_type as t0 join has_allergy as t1 on t0.allergy = t1.allergy join student as t2 on t1.stuid = t2.stuid where t2.stuid = 1021" }, "style": "rule" }
{ "index": 97, "split": "train" }
What are the IDs of the five most recent parties based on the highest party IDs?
party_host
select party_id as c0 from party_host 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": "party_host", "sql": "select party_id as c0 from party_host order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2537, "split": "train" }
Which party associated with service ID 7 has the lowest average of their service IDs, and what is their payment method code?
e_government
select t0.payment_method_code, t0.party_id as c1 from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t1.service_id = 7 group by c1 order by avg(t1.service_id) 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": "e_government", "sql": "select t0.payment_method_code, t0.party_id as c1 from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t1.service_id = 7 group by c1 order by avg(t1.service_id) asc nulls last limit 1" }, "style": "rule" }
{ "index": 2925, "split": "train" }
What are the top 10 counts of unique individuals involved in friendships, their average year, and the number of unique cities people come from in New York, all ordered by the number of friendships each person has?
network_2
select count(distinct (t0.name)), avg(t0.year), count(distinct (t1.city)) from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.city = 'new york city' order by count(distinct (t0.friend)) 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": "network_2", "sql": "select count(distinct (t0.name)), avg(t0.year), count(distinct (t1.city)) from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.city = 'new york city' order by count(distinct (t0.friend)) desc limit 10" }, "style": "rule" }
{ "index": 2815, "split": "train" }
What is the difference in resolution between the song "Aj ei akash" and the song "My love"?
music_1
select t1.c1 - t0.c1 from (select resolution as c1 from song where song_name = 'My love') as t1, (select resolution as c1 from song where song_name = 'Aj ei akash') as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t1.c1 - t0.c1 from (select resolution as c1 from song where song_name = 'My love') as t1, (select resolution as c1 from song where song_name = 'Aj ei akash') as t0" }, "style": "rule" }
{ "index": 3987, "split": "train" }
What is the percentage increase or decrease in the highest number of unique documents associated with any document status on December 25, 2014, compared to April 21, 2008?
cre_Doc_Control_Systems
select (max(t0.c2) / cast(max(t1.c2) as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c2 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t1.receipt_date = '2014-12-25 17:22:44' group by t0.document_status_code) as t0, (select t0.document...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (max(t0.c2) / cast(max(t1.c2) as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c2 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t1.receipt_date = '2014-12...
{ "index": 3890, "split": "train" }
What is the sales in billion for the company with ID 12, after subtracting 156.2?
company_office
select sales_billion - 156.2 from companies where id = 12
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select sales_billion - 156.2 from companies where id = 12" }, "style": "rule" }
{ "index": 3217, "split": "train" }
What are the ratings, languages, and genre ratings of the top three songs from countries listed in reverse alphabetical order, where the genres have names ending with "re"?
music_1
select t0.rating, t0.languages, t1.rating from song as t0 join genre as t1 on t0.genre_is = t1.g_name where t1.g_name like '%re' order by t0.country 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": "music_1", "sql": "select t0.rating, t0.languages, t1.rating from song as t0 join genre as t1 on t0.genre_is = t1.g_name where t1.g_name like '%re' order by t0.country desc limit 3" }, "style": "rule" }
{ "index": 2271, "split": "train" }
Can you list the first ten faculty members along with their department numbers and department names who are members of departments with DNOs between 140 and 550, ordered by their faculty IDs?
college_3
select t0.facid as c1, t0.dno, t1.dname from member_of as t0 join department as t1 on t0.dno = t1.dno join minor_in as t2 on t1.dno = t2.dno where t2.dno between 140 and 550 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": "college_3", "sql": "select t0.facid as c1, t0.dno, t1.dname from member_of as t0 join department as t1 on t0.dno = t1.dno join minor_in as t2 on t1.dno = t2.dno where t2.dno between 140 and 550 order by c1 asc nulls last limit 10" }, "style": "rule" }
{ "index": 872, "split": "train" }
When is the birthday of the heaviest player?
soccer_1
select t0.birthday, t0.weight as c2 from player as t0, (select max(weight) as c3 from player) as t1 where c2 = t1.c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select t0.birthday, t0.weight as c2 from player as t0, (select max(weight) as c3 from player) as t1 where c2 = t1.c3" }, "style": "rule" }
{ "index": 3792, "split": "train" }
Which are the top three mills, including their built year, location, and ID, built by architects who designed bridges located either in "Dinosaur National Monument , C" or in the least common location among bridges named starting with "Hazarchishma Natural B"? For each, also include the architect's name and nationality...
architecture
select t0.built_year, t0.location, t0.id, t1.nationality, t1.name as c3 from mill as t0 join architect as t1 on t0.architect_id = t1.id join bridge as t2 on t1.id = t2.architect_id, (select location as c0 from bridge where name like 'Hazarchishma Natural B%' group by c0 order by count(*) asc nulls last limit 1) as t0 w...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "architecture", "sql": "select t0.built_year, t0.location, t0.id, t1.nationality, t1.name as c3 from mill as t0 join architect as t1 on t0.architect_id = t1.id join bridge as t2 on t1.id = t2.architect_id, (select location as c0 from bridge where name like 'Hazarchishma Natural B%...
{ "index": 2023, "split": "train" }
What are the names of up to five trains with train ID 6 that pass through stations not experiencing high temperatures between 49 and 58 degrees, ordered alphabetically by train name?
station_weather
select t0.name as c1 from train as t0 join route as t1 on t0.id = t1.train_id where (not t1.station_id in (select weekly_weather.station_id as c0 from weekly_weather where weekly_weather.high_temperature between 49 and 58)) and t1.train_id = 6 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": "station_weather", "sql": "select t0.name as c1 from train as t0 join route as t1 on t0.id = t1.train_id where (not t1.station_id in (select weekly_weather.station_id as c0 from weekly_weather where weekly_weather.high_temperature between 49 and 58)) and t1.train_id = 6 order by c...
{ "index": 1523, "split": "train" }
What is the position of the item with ID 3 when all items are sorted from the lowest to the highest total rank score?
epinions_1
select t1.c5, t1.c2 as c3 from (select row_number() over (order by t0.c0 asc nulls last) as c5, t0.c1 as c2 from (select t0.i_id as c1, sum(t1.rank) as c0 from item as t0 join review as t1 on t0.i_id = t1.i_id group by c1) as t0) as t1 where c3 = 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "epinions_1", "sql": "select t1.c5, t1.c2 as c3 from (select row_number() over (order by t0.c0 asc nulls last) as c5, t0.c1 as c2 from (select t0.i_id as c1, sum(t1.rank) as c0 from item as t0 join review as t1 on t0.i_id = t1.i_id group by c1) as t0) as t1 where c3 = 3" }, "s...
{ "index": 3485, "split": "train" }
Which awards years and player IDs correspond to players who passed away between 1921 and 1979?
baseball_1
select t0.year, t1.player_id from player_award as t0 join player as t1 on t0.player_id = t1.player_id where t1.death_year between 1921 and 1979
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.year, t1.player_id from player_award as t0 join player as t1 on t0.player_id = t1.player_id where t1.death_year between 1921 and 1979" }, "style": "rule" }
{ "index": 758, "split": "train" }
Can you list the top three districts along with their market IDs and the number of phones in stock, for phones that have '6' in their name? Please sort the districts in reverse alphabetical order.
phone_market
select t0.district as c0, t0.market_id, t1.num_of_stock 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.name like '%6%' 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": "phone_market", "sql": "select t0.district as c0, t0.market_id, t1.num_of_stock 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.name like '%6%' order by c0 desc limit 3" }, "style": "rule" }
{ "index": 862, "split": "train" }
What are the product quantities and product IDs for orders placed through accounts that have the least common 'other account details' among customers with IDs less than or equal to 12?
customers_and_invoices
select t0.product_quantity, t0.product_id from order_items as t0 join orders as t1 on t0.order_id = t1.order_id join customers as t2 on t1.customer_id = t2.customer_id join accounts as t3 on t2.customer_id = t3.customer_id, (select other_account_details as c2 from accounts where customer_id <= 12 group by c2 order by c...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t0.product_quantity, t0.product_id from order_items as t0 join orders as t1 on t0.order_id = t1.order_id join customers as t2 on t1.customer_id = t2.customer_id join accounts as t3 on t2.customer_id = t3.customer_id, (select other_account_d...
{ "index": 2016, "split": "train" }
?
college_2
select room_number as c0, count(year) from section where year = 2005 or year = 2008 group by c0 order by c0 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_2", "sql": "select room_number as c0, count(year) from section where year = 2005 or year = 2008 group by c0 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 485, "split": "train" }
What are the dates when customers became clients and their payment methods for those living in addresses located in counties starting with "Il" or specifically in Massachusetts?
customer_deliveries
select t0.date_became_customer, t0.payment_method from customers as t0 join customer_addresses as t1 on t0.customer_id = t1.customer_id join addresses as t2 on t1.address_id = t2.address_id where t2.state_province_county like 'Il%' or t2.state_province_county = 'Massachusetts'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_deliveries", "sql": "select t0.date_became_customer, t0.payment_method from customers as t0 join customer_addresses as t1 on t0.customer_id = t1.customer_id join addresses as t2 on t1.address_id = t2.address_id where t2.state_province_county like 'Il%' or t2.state_provin...
{ "index": 322, "split": "train" }
Can you provide the assessment date, candidate ID, and assessment outcome code for each candidate assessment, along with the student ID and their details, for students enrolled in courses named "database" or in the least common course that ends with "ics"?
student_assessment
select t0.assessment_date, t0.candidate_id, t0.asessment_outcome_code, t3.student_id, t3.student_details from candidate_assessments as t0 join candidates as t1 on t0.candidate_id = t1.candidate_id join people as t2 on t1.candidate_id = t2.person_id join students as t3 on t2.person_id = t3.student_id join student_course...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select t0.assessment_date, t0.candidate_id, t0.asessment_outcome_code, t3.student_id, t3.student_details from candidate_assessments as t0 join candidates as t1 on t0.candidate_id = t1.candidate_id join people as t2 on t1.candidate_id = t2.person_id jo...
{ "index": 1957, "split": "train" }
Which documents have their IDs, storage dates, and type codes listed along with all documents, including those with document types that start with "Bo"?
cre_Doc_Tracking_DB
select anon_1.c0, anon_1.c1, anon_1.c2 from (select document_id as c0, date_stored as c1, document_type_code as c2 from all_documents union select t0.document_id as c0, t0.date_stored as c1, t0.document_type_code as c2 from all_documents as t0 join ref_document_types as t1 on t0.document_type_code = t1.document_type_co...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Tracking_DB", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select document_id as c0, date_stored as c1, document_type_code as c2 from all_documents union select t0.document_id as c0, t0.date_stored as c1, t0.document_type_code as c2 from all_documents as t0 join r...
{ "index": 207, "split": "train" }
What are the highest and lowest total oppose rates across all candidates?
candidate_poll
select min(t0.c2), max(t0.c2) from (select sum(t1.oppose_rate) as c2 from people as t0 join candidate as t1 on t0.people_id = t1.people_id group by t0.people_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "candidate_poll", "sql": "select min(t0.c2), max(t0.c2) from (select sum(t1.oppose_rate) as c2 from people as t0 join candidate as t1 on t0.people_id = t1.people_id group by t0.people_id) as t0" }, "style": "rule" }
{ "index": 3636, "split": "train" }
For each building, what are its number of stories and its ID for offices that belong either to the company with the fewest offices in building 7 or to companies that are not Petrobras?
company_office
select t0.stories from buildings as t0 join office_locations as t1 on t0.id = t1.building_id, (select company_id as c2 from office_locations where building_id = 7 group by c2 order by count(*) asc nulls last limit 1) as t1 where t1.company_id = t1.c2 or (not t1.company_id in (select companies.id as c0 from companies wh...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select t0.stories from buildings as t0 join office_locations as t1 on t0.id = t1.building_id, (select company_id as c2 from office_locations where building_id = 7 group by c2 order by count(*) asc nulls last limit 1) as t1 where t1.company_id = t1.c2 or (...
{ "index": 2063, "split": "train" }
How does the total number of amenities associated with amenity ID 901 compare to that of amenity ID 922?
dorm_1
select t1.c1 - t0.c1 from (select sum(t1.amenid) as c1 from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t0.amenid = 901 group by t0.amenid) as t1, (select t0.amenid, sum(t1.amenid) as c1 from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t0.amenid = 922 group by t...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select t1.c1 - t0.c1 from (select sum(t1.amenid) as c1 from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t0.amenid = 901 group by t0.amenid) as t1, (select t0.amenid, sum(t1.amenid) as c1 from dorm_amenity as t0 join has_amenity as t1 ...
{ "index": 3603, "split": "train" }
Among pilots aged 20 or 26, what is the description, aircraft, and winning aircraft of the most recent top-rated winning aircraft, sorted in reverse alphabetical order?
aircraft
select t0.description, t0.aircraft, t1.winning_aircraft as c0 from aircraft as t0 join match as t1 on t0.aircraft_id = t1.winning_aircraft join pilot as t2 on t1.winning_pilot = t2.pilot_id where t2.age = 20 or t2.age = 26 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": "aircraft", "sql": "select t0.description, t0.aircraft, t1.winning_aircraft as c0 from aircraft as t0 join match as t1 on t0.aircraft_id = t1.winning_aircraft join pilot as t2 on t1.winning_pilot = t2.pilot_id where t2.age = 20 or t2.age = 26 order by c0 desc limit 1" }, "styl...
{ "index": 58, "split": "train" }
Which products have been complained about by customers from states that include the letter "s" or the sequence "lo," and what are their prices and names?
customer_complaints
select t0.product_price, t0.product_name from products as t0 join complaints as t1 on t0.product_id = t1.product_id join customers as t2 on t1.customer_id = t2.customer_id where t2.state like '%s%' or t2.state like '%lo%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_complaints", "sql": "select t0.product_price, t0.product_name from products as t0 join complaints as t1 on t0.product_id = t1.product_id join customers as t2 on t1.customer_id = t2.customer_id where t2.state like '%s%' or t2.state like '%lo%'" }, "style": "rule" }
{ "index": 537, "split": "train" }
Which allergies and their types are linked to students who are either younger than or equal to the total combined age of all students, or older than or equal to the total age of female students with stuid 1001?
allergy_1
select t0.allergy, t0.allergytype from allergy_type as t0 join has_allergy as t1 on t0.allergy = t1.allergy join student as t2 on t1.stuid = t2.stuid, (select sum(age) as c2 from student) as t1, (select sum(age) as c2 from student where sex like 'F%' and stuid = 1001) as t0 where t2.age <= t1.c2 or t2.age >= t0.c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "allergy_1", "sql": "select t0.allergy, t0.allergytype from allergy_type as t0 join has_allergy as t1 on t0.allergy = t1.allergy join student as t2 on t1.stuid = t2.stuid, (select sum(age) as c2 from student) as t1, (select sum(age) as c2 from student where sex like 'F%' and stuid...
{ "index": 2190, "split": "train" }
What are the amenity IDs, dorm IDs, and dorm capacities for amenities in dorms where students from the most common city are living, and who are aged 17 or older? Please list the results sorted by amenity ID, with nulls last. This version clearly states the focus on students from the most common city, their age conditi...
dorm_1
select t0.amenid as c3, t0.dormid, t1.student_capacity 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 city_code as c1 from student group by c1 order by count(*) desc limit 1) as t0 where t3.city_code = 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": "dorm_1", "sql": "select t0.amenid as c3, t0.dormid, t1.student_capacity 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 city_code as c1 from student group by c1 order b...
{ "index": 2208, "split": "train" }
Find the login name of the course author or tutor associated with course ID 8 that appears first alphabetically by their personal name.
e_learning
select t0.login_name from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_id = 8 order by t0.personal_name 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": "e_learning", "sql": "select t0.login_name from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_id = 8 order by t0.personal_name asc nulls last limit 1" }, "style": "rule" }
{ "index": 142, "split": "train" }