question
stringlengths
1
606
db_id
stringclasses
139 values
external_knowledge
stringclasses
1 value
sql
stringlengths
19
1.35k
data_source
stringclasses
1 value
prompt
listlengths
2
2
ability
stringclasses
1 value
reward_model
dict
extra_info
dict
Which services have a service ID of 6 or less and are associated with customers who have an ID of 10 or higher?
e_government
select t0.service_name from services as t0 join party_services as t1 on t0.service_id = t1.service_id where t1.service_id <= 6 and t1.customer_id >= 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": "e_government", "sql": "select t0.service_name from services as t0 join party_services as t1 on t0.service_id = t1.service_id where t1.service_id <= 6 and t1.customer_id >= 10" }, "style": "rule" }
{ "index": 994, "split": "train" }
Which editors have worked on journal committees with work types ending in 'itle', but have not worked on any with work types starting with 'Phot'? What are their IDs, ages, and names?
journal_committee
select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.editor_id as c0, t0.age as c1, t0.name as c2 from editor as t0 join journal_committee as t1 on t0.editor_id = t1.editor_id where t1.work_type like '%itle' except select t0.editor_id as c0, t0.age as c1, t0.name as c2 from editor as t0 join journal_committee as t1 o...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "journal_committee", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.editor_id as c0, t0.age as c1, t0.name as c2 from editor as t0 join journal_committee as t1 on t0.editor_id = t1.editor_id where t1.work_type like '%itle' except select t0.editor_id as c0, t0.age a...
{ "index": 541, "split": "train" }
What are the descriptions and codes of the top five incident types with the most occurrences, where the incident type code contains "IS" or "S," along with the count of incidents for each?
behavior_monitoring
select t0.incident_type_description, t0.incident_type_code as c1, count(*) as c0 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t1.incident_type_code like '%IS%' or t1.incident_type_code like '%S%' group by c1 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": "behavior_monitoring", "sql": "select t0.incident_type_description, t0.incident_type_code as c1, count(*) as c0 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t1.incident_type_code like '%IS%' or t1.incident_type_co...
{ "index": 2648, "split": "train" }
List the first 10 scientist names in alphabetical order, with any missing names listed after the others.
scientist_1
select name as c0 from scientists order by c0 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "scientist_1", "sql": "select name as c0 from scientists order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 2998, "split": "train" }
What are the start dates of bookings and their corresponding refund amounts?
products_for_hire
select booking_start_date, amount_of_refund from bookings
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select booking_start_date, amount_of_refund from bookings" }, "style": "rule" }
{ "index": 2661, "split": "train" }
What are the team IDs, years, and the smallest number of home games played for teams in years where they had between 9 and 42 home games, sorted alphabetically by team ID, and limited to the first three entries?
baseball_1
select t0.team_id_br as c1, t0.year as c2, min(t1.games) from team as t0 join home_game as t1 on t0.team_id = t1.team_id where t1.games between 9 and 42 group by c2 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": "baseball_1", "sql": "select t0.team_id_br as c1, t0.year as c2, min(t1.games) from team as t0 join home_game as t1 on t0.team_id = t1.team_id where t1.games between 9 and 42 group by c2 order by c1 asc nulls last limit 3" }, "style": "rule" }
{ "index": 91, "split": "train" }
Which are the three most recent festivals, along with their year and location, where nominations include artworks that are either of the type 'Program Music/Variety Show' or the most common artwork type in the database?
entertainment_awards
select t0.year, t0.location, t1.festival_id as c0 from festival_detail as t0 join nomination as t1 on t0.festival_id = t1.festival_id join artwork as t2 on t1.artwork_id = t2.artwork_id, (select type as c3 from artwork group by c3 order by count(*) desc limit 1) as t0 where t2.type = 'Program Music/Variety Show' or t2....
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "entertainment_awards", "sql": "select t0.year, t0.location, t1.festival_id as c0 from festival_detail as t0 join nomination as t1 on t0.festival_id = t1.festival_id join artwork as t2 on t1.artwork_id = t2.artwork_id, (select type as c3 from artwork group by c3 order by count(*) ...
{ "index": 2760, "split": "train" }
What is the largest number of unique friends that any person has in the data?
network_2
select count(distinct (name)) as c0 from personfriend 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": "network_2", "sql": "select count(distinct (name)) as c0 from personfriend order by c0 desc limit 1" }, "style": "rule" }
{ "index": 1811, "split": "train" }
What is the percentage increase or decrease in the number of customer payments made with payment methods ending in "ct Debit" between customers born on July 17, 1995, and those born on August 29, 1996?
driving_school
select (count(t0.c1) / cast(count(t1.c1) as real) - 1) * 100 from (select t0.amount_payment as c1 from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_of_birth = '1996-08-29 00:03:08' and t0.payment_method_code like '%ct Debit') as t0, (select t0.amount_payment as c1, t0.cu...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select (count(t0.c1) / cast(count(t1.c1) as real) - 1) * 100 from (select t0.amount_payment as c1 from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_of_birth = '1996-08-29 00:03:08' and t0.payment_method_cod...
{ "index": 3031, "split": "train" }
What are the document type codes, descriptions, and response received dates for documents associated with organizations whose details begin with "tenetur"?
tracking_grants_for_research
select t0.document_type_code, t0.document_description, t1.response_received_date from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code join grants as t2 on t1.grant_id = t2.grant_id join organisations as t3 on t2.organisation_id = t3.organisation_id where t3.organisation_detail...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t0.document_type_code, t0.document_description, t1.response_received_date from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code join grants as t2 on t1.grant_id = t2.grant_id join organisation...
{ "index": 296, "split": "train" }
List the names and editor IDs of up to three editors who are associated with journals whose themes start with "at Ja", sorting the results alphabetically by the editors' names.
journal_committee
select t0.name as c1, t0.editor_id from editor as t0 join journal_committee as t1 on t0.editor_id = t1.editor_id join journal as t2 on t1.journal_id = t2.journal_id where t2.theme like 'at Ja%' 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": "journal_committee", "sql": "select t0.name as c1, t0.editor_id from editor as t0 join journal_committee as t1 on t0.editor_id = t1.editor_id join journal as t2 on t1.journal_id = t2.journal_id where t2.theme like 'at Ja%' order by c1 asc nulls last limit 3" }, "style": "rule"...
{ "index": 320, "split": "train" }
What is the percentage change in the smallest maximum railway ID for railway lines with IDs up to 7 between trains arriving at 09:48 and those arriving at 13:04?
railway
select (min(t0.c2) / cast(min(t1.c2) as real) - 1) * 100 from (select max(t1.railway_id) as c2 from railway as t0 join train as t1 on t0.railway_id = t1.railway_id where t1.arrival = '13:04' and t1.railway_id <= 7 group by t0.railway_id) as t0, (select t0.railway_id, max(t1.railway_id) as c2 from railway as t0 join tra...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "railway", "sql": "select (min(t0.c2) / cast(min(t1.c2) as real) - 1) * 100 from (select max(t1.railway_id) as c2 from railway as t0 join train as t1 on t0.railway_id = t1.railway_id where t1.arrival = '13:04' and t1.railway_id <= 7 group by t0.railway_id) as t0, (select t0.railwa...
{ "index": 3042, "split": "train" }
Can you list the ten students whose details start with "Joe," showing their IDs and details, with the details ordered from Z to A?
student_assessment
select student_id, student_details as c0 from students where c0 like 'Joe%' order by c0 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select student_id, student_details as c0 from students where c0 like 'Joe%' order by c0 desc limit 10" }, "style": "rule" }
{ "index": 432, "split": "train" }
Can you tell me the names and classes of ships that are flagged in Panama, as well as the names and classes of captains whose ships have an ID less than 5?
ship_1
select anon_1.c3, anon_1.c1 from (select name as c3, class as c1 from ship where flag = 'Panama' union select name, class from captain where ship_id < 5) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "ship_1", "sql": "select anon_1.c3, anon_1.c1 from (select name as c3, class as c1 from ship where flag = 'Panama' union select name, class from captain where ship_id < 5) as anon_1" }, "style": "rule" }
{ "index": 35, "split": "train" }
What is the organization ID associated with thing 92, minus 8?
local_govt_and_lot
select organization_id - 8 from things where thing_id = 92
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 organization_id - 8 from things where thing_id = 92" }, "style": "rule" }
{ "index": 3240, "split": "train" }
Did the log entry for problem 14 happen after the log entry for problem 5?
tracking_software_problems
select t1.c2 > t0.c2 from (select log_entry_date as c2 from problem_log where problem_log_id = 14) as t1, (select log_entry_date as c2 from problem_log where problem_log_id = 5) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t1.c2 > t0.c2 from (select log_entry_date as c2 from problem_log where problem_log_id = 14) as t1, (select log_entry_date as c2 from problem_log where problem_log_id = 5) as t0" }, "style": "rule" }
{ "index": 3970, "split": "train" }
What are the five incidents with the fewest injured people and their locations, considering perpetrators with people IDs of 3 or less or those not listed in the people database?
perpetrator
select injured as c2, location from perpetrator where people_id <= 3 or (not people_id in (select people_id as c0 from people)) order by c2 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": "perpetrator", "sql": "select injured as c2, location from perpetrator where people_id <= 3 or (not people_id in (select people_id as c0 from people)) order by c2 asc nulls last limit 5" }, "style": "rule" }
{ "index": 648, "split": "train" }
Which Customer Id that ends with "usie" appears the fewest times in the records?
customers_card_transactions
select t0.c2 as c1, count(distinct (t0.c2)) as c0 from (select customer_id as c2 from customers where customer_first_name like '%usie') as t0 group by c1 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select t0.c2 as c1, count(distinct (t0.c2)) as c0 from (select customer_id as c2 from customers where customer_first_name like '%usie') as t0 group by c1 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 3663, "split": "train" }
What are the allergy types and allergies listed in the Allergy Type table, including those associated with students who live in cities starting with "DE"?
allergy_1
select anon_1.c0, anon_1.c1 from (select allergytype as c0, allergy as c1 from allergy_type union select t0.allergytype as c0, t0.allergy as c1 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.city_code like 'DE%') 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": "allergy_1", "sql": "select anon_1.c0, anon_1.c1 from (select allergytype as c0, allergy as c1 from allergy_type union select t0.allergytype as c0, t0.allergy as c1 from allergy_type as t0 join has_allergy as t1 on t0.allergy = t1.allergy join student as t2 on t1.stuid = t2.stuid ...
{ "index": 973, "split": "train" }
Which stores are part of the least common store chain named "North," and what are their chain IDs, store IDs, and store names?
department_store
select t0.dept_store_chain_id, t0.dept_store_id, t0.store_name from department_stores as t0 join department_store_chain as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id, (select dept_store_chain_id as c0 from department_store_chain where dept_store_chain_name = 'North' group by c0 order by count(*) 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": "department_store", "sql": "select t0.dept_store_chain_id, t0.dept_store_id, t0.store_name from department_stores as t0 join department_store_chain as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id, (select dept_store_chain_id as c0 from department_store_chain where dept_st...
{ "index": 2373, "split": "train" }
For each project code, what is the total number of hours allocated to that code?
scientist_1
select code as c1, sum(hours) from projects 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": "scientist_1", "sql": "select code as c1, sum(hours) from projects group by c1" }, "style": "rule" }
{ "index": 72, "split": "train" }
What are the different grape types and their colors for wines that come from appellations with an area marked as N/A or that start with "N/"?
wine_1
select t0.grape, t0.color from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.area = 'N/A' or t2.area like 'N/%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "wine_1", "sql": "select t0.grape, t0.color from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.area = 'N/A' or t2.area like 'N/%'" }, "style": "rule" }
{ "index": 2342, "split": "train" }
What is the average staff ID for rentals of the inventory item numbered 1149 that were handled by staff members with ID 1 or less?
sakila_1
select t0.c1 from (select avg(t1.staff_id) as c1 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t0.inventory_id = 1149 and t1.staff_id <= 1 group by t0.inventory_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": "sakila_1", "sql": "select t0.c1 from (select avg(t1.staff_id) as c1 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t0.inventory_id = 1149 and t1.staff_id <= 1 group by t0.inventory_id) as t0" }, "style": "rule" }
{ "index": 3394, "split": "train" }
What is the average flight price, the number of distinct aircraft involved, and the aircraft ID for aircraft with aid equal to 5 that has the lowest average flight price?
flight_1
select avg(t0.price) as c2, count(distinct (t0.aid)), t1.aid as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where c0 = 5 group by c0 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": "flight_1", "sql": "select avg(t0.price) as c2, count(distinct (t0.aid)), t1.aid as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where c0 = 5 group by c0 order by c2 asc nulls last limit 1" }, "style": "rule" }
{ "index": 1074, "split": "train" }
What is the percentage change in the highest user ID among users with up to 94,375,428 followers who tweeted around 20:00:14 and 20:01:02 on March 9, 2018?
twitter_1
select (min(t0.c2) / cast(min(t1.c2) as real) - 1) * 100 from (select max(t1.uid) as c2 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.createdate = '2018-03-09 20:01:02' and t0.followers <= 94375428 group by t0.uid) as t0, (select t0.uid, max(t1.uid) as c2 from user_profiles as t0 join tweets as...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "twitter_1", "sql": "select (min(t0.c2) / cast(min(t1.c2) as real) - 1) * 100 from (select max(t1.uid) as c2 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.createdate = '2018-03-09 20:01:02' and t0.followers <= 94375428 group by t0.uid) as t0, (select t0.ui...
{ "index": 3064, "split": "train" }
What are the zip code, city, and state or province for addresses linked to customer orders placed before March 4, 2018?
customers_and_addresses
select t0.zip_postcode, t0.city, t0.state_province_county from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id join customers as t2 on t1.customer_id = t2.customer_id join customer_orders as t3 on t2.customer_id = t3.customer_id where t3.order_date < '2018-03-04 07:16:22'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t0.zip_postcode, t0.city, t0.state_province_county from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id join customers as t2 on t1.customer_id = t2.customer_id join customer_orders as t3 on t2.customer_id = t...
{ "index": 1885, "split": "train" }
Who are the five guests whose last names appear most frequently in reservations, and what is the average number of kids they bring?
inn_1
select lastname as c2, count(checkin), avg(kids) as c1 from reservations group by c2 order by c1 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "inn_1", "sql": "select lastname as c2, count(checkin), avg(kids) as c1 from reservations group by c2 order by c1 desc limit 5" }, "style": "rule" }
{ "index": 1770, "split": "train" }
What is the highest song ID for each file that uses one of the most common formats, considering only files that have at most four songs?
music_1
select max(t0.f_id), t1.f_id as c0 from song as t0 join files as t1 on t0.f_id = t1.f_id, (select formats as c2 from files group by c2 order by count(*) desc limit 1) as t0 where t1.formats = t0.c2 group by c0 having count(*) <= 4
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select max(t0.f_id), t1.f_id as c0 from song as t0 join files as t1 on t0.f_id = t1.f_id, (select formats as c2 from files group by c2 order by count(*) desc limit 1) as t0 where t1.formats = t0.c2 group by c0 having count(*) <= 4" }, "style": "rule" }
{ "index": 86, "split": "train" }
Does the attendance date for student 171 in course 301 occur after the same date?
student_assessment
select date_of_attendance > date_of_attendance from student_course_attendance where student_id = 171 and course_id = 301
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 date_of_attendance > date_of_attendance from student_course_attendance where student_id = 171 and course_id = 301" }, "style": "rule" }
{ "index": 3101, "split": "train" }
What is the number of days between the Date From and Date To for staff involved in projects?
tracking_grants_for_research
select julianday(t1.c3) - julianday(t0.c0) from (select date_to as c3 from project_staff) as t1, (select date_from as c0 from project_staff) 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 julianday(t1.c3) - julianday(t0.c0) from (select date_to as c3 from project_staff) as t1, (select date_from as c0 from project_staff) as t0" }, "style": "rule" }
{ "index": 3980, "split": "train" }
Which three apartment numbers and their room counts are associated with female guests (whose gender codes start with "Femal"), when listed in order of apartment number from earliest to latest?
apartment_rentals
select t0.apt_number as c1, t0.room_count from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.gender_code like 'Femal%' 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": "apartment_rentals", "sql": "select t0.apt_number as c1, t0.room_count from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.gender_code like 'Femal%' order by c1 asc nulls last limit 3" }, "style":...
{ "index": 1032, "split": "train" }
Which books have both a publication date containing the letter "u" and a publication priced at 3,000,000 or more?
book_2
select anon_1.c1, anon_1.c0 from (select t0.title as c1, t0.issues as c0 from book as t0 join publication as t1 on t0.book_id = t1.book_id where t1.publication_date like '%u%' intersect select t0.title as c1, t0.issues as c0 from book as t0 join publication as t1 on t0.book_id = t1.book_id where t1.price >= 3000000.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": "book_2", "sql": "select anon_1.c1, anon_1.c0 from (select t0.title as c1, t0.issues as c0 from book as t0 join publication as t1 on t0.book_id = t1.book_id where t1.publication_date like '%u%' intersect select t0.title as c1, t0.issues as c0 from book as t0 join publication as t1...
{ "index": 596, "split": "train" }
Has customer 14’s most recent address end date occurred after customer 2’s most recent address end date?
customers_and_products_contacts
select t1.c1 > t0.c1 from (select date_to as c1 from customer_address_history where customer_id = 14) as t1, (select date_to as c1 from customer_address_history where customer_id = 2) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select t1.c1 > t0.c1 from (select date_to as c1 from customer_address_history where customer_id = 14) as t1, (select date_to as c1 from customer_address_history where customer_id = 2) as t0" }, "style": "rule" }
{ "index": 3077, "split": "train" }
Is the number of unique documents of type 'CD' greater than the highest number of unique documents among all document types whose descriptions contain the letter "f"?
cre_Doc_Control_Systems
select t2.c3 > t1.c0 from (select count(distinct (t1.document_id)) as c3 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'CD' group by t0.document_type_code) as t2, (select max(t0.c3) as c0 from (select count(distinct (t1.document_id)) as...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Control_Systems", "sql": "select t2.c3 > t1.c0 from (select count(distinct (t1.document_id)) as c3 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'CD' group by t0.document_type_code) as t2,...
{ "index": 3266, "split": "train" }
What are the names of the top three trains with train ID 8, listed in reverse alphabetical order?
station_weather
select t0.name as c0 from train as t0 join route as t1 on t0.id = t1.train_id where t1.train_id = 8 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": "station_weather", "sql": "select t0.name as c0 from train as t0 join route as t1 on t0.id = t1.train_id where t1.train_id = 8 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 986, "split": "train" }
Which users with user IDs of 5 or higher have posted tweets since March 9, 2018, 8:00:14 PM, and what are their names and follower counts?
twitter_1
select t0.name, t0.followers from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.createdate >= '2018-03-09 20:00:14' and t1.uid >= 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": "twitter_1", "sql": "select t0.name, t0.followers from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.createdate >= '2018-03-09 20:00:14' and t1.uid >= 5" }, "style": "rule" }
{ "index": 443, "split": "train" }
What is the date of birth and the highest amount outstanding for the customer whose amount outstanding is the most among those with a phone number containing "7"?
driving_school
select t0.date_of_birth, t0.amount_outstanding as c1 from customers as t0, (select max(amount_outstanding) as c3 from customers where phone_number like '%7%') as t1 where c1 = 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": "driving_school", "sql": "select t0.date_of_birth, t0.amount_outstanding as c1 from customers as t0, (select max(amount_outstanding) as c3 from customers where phone_number like '%7%') as t1 where c1 = t1.c3" }, "style": "rule" }
{ "index": 3766, "split": "train" }
What are the names of up to five subjects associated with courses that include "se" in their course names, ordered by the author ID, with any courses missing an author ID listed last?
e_learning
select t0.subject_name from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.course_name like '%se%' order by t1.author_id asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.subject_name from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.course_name like '%se%' order by t1.author_id asc nulls last limit 5" }, "style": "rule" }
{ "index": 894, "split": "train" }
How many project IDs are associated with researchers whose roles ended on or before July 28, 2004, compared to all researchers? In other words, what is the difference between the total project IDs linked to these researchers and the total for all researchers?
tracking_grants_for_research
select t1.c2 - t0.c2 from (select sum(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' and t1.date_to <= '2004-07-28 03:11:47' group by t0.role_code) as t1, (select t0.role_code, sum(t1.project_id) as c2 from staff_roles as t0 join pro...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t1.c2 - t0.c2 from (select sum(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' and t1.date_to <= '2004-07-28 03:11:47' group by t0.role_code) as t1,...
{ "index": 3628, "split": "train" }
Can you list the Paper IDs and titles of all papers, including those authored by researchers affiliated with the institution that has instid 1050?
icfp_1
select anon_1.c1, anon_1.c0 from (select paperid as c1, title as c0 from papers union select t0.paperid as c1, t0.title as c0 from papers as t0 join authorship as t1 on t0.paperid = t1.paperid join inst as t2 on t1.instid = t2.instid where t2.instid = 1050) 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": "icfp_1", "sql": "select anon_1.c1, anon_1.c0 from (select paperid as c1, title as c0 from papers union select t0.paperid as c1, t0.title as c0 from papers as t0 join authorship as t1 on t0.paperid = t1.paperid join inst as t2 on t1.instid = t2.instid where t2.instid = 1050) as an...
{ "index": 641, "split": "train" }
Which movies have been rated both during the week of January 20 to January 27, 2011, and also on or before January 9, 2011? What are their directors, titles, and release years?
movie_1
select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.director as c2, t0.title as c0, t0.year as c1 from movie as t0 join rating as t1 on t0.mid = t1.mid where t1.ratingdate between '2011-01-20 00:00:00' and '2011-01-27 00:00:00' intersect select t0.director as c2, t0.title as c0, t0.year as c1 from movie as t0 join r...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "movie_1", "sql": "select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.director as c2, t0.title as c0, t0.year as c1 from movie as t0 join rating as t1 on t0.mid = t1.mid where t1.ratingdate between '2011-01-20 00:00:00' and '2011-01-27 00:00:00' intersect select t0.director as...
{ "index": 2907, "split": "train" }
When was the move-in date for the customer with the highest customer ID associated with customer event ID 530?
local_govt_and_lot
select t0.date_moved_in, t0.customer_id as c3 from customer_events as t0, (select max(customer_id) as c0 from customer_events where customer_event_id = 530) as t1 where c3 = t1.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t0.date_moved_in, t0.customer_id as c3 from customer_events as t0, (select max(customer_id) as c0 from customer_events where customer_event_id = 530) as t1 where c3 = t1.c0" }, "style": "rule" }
{ "index": 3785, "split": "train" }
Which names appear in either the list of repair activities or the list of technicians?
machine_repair
select anon_1.c0 from (select name as c0 from repair union select name from technician) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "machine_repair", "sql": "select anon_1.c0 from (select name as c0 from repair union select name from technician) as anon_1" }, "style": "rule" }
{ "index": 2716, "split": "train" }
Among players born in years that include a '0', when was the highest weight recorded, and which players had it?
soccer_1
select t0.birthday, t0.weight as c2 from player as t0, (select max(weight) as c3 from player where birthday like '%0%') 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 where birthday like '%0%') as t1 where c2 = t1.c3" }, "style": "rule" }
{ "index": 3958, "split": "train" }
Can you provide the details and IDs of organizations that offer service 47 or the service that is provided by the fewest organizations?
local_govt_and_lot
select t0.organization_details from organizations as t0 join services as t1 on t0.organization_id = t1.organization_id, (select service_id as c0 from services group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.service_id = 47 or t1.service_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": "local_govt_and_lot", "sql": "select t0.organization_details from organizations as t0 join services as t1 on t0.organization_id = t1.organization_id, (select service_id as c0 from services group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.service_id = 47 or t1.s...
{ "index": 2872, "split": "train" }
Is the percentage change in the maximum purchase transaction amount between December 30, 1997, and August 13, 1977, for 'PUR' transactions greater than the average percentage change across all transaction types for investors with IDs 8 or higher?
tracking_share_transactions
select t5.c1 > t2.c0 from (select abs((t3.c3 / cast(t4.c3 as real) - 1) * 100) as c1 from (select max(t1.amount_of_transaction) as c3 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'PUR' and t1.date_of_transaction = '1977-...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t5.c1 > t2.c0 from (select abs((t3.c3 / cast(t4.c3 as real) - 1) * 100) as c1 from (select max(t1.amount_of_transaction) as c3 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_c...
{ "index": 3905, "split": "train" }
What are the formation date, name, ID, and UK VAT number of organizations that are not associated with any contact individuals whose first name includes "tte"?
e_government
select anon_1.c0, anon_1.c2, anon_1.c1, anon_1.c3 from (select date_formed as c0, organization_name as c2, organization_id as c1, uk_vat_number as c3 from organizations except select t0.date_formed as c0, t0.organization_name as c2, t0.organization_id as c1, t0.uk_vat_number as c3 from organizations as t0 join organiza...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c2, anon_1.c1, anon_1.c3 from (select date_formed as c0, organization_name as c2, organization_id as c1, uk_vat_number as c3 from organizations except select t0.date_formed as c0, t0.organization_name as c2, t0.organization_id as c1...
{ "index": 2204, "split": "train" }
How many days have passed between the Date From and Date To for the staff members involved in projects?
tracking_grants_for_research
select julianday(t1.c3) - julianday(t0.c0) from (select date_to as c3 from project_staff) as t1, (select date_from as c0 from project_staff) 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 julianday(t1.c3) - julianday(t0.c0) from (select date_to as c3 from project_staff) as t1, (select date_from as c0 from project_staff) as t0" }, "style": "rule" }
{ "index": 3845, "split": "train" }
Which student with the highest student ID is enrolled in course 305, and what is their student ID?
student_assessment
select t0.course_id, t1.student_id as c0 from courses as t0 join student_course_registrations as t1 on t0.course_id = t1.course_id where t1.course_id = 305 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": "student_assessment", "sql": "select t0.course_id, t1.student_id as c0 from courses as t0 join student_course_registrations as t1 on t0.course_id = t1.course_id where t1.course_id = 305 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 945, "split": "train" }
What are the disciplines, undergraduate enrollment numbers, campus years, and locations for campuses that have between 78.1 and 1363.5 faculty members?
csu_1
select t0.discipline, t0.undergraduate, t1.year, t1.location from discipline_enrollments as t0 join campuses as t1 on t0.campus = t1.id join faculty as t2 on t1.id = t2.campus where t2.faculty between 78.1 and 1363.5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "csu_1", "sql": "select t0.discipline, t0.undergraduate, t1.year, t1.location from discipline_enrollments as t0 join campuses as t1 on t0.campus = t1.id join faculty as t2 on t1.id = t2.campus where t2.faculty between 78.1 and 1363.5" }, "style": "rule" }
{ "index": 953, "split": "train" }
Can you list the subject ID, course description, and subject name for up to three courses where the subject name ends with "rts"? Among these, only include courses associated with the subject ID 2, selecting the one with the least occurrence if multiple options are available, and sort the results by subject name in alp...
e_learning
select t0.subject_id, t0.course_description, t1.subject_name as c3 from courses as t0 join subjects as t1 on t0.subject_id = t1.subject_id, (select subject_id as c0 from subjects where c0 = 2 or c0 = 2 group by c0 order by count(*) asc nulls last limit 1) as t0 where c3 like '%rts' and t1.subject_id = t0.c0 order 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": "e_learning", "sql": "select t0.subject_id, t0.course_description, t1.subject_name as c3 from courses as t0 join subjects as t1 on t0.subject_id = t1.subject_id, (select subject_id as c0 from subjects where c0 = 2 or c0 = 2 group by c0 order by count(*) asc nulls last limit 1) as ...
{ "index": 807, "split": "train" }
Which ten products with IDs less than 14 and order item ID 1 have the fewest unique product IDs and names, and what are those counts?
tracking_orders
select count(distinct (t0.product_id)) as c1, count(distinct (t0.product_name)) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id < 14 and t1.order_item_id = 1 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": "tracking_orders", "sql": "select count(distinct (t0.product_id)) as c1, count(distinct (t0.product_name)) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id < 14 and t1.order_item_id = 1 order by c1 asc nulls last limit 10" }, "sty...
{ "index": 1030, "split": "train" }
What are the start dates, policy type codes, policy IDs, and customer IDs for policies that belong to the customer named "Dayana Robel"?
insurance_and_eClaims
select anon_1.c1, anon_1.c3, anon_1.c2, anon_1.c0 from (select start_date as c1, policy_type_code as c3, policy_id as c2, customer_id as c0 from policies intersect select t0.start_date as c1, t0.policy_type_code as c3, t0.policy_id as c2, t0.customer_id as c0 from policies as t0 join customers as t1 on t0.customer_id =...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_and_eClaims", "sql": "select anon_1.c1, anon_1.c3, anon_1.c2, anon_1.c0 from (select start_date as c1, policy_type_code as c3, policy_id as c2, customer_id as c0 from policies intersect select t0.start_date as c1, t0.policy_type_code as c3, t0.policy_id as c2, t0.custom...
{ "index": 2064, "split": "train" }
Which is the first institution ID when listing protein names alphabetically, considering only proteins with non-null names?
protein_institute
select institution_id from protein order by protein_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": "protein_institute", "sql": "select institution_id from protein order by protein_name asc nulls last limit 1" }, "style": "rule" }
{ "index": 2257, "split": "train" }
What are the IDs, names, cities, and opening years of stadiums where swimmers with a 200-meter time ending in "21" have participated?
swimming
select anon_1.c1, anon_1.c2, anon_1.c3, anon_1.c0 from (select id as c1, name as c2, city as c3, opening_year as c0 from stadium intersect select t0.id as c1, t0.name as c2, t0.city as c3, t0.opening_year as c0 from stadium as t0 join event as t1 on t0.id = t1.stadium_id join record as t2 on t1.id = t2.event_id join sw...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "swimming", "sql": "select anon_1.c1, anon_1.c2, anon_1.c3, anon_1.c0 from (select id as c1, name as c2, city as c3, opening_year as c0 from stadium intersect select t0.id as c1, t0.name as c2, t0.city as c3, t0.opening_year as c0 from stadium as t0 join event as t1 on t0.id = t1....
{ "index": 1719, "split": "train" }
What is the percentage change in the total number of customers who filed "Product Unusabl" complaints for product 118 between August 6, 1977, and October 14, 2007?
customer_complaints
select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select sum(t1.customer_id) as c1 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.date_complaint_raised = '1977-08-06 00:31:19' and t1.complaint_type_code like 'Product Unusabl%' group by t0.product_id) as t0...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_complaints", "sql": "select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select sum(t1.customer_id) as c1 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.date_complaint_raised = '1977-08-06 00:31:19' and t1.com...
{ "index": 3831, "split": "train" }
What are the artist IDs and the count of their distinct ages for artists whose famous release date is June 15, 2009, or any date in 2009?
music_4
select artist_id as c1, count(distinct (age)) from artist where famous_release_date = 'June 15, 2009' or famous_release_date = 2009 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": "music_4", "sql": "select artist_id as c1, count(distinct (age)) from artist where famous_release_date = 'June 15, 2009' or famous_release_date = 2009 group by c1" }, "style": "rule" }
{ "index": 2798, "split": "train" }
Find the maximum page size, pages per minute color, product ID, and store name for products sold in districts with a population under 365,198.
store_product
select t0.max_page_size, t0.pages_per_minute_color, t0.product_id, t2.store_name from product as t0 join store_product as t1 on t0.product_id = t1.product_id join store as t2 on t1.store_id = t2.store_id join store_district as t3 on t2.store_id = t3.store_id join district as t4 on t3.district_id = t4.district_id where ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.max_page_size, t0.pages_per_minute_color, t0.product_id, t2.store_name from product as t0 join store_product as t1 on t0.product_id = t1.product_id join store as t2 on t1.store_id = t2.store_id join store_district as t3 on t2.store_id = t3.store_...
{ "index": 2800, "split": "train" }
Can you find the top three orders with the most detailed information, including the order details, order ID, customer's last name, and customer ID, for orders associated with customers whose accounts were either opened on or after mid-August 2014 or before late December 2014? List these orders sorted by the order detai...
customers_and_invoices
select t0.order_details as c0, t0.order_id, t0.customer_id, t1.customer_last_name from orders as t0 join customers as t1 on t0.customer_id = t1.customer_id join accounts as t2 on t1.customer_id = t2.customer_id where t2.date_account_opened >= '2014-08-11 18:15:14' or t2.date_account_opened < '2014-12-28 07:29:42' order...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t0.order_details as c0, t0.order_id, t0.customer_id, t1.customer_last_name from orders as t0 join customers as t1 on t0.customer_id = t1.customer_id join accounts as t2 on t1.customer_id = t2.customer_id where t2.date_account_opened >= '201...
{ "index": 990, "split": "train" }
Can you tell me the number of unique flight distances recorded for each aircraft with a maximum distance under 4103, along with that aircraft's distance and ID, sorted from the highest to the lowest aircraft ID?
flight_1
select count(distinct (t0.distance)), t1.distance as c2, t1.aid as c1 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where c2 < 4103 group by c1 order by c1 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_1", "sql": "select count(distinct (t0.distance)), t1.distance as c2, t1.aid as c1 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where c2 < 4103 group by c1 order by c1 desc" }, "style": "rule" }
{ "index": 2317, "split": "train" }
Which are the cell mobile phone numbers and customer IDs of the ten most recent customers, along with the count of their distinct payment amounts that are either less than or equal to 9,570.93 or exactly 1,708.18?
driving_school
select t0.cell_mobile_phone_number, t0.customer_id as c2, count(distinct (t1.amount_payment)) from customers as t0 join customer_payments as t1 on t0.customer_id = t1.customer_id where t1.amount_payment <= 9570.93 or t1.amount_payment = 1708.18 group by c2 order by t0.date_became_customer desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select t0.cell_mobile_phone_number, t0.customer_id as c2, count(distinct (t1.amount_payment)) from customers as t0 join customer_payments as t1 on t0.customer_id = t1.customer_id where t1.amount_payment <= 9570.93 or t1.amount_payment = 1708.18 group by c...
{ "index": 454, "split": "train" }
How much less than 12 is customer ID 8?
customers_and_invoices
select t0.c0 - 12 from (select sum(t1.customer_id) as c0 from customers as t0 join accounts as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 8 group by t0.customer_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t0.c0 - 12 from (select sum(t1.customer_id) as c0 from customers as t0 join accounts as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 8 group by t0.customer_id) as t0" }, "style": "rule" }
{ "index": 3225, "split": "train" }
What is the average customer ID for the booking with ID 1?
products_for_hire
select t0.c1 from (select avg(t1.customer_id) as c1 from bookings as t0 join payments as t1 on t0.booking_id = t1.booking_id where t0.booking_id = 1 group by t0.booking_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select t0.c1 from (select avg(t1.customer_id) as c1 from bookings as t0 join payments as t1 on t0.booking_id = t1.booking_id where t0.booking_id = 1 group by t0.booking_id) as t0" }, "style": "rule" }
{ "index": 3391, "split": "train" }
What are the grape type, its color, and the vintage year of the most recently produced wine from appellation number 21?
wine_1
select t0.grape, t0.color, t1.year as c1 from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.no = 21 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": "wine_1", "sql": "select t0.grape, t0.color, t1.year as c1 from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.no = 21 order by c1 desc limit 1" }, "style": "rule" }
{ "index": 1046, "split": "train" }
What is the difference in the number of stories between the building with ID 6 and the building with ID 2?
company_office
select t1.c2 - t0.c2 from (select stories as c2 from buildings where id = 2) as t1, (select stories as c2 from buildings where id = 6) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select t1.c2 - t0.c2 from (select stories as c2 from buildings where id = 2) as t1, (select stories as c2 from buildings where id = 6) as t0" }, "style": "rule" }
{ "index": 3590, "split": "train" }
What are the descriptions of the functional areas associated with documents that have a code ending in "8"?
document_management
select t0.functional_area_description from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t1.document_code like '%8'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "document_management", "sql": "select t0.functional_area_description from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t1.document_code like '%8'" }, "style": "rule" }
{ "index": 2290, "split": "train" }
What are the first 10 airline names that operate route 24405, listed in alphabetical order?
flight_4
select t0.name as c0 from airlines as t0 join routes as t1 on t0.alid = t1.alid where t1.rid = 24405 order by c0 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t0.name as c0 from airlines as t0 join routes as t1 on t0.alid = t1.alid where t1.rid = 24405 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 361, "split": "train" }
What are the amenity IDs and dorm IDs for amenities in the dorms where students with majors less than 520 are living?
dorm_1
select t0.amenid, t0.dormid 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 where t3.major < 520
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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, t0.dormid 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 where t3.major < 520" }, "style": "rule" }
{ "index": 1914, "split": "train" }
Which are the five airports that have the most outgoing routes originating from source airport codes containing the letter "R," and for each, what is the year, airport ID, and the number of destination airports they connect to?
flight_4
select t0.y, t0.apid as c0, count(t1.dst_apid) as c2 from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.src_ap like '%R%' group by c0 order by c2 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": "flight_4", "sql": "select t0.y, t0.apid as c0, count(t1.dst_apid) as c2 from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.src_ap like '%R%' group by c0 order by c2 desc limit 5" }, "style": "rule" }
{ "index": 1418, "split": "train" }
How many days passed between a student's enrollment date (with registration ID 10) and their course completion date?
e_learning
select julianday(t1.c0) - julianday(t0.c1) from (select date_of_completion as c0 from student_course_enrolment) as t1, (select date_of_enrolment as c1 from student_course_enrolment where registration_id = 10 and registration_id = 10) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select julianday(t1.c0) - julianday(t0.c1) from (select date_of_completion as c0 from student_course_enrolment) as t1, (select date_of_enrolment as c1 from student_course_enrolment where registration_id = 10 and registration_id = 10) as t0" }, "style": "r...
{ "index": 3953, "split": "train" }
Can you tell me, for each stadium whose average attendance is either between 70,795 and 72,620 or less than or equal to the total number of distinct average attendance figures across all stadiums, how many unique seasons have been played there, what the highest stadium ID is, and what the total attendance and stadium I...
game_injury
select count(distinct (t0.season)), max(t0.stadium_id), t1.total_attendance, t1.id as c2 from game as t0 join stadium as t1 on t0.stadium_id = t1.id, (select count(distinct (average_attendance)) as c0 from stadium) as t0 where t1.average_attendance between 70795.0 and 72620.0 or t1.average_attendance <= t0.c0 group by ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_injury", "sql": "select count(distinct (t0.season)), max(t0.stadium_id), t1.total_attendance, t1.id as c2 from game as t0 join stadium as t1 on t0.stadium_id = t1.id, (select count(distinct (average_attendance)) as c0 from stadium) as t0 where t1.average_attendance between 7...
{ "index": 2544, "split": "train" }
Could you tell me the effective dates that appear in either the settlements or the claims records?
insurance_fnol
select anon_1.c1 from (select effective_date as c1 from settlements union select effective_date from claims) 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": "insurance_fnol", "sql": "select anon_1.c1 from (select effective_date as c1 from settlements union select effective_date from claims) as anon_1" }, "style": "rule" }
{ "index": 0, "split": "train" }
Can you provide the stadium ID, season, home team, and date for all games played in stadiums that have hosted at least 8 home games?
game_injury
select anon_1.c0, anon_1.c1, anon_1.c2, anon_1.c3 from (select stadium_id as c0, season as c1, home_team as c2, date as c3 from game intersect select t0.stadium_id as c0, t0.season as c1, t0.home_team as c2, t0.date as c3 from game as t0 join stadium as t1 on t0.stadium_id = t1.id where t1.home_games >= 8) 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": "game_injury", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2, anon_1.c3 from (select stadium_id as c0, season as c1, home_team as c2, date as c3 from game intersect select t0.stadium_id as c0, t0.season as c1, t0.home_team as c2, t0.date as c3 from game as t0 join stadium as t1 o...
{ "index": 2439, "split": "train" }
Did the player with ID 2734 have a birthday earlier than the player with ID 4399?
soccer_1
select t1.c1 < t0.c1 from (select birthday as c1 from player where id = 2734) as t1, (select birthday as c1 from player where id = 4399) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select t1.c1 < t0.c1 from (select birthday as c1 from player where id = 2734) as t1, (select birthday as c1 from player where id = 4399) as t0" }, "style": "rule" }
{ "index": 3143, "split": "train" }
What are the Park ID, Year, Attendance, Number of Games, and Team ID for all home games held in the state that has the fewest parks?
baseball_1
select anon_1.c3, anon_1.c4, anon_1.c0, anon_1.c1, anon_1.c2 from (select park_id as c3, year as c4, attendance as c0, games as c1, team_id as c2 from home_game union select t0.park_id as c3, t0.year as c4, t0.attendance as c0, t0.games as c1, t0.team_id as c2 from home_game as t0 join park as t1 on t0.park_id = t1.par...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "baseball_1", "sql": "select anon_1.c3, anon_1.c4, anon_1.c0, anon_1.c1, anon_1.c2 from (select park_id as c3, year as c4, attendance as c0, games as c1, team_id as c2 from home_game union select t0.park_id as c3, t0.year as c4, t0.attendance as c0, t0.games as c1, t0.team_id as c...
{ "index": 656, "split": "train" }
What are the document IDs and copy numbers of all draft copies, including those specifically associated with document ID 12?
cre_Doc_Control_Systems
select anon_1.c0, anon_1.c1 from (select document_id as c0, copy_number as c1 from draft_copies union select t0.document_id as c0, t0.copy_number as c1 from draft_copies as t0 join document_drafts as t1 on t0.document_id = t1.document_id where t1.document_id = 12) 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": "cre_Doc_Control_Systems", "sql": "select anon_1.c0, anon_1.c1 from (select document_id as c0, copy_number as c1 from draft_copies union select t0.document_id as c0, t0.copy_number as c1 from draft_copies as t0 join document_drafts as t1 on t0.document_id = t1.document_id where t1...
{ "index": 2019, "split": "train" }
What are the airline IDs and route IDs for routes that start at airports located north of approximately 10.28 degrees latitude?
flight_4
select t0.alid, t0.rid from routes as t0 join airports as t1 on t0.src_apid = t1.apid where t1.y > 10.27869987487793
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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, t0.rid from routes as t0 join airports as t1 on t0.src_apid = t1.apid where t1.y > 10.27869987487793" }, "style": "rule" }
{ "index": 1075, "split": "train" }
Which five grape colors have the fewest different grape varieties?
wine_1
select color as c0, count(distinct (grape)) as c1 from grapes group by c0 order by c1 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "wine_1", "sql": "select color as c0, count(distinct (grape)) as c1 from grapes group by c0 order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 1093, "split": "train" }
Who are the friends who are over 26 years old, and which cities do they come from?
network_2
select t0.friend, t1.city from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.age > 26
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select t0.friend, t1.city from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.age > 26" }, "style": "rule" }
{ "index": 2002, "split": "train" }
Which device details—specifically the carrier, device model, and software platform—as well as their device IDs, are available in stock at shop 2 located in the least common (rarest) shop location?
device
select t0.carrier, t0.device, t0.software_platform, t1.device_id from device as t0 join stock as t1 on t0.device_id = t1.device_id join shop as t2 on t1.shop_id = t2.shop_id, (select location as c4 from shop group by c4 order by count(*) asc nulls last limit 1) as t0 where t2.shop_id = 2 and t2.location = t0.c4
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "device", "sql": "select t0.carrier, t0.device, t0.software_platform, t1.device_id from device as t0 join stock as t1 on t0.device_id = t1.device_id join shop as t2 on t1.shop_id = t2.shop_id, (select location as c4 from shop group by c4 order by count(*) asc nulls last limit 1) a...
{ "index": 442, "split": "train" }
Which guests have both bookings with the status code that has the lowest average apartment ID and bookings with a status code starting with "P"? Please provide their date of birth and guest ID. --- This version clarifies the dual conditions and maintains all technical details needed to reconstruct the SQL query.
apartment_rentals
select anon_1.c0, anon_1.c2 from (select t0.date_of_birth as c0, t0.guest_id as c2 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id, (select booking_status_code as c1 from apartment_bookings group by c1 order by avg(apt_id) asc nulls last limit 1) as t1 where t1.booking_status_code = t1.c1 i...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select anon_1.c0, anon_1.c2 from (select t0.date_of_birth as c0, t0.guest_id as c2 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id, (select booking_status_code as c1 from apartment_bookings group by c1 order by avg(apt_id) ...
{ "index": 2399, "split": "train" }
What are the product IDs, order IDs, and quantities ordered for each item in the orders?
customers_and_addresses
select product_id, order_id, order_quantity from order_items
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 product_id, order_id, order_quantity from order_items" }, "style": "rule" }
{ "index": 1256, "split": "train" }
Which departments that have fewer than five students with names containing "ei" are located in certain buildings, and what are their budgets and department names?
college_2
select t0.building, t0.budget, t0.dept_name as c1 from department as t0 join student as t1 on t0.dept_name = t1.dept_name where t1.name like '%ei%' group by c1 having count(*) < 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_2", "sql": "select t0.building, t0.budget, t0.dept_name as c1 from department as t0 join student as t1 on t0.dept_name = t1.dept_name where t1.name like '%ei%' group by c1 having count(*) < 5" }, "style": "rule" }
{ "index": 2658, "split": "train" }
What's the highest person ID for person 171 with addresses numbered between 9 and 92?
student_assessment
select t0.c0 from (select max(t1.person_id) as c0 from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id where t0.person_id = 171 and t1.address_id between 9 and 92 group by t0.person_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": "student_assessment", "sql": "select t0.c0 from (select max(t1.person_id) as c0 from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id where t0.person_id = 171 and t1.address_id between 9 and 92 group by t0.person_id) as t0" }, "style": "rule" }
{ "index": 3401, "split": "train" }
What are the first 10 customer names with customer ID 5, sorted alphabetically by their name?
small_bank_1
select t0.name as c0 from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.custid = 5 order by c0 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select t0.name as c0 from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.custid = 5 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 1251, "split": "train" }
What are the role descriptions and role codes for staff roles, and what are the role codes of project staff involved with organizations whose type description is 'Research' or ends with 'nsor'?
tracking_grants_for_research
select t0.role_description, t0.role_code, t1.role_code from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code join projects as t2 on t1.project_id = t2.project_id join organisations as t3 on t2.organisation_id = t3.organisation_id join organisation_types as t4 on t3.organisation_type = t4.organi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.role_description, t0.role_code, t1.role_code from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code join projects as t2 on t1.project_id = t2.project_id join organisations as t3 on t2.organisation_id = t3.or...
{ "index": 2601, "split": "train" }
What are the hardware colours and pixel resolutions of the display modes used by phones with chip models that have less than 48 MiB of ROM, along with their accreditation types?
phone_1
select t0.hardware_colours, t0.pixels, t1.accreditation_type from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode join chip_model as t2 on t1.chip_model = t2.model_name where t2.rom_mib < 48.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": "phone_1", "sql": "select t0.hardware_colours, t0.pixels, t1.accreditation_type from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode join chip_model as t2 on t1.chip_model = t2.model_name where t2.rom_mib < 48.0" }, "style": "rule" }
{ "index": 1013, "split": "train" }
Was the invoice date for invoice 312 earlier than the invoice date for invoice 363?
store_1
select t1.c2 < t0.c2 from (select invoice_date as c2 from invoices where id = 312) as t1, (select invoice_date as c2 from invoices where id = 363) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t1.c2 < t0.c2 from (select invoice_date as c2 from invoices where id = 312) as t1, (select invoice_date as c2 from invoices where id = 363) as t0" }, "style": "rule" }
{ "index": 3147, "split": "train" }
Is the percentage change in the average project ID for researchers with a start date before or on April 24, 1989, between 2016 and 2004 greater than the smallest percentage change observed across all staff roles during the same period?
tracking_grants_for_research
select t5.c2 > t2.c3 from (select abs((t3.c1 / cast(t4.c1 as real) - 1) * 100) as c2 from (select avg(t1.project_id) as c1 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'researcher' and t1.date_to = '2004-07-28 03:11:47' and t1.date_from <= '1989-04-24 23:51:54' gro...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t5.c2 > t2.c3 from (select abs((t3.c1 / cast(t4.c1 as real) - 1) * 100) as c2 from (select avg(t1.project_id) as c1 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'researcher' and t...
{ "index": 3449, "split": "train" }
Can you list the directors, film IDs, and studios for films that have market estimations ending with "e murder" and also have a film ID of 2 or higher?
film_rank
select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.director as c0, t0.film_id as c1, t0.studio as c2 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id where t1.type like '%e murder' intersect select t0.director as c0, t0.film_id as c1, t0.studio as c2 from film as t0 join film_market_esti...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "film_rank", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.director as c0, t0.film_id as c1, t0.studio as c2 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id where t1.type like '%e murder' intersect select t0.director as c0, t0.film_id ...
{ "index": 258, "split": "train" }
What are the titles, worldwide gross earnings, and IDs of movies that are associated with companies whose names contain the letter "o" or with the most frequently appearing company name in the database?
culture_company
select t0.title, t0.gross_worldwide from movie as t0 join culture_company as t1 on t0.movie_id = t1.movie_id, (select company_name as c1 from culture_company group by c1 order by count(*) desc limit 1) as t0 where t1.company_name like '%o%' or t1.company_name = t0.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "culture_company", "sql": "select t0.title, t0.gross_worldwide from movie as t0 join culture_company as t1 on t0.movie_id = t1.movie_id, (select company_name as c1 from culture_company group by c1 order by count(*) desc limit 1) as t0 where t1.company_name like '%o%' or t1.company...
{ "index": 1880, "split": "train" }
Which devices, along with their device IDs, are available in shops that opened in or after 2007 and have the most common opening date among shops whose names start with "Apple"? For each device, also include the corresponding stock quantity at those shops. --- This phrasing clearly communicates the same requirements ...
device
select t0.device, t0.device_id, t1.device_id, t1.quantity from device as t0 join stock as t1 on t0.device_id = t1.device_id join shop as t2 on t1.shop_id = t2.shop_id, (select open_date as c0 from shop where shop_name like 'Apple%' group by c0 order by count(*) desc limit 1) as t0 where t2.open_year >= 2007 and t2.open...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "device", "sql": "select t0.device, t0.device_id, t1.device_id, t1.quantity from device as t0 join stock as t1 on t0.device_id = t1.device_id join shop as t2 on t1.shop_id = t2.shop_id, (select open_date as c0 from shop where shop_name like 'Apple%' group by c0 order by count(*) d...
{ "index": 499, "split": "train" }
How many days have passed between the publication date and the date of the latest revision for the catalog with ID 2?
product_catalog
select julianday(t1.c3) - julianday(t0.c2) from (select date_of_publication as c3 from catalogs where catalog_id = 2 and catalog_id = 2) as t1, (select date_of_latest_revision as c2 from catalogs) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select julianday(t1.c3) - julianday(t0.c2) from (select date_of_publication as c3 from catalogs where catalog_id = 2 and catalog_id = 2) as t1, (select date_of_latest_revision as c2 from catalogs) as t0" }, "style": "rule" }
{ "index": 3732, "split": "train" }
What are the address, rating, and restaurant ID of restaurants visited by male students?
restaurant_1
select t0.address, t0.rating, t0.resid from restaurant as t0 join visits_restaurant as t1 on t0.resid = t1.resid join student as t2 on t1.stuid = t2.stuid where t2.sex like '%M'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "restaurant_1", "sql": "select t0.address, t0.rating, t0.resid from restaurant as t0 join visits_restaurant as t1 on t0.resid = t1.resid join student as t2 on t1.stuid = t2.stuid where t2.sex like '%M'" }, "style": "rule" }
{ "index": 2040, "split": "train" }
What are the department names, course titles, and course IDs for courses that have prerequisites with IDs starting with "735"?
college_2
select distinct t0.dept_name, t0.title, t0.course_id from course as t0 join prereq as t1 on t0.course_id = t1.prereq_id where t1.prereq_id like '735%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct t0.dept_name, t0.title, t0.course_id from course as t0 join prereq as t1 on t0.course_id = t1.prereq_id where t1.prereq_id like '735%'" }, "style": "rule" }
{ "index": 2499, "split": "train" }
What are the song titles and issue dates from the volume records, excluding entries by the artist with the most appearances among those whose famous release date ends with "3, 2008" or begins with "June 15, 20"?
music_4
select anon_1.c1, anon_1.c0 from (select song as c1, issue_date as c0 from volume except select t0.song as c1, t0.issue_date as c0 from volume as t0 join artist as t1 on t0.artist_id = t1.artist_id, (select artist_id as c2 from artist where famous_release_date like '%3, 2008' or famous_release_date like 'June 15, 20%' ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_4", "sql": "select anon_1.c1, anon_1.c0 from (select song as c1, issue_date as c0 from volume except select t0.song as c1, t0.issue_date as c0 from volume as t0 join artist as t1 on t0.artist_id = t1.artist_id, (select artist_id as c2 from artist where famous_release_date l...
{ "index": 146, "split": "train" }
What is the average savings balance for the customer with custid 4, and what are their name and customer ID?
small_bank_1
select avg(t0.balance), t1.name, t1.custid as c0 from savings as t0 join accounts as t1 on t0.custid = t1.custid where c0 = 4 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": "small_bank_1", "sql": "select avg(t0.balance), t1.name, t1.custid as c0 from savings as t0 join accounts as t1 on t0.custid = t1.custid where c0 = 4 group by c0" }, "style": "rule" }
{ "index": 1985, "split": "train" }
For accounts whose names start with "234," what is the total number of card transactions, the number of unique accounts involved in those transactions, and the account ID of the account with the highest ID?
customers_card_transactions
select count(t0.card_id), count(distinct (t0.account_id)), t1.account_id as c0 from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.account_name like '234%' group by c0 order by c0 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select count(t0.card_id), count(distinct (t0.account_id)), t1.account_id as c0 from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.account_name like '234%' group by c0 order by c0 desc limit 1" },...
{ "index": 2728, "split": "train" }
Calculate the number of days between the acquisition date and the disposal date for assets made by companies whose make ends with "R".?
assets_maintenance
select julianday(t1.c3) - julianday(t0.c2) from (select asset_acquired_date as c3 from assets where asset_make like '%R' and asset_make like '%R') as t1, (select asset_disposed_date as c2 from assets) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select julianday(t1.c3) - julianday(t0.c2) from (select asset_acquired_date as c3 from assets where asset_make like '%R' and asset_make like '%R') as t1, (select asset_disposed_date as c2 from assets) as t0" }, "style": "rule" }
{ "index": 3671, "split": "train" }
Which faculty members involved in activities that either have "Accord" in their names or are the least common activity associated with the ID 773—what are their building locations and ranks?
activity_1
select t0.building, t0.rank from faculty as t0 join faculty_participates_in as t1 on t0.facid = t1.facid join activity as t2 on t1.actid = t2.actid, (select activity_name as c0 from activity where actid = 773 group by c0 order by count(*) asc nulls last limit 1) as t0 where t2.activity_name like '%Accord%' or t2.activi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.building, t0.rank from faculty as t0 join faculty_participates_in as t1 on t0.facid = t1.facid join activity as t2 on t1.actid = t2.actid, (select activity_name as c0 from activity where actid = 773 group by c0 order by count(*) asc nulls last limit...
{ "index": 901, "split": "train" }