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
Find the five last names that come first when students are grouped by last name, ordered by the highest major code assigned to each group, with any missing major values placed at the end.
club_1
select lname as c0 from student group by c0 order by max(major) 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": "club_1", "sql": "select lname as c0 from student group by c0 order by max(major) asc nulls last limit 5" }, "style": "rule" }
{ "index": 306, "split": "train" }
List the architect IDs, their bridge IDs, and the lengths in meters of bridges designed by male architects whose names contain "rig".
architecture
select t0.architect_id, t0.id, t0.length_meters from bridge as t0 join architect as t1 on t0.architect_id = t1.id where t1.name like '%rig%' and t1.gender = 'male'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "architecture", "sql": "select t0.architect_id, t0.id, t0.length_meters from bridge as t0 join architect as t1 on t0.architect_id = t1.id where t1.name like '%rig%' and t1.gender = 'male'" }, "style": "rule" }
{ "index": 1608, "split": "train" }
Does the transaction with ID 15 occur after itself?
tracking_share_transactions
select date_of_transaction > date_of_transaction from transactions where transaction_id = 15
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select date_of_transaction > date_of_transaction from transactions where transaction_id = 15" }, "style": "rule" }
{ "index": 3108, "split": "train" }
Did the transaction with ID 13 happen after the transaction with ID 15?
tracking_share_transactions
select t1.c2 > t0.c2 from (select date_of_transaction as c2 from transactions where transaction_id = 13) as t1, (select date_of_transaction as c2 from transactions where transaction_id = 15) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select t1.c2 > t0.c2 from (select date_of_transaction as c2 from transactions where transaction_id = 13) as t1, (select date_of_transaction as c2 from transactions where transaction_id = 15) as t0" }, "style": "rule" }
{ "index": 3107, "split": "train" }
Which are the three most recent building IDs based on the highest company IDs in the Office Locations?
company_office
select building_id from office_locations order by company_id 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": "company_office", "sql": "select building_id from office_locations order by company_id desc limit 3" }, "style": "rule" }
{ "index": 48, "split": "train" }
What are the connection type, address ID, and the number of years they have been compatible for each web client accelerator that is compatible either with the most common browser or with the browser that has the most recent compatibility date?
browser_web
select t0.connection, t0.id as c1, count(t1.compatible_since_year) from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id, (select browser_id as c3 from accelerator_compatible_browser group by c3 order by count(*) asc nulls last limit 1) as t1, (select browser_id as c3 ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "browser_web", "sql": "select t0.connection, t0.id as c1, count(t1.compatible_since_year) from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id, (select browser_id as c3 from accelerator_compatible_browser group by c3 order by cou...
{ "index": 1515, "split": "train" }
Did the catalog with ID 3 have a more recent publication date than the catalog with ID 5?
product_catalog
select t1.c2 > t0.c2 from (select date_of_publication as c2 from catalogs where catalog_id = 3) as t1, (select date_of_publication as c2 from catalogs where catalog_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": "product_catalog", "sql": "select t1.c2 > t0.c2 from (select date_of_publication as c2 from catalogs where catalog_id = 3) as t1, (select date_of_publication as c2 from catalogs where catalog_id = 5) as t0" }, "style": "rule" }
{ "index": 3091, "split": "train" }
List the year and player ID for players whose weight is at least as heavy as the average player weight, sorted by player ID from A to Z.
baseball_1
select t0.year, t0.player_id as c1 from player_award as t0 join player as t1 on t0.player_id = t1.player_id, (select avg(weight) as c0 from player) as t0 where t1.weight >= t0.c0 order by c1 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "baseball_1", "sql": "select t0.year, t0.player_id as c1 from player_award as t0 join player as t1 on t0.player_id = t1.player_id, (select avg(weight) as c0 from player) as t0 where t1.weight >= t0.c0 order by c1 asc nulls last" }, "style": "rule" }
{ "index": 110, "split": "train" }
For each race class, how many races are recorded, and how many have a specified date?
race_track
select class as c2, count(*), count(date) from race group by c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "race_track", "sql": "select class as c2, count(*), count(date) from race group by c2" }, "style": "rule" }
{ "index": 2918, "split": "train" }
How much less is the organization ID of thing 1 compared to the highest organization ID among things that belong to organization 10?
local_govt_and_lot
select t2.c1 - t0.c2 from (select max(organization_id) as c1 from things where organization_id = 10) as t2, (select organization_id as c2 from things where thing_id = 1) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t2.c1 - t0.c2 from (select max(organization_id) as c1 from things where organization_id = 10) as t2, (select organization_id as c2 from things where thing_id = 1) as t0" }, "style": "rule" }
{ "index": 3171, "split": "train" }
On which date did the day immediately before Day 8 occur?
cre_Doc_Tracking_DB
select t0.calendar_date, t0.day_number as c1 from ref_calendar as t0, (select max(day_number) as c0 from ref_calendar where day_number < 8) as t1 where c1 = t1.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Tracking_DB", "sql": "select t0.calendar_date, t0.day_number as c1 from ref_calendar as t0, (select max(day_number) as c0 from ref_calendar where day_number < 8) as t1 where c1 = t1.c0" }, "style": "rule" }
{ "index": 3940, "split": "train" }
Which parts, including their part IDs and part names, are associated with assets that have fault logs describing a "system error"?
assets_maintenance
select t0.part_id, t0.part_name, t1.asset_id from parts as t0 join asset_parts as t1 on t0.part_id = t1.part_id join assets as t2 on t1.asset_id = t2.asset_id join fault_log as t3 on t2.asset_id = t3.asset_id where t3.fault_description = 'system error'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t0.part_id, t0.part_name, t1.asset_id from parts as t0 join asset_parts as t1 on t0.part_id = t1.part_id join assets as t2 on t1.asset_id = t2.asset_id join fault_log as t3 on t2.asset_id = t3.asset_id where t3.fault_description = 'system error...
{ "index": 1575, "split": "train" }
What are the partition IDs of users who have tweets posted by users with UIDs 4 and 5?
twitter_1
select t0.partitionid from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.uid between 4 and 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.partitionid from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.uid between 4 and 5" }, "style": "rule" }
{ "index": 2350, "split": "train" }
Which five destination airports and their IDs are connected by routes originating from airlines based in the Republic of the Congo or Japan, sorted by the source airport ID?
flight_4
select t0.dst_ap, t0.dst_apid from routes as t0 join airlines as t1 on t0.alid = t1.alid where t1.country = 'Republic of the Congo' or t1.country like '%Japan%' order by t0.src_apid 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": "flight_4", "sql": "select t0.dst_ap, t0.dst_apid from routes as t0 join airlines as t1 on t0.alid = t1.alid where t1.country = 'Republic of the Congo' or t1.country like '%Japan%' order by t0.src_apid asc nulls last limit 5" }, "style": "rule" }
{ "index": 573, "split": "train" }
Which products with IDs of 6 or higher are included in regular orders, and what are their product IDs and names?
customer_deliveries
select t0.product_id, t0.product_name, t1.product_id as c0 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where c0 >= 6
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_deliveries", "sql": "select t0.product_id, t0.product_name, t1.product_id as c0 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where c0 >= 6" }, "style": "rule" }
{ "index": 951, "split": "train" }
Did customer 114 experience a larger percentage increase or decrease in staff involvement in complaints between July 11, 1987, and October 29, 2006, than the overall change in the number of customers living at addresses starting with "72144" during the same period?
customer_complaints
select t5.c2 > t2.c3 from (select abs((t3.c1 / cast(t4.c1 as real) - 1) * 100) as c2 from (select sum(t1.staff_id) as c1 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 114 and t1.date_complaint_raised = '1987-07-11 14:40:30' group by t0.customer_id) as t3, (select s...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_complaints", "sql": "select t5.c2 > t2.c3 from (select abs((t3.c1 / cast(t4.c1 as real) - 1) * 100) as c2 from (select sum(t1.staff_id) as c1 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 114 and t1.date_complaint_ra...
{ "index": 3439, "split": "train" }
What are the three smallest property IDs associated with customer event notes for events outside the range of 559 to 591? List these property IDs in ascending order.
local_govt_and_lot
select min(property_id) as c0 from customer_event_notes where customer_event_id < 559 or customer_event_id > 591 order by c0 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select min(property_id) as c0 from customer_event_notes where customer_event_id < 559 or customer_event_id > 591 order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 736, "split": "train" }
What is the difference between the average student ID associated with teacher 14 on April 11, 1988, and the average student ID on August 16, 1993?
behavior_monitoring
select t1.c0 - t0.c0 from (select avg(t1.student_id) as c0 from teachers as t0 join assessment_notes as t1 on t0.teacher_id = t1.teacher_id where t0.teacher_id = 14 and t1.date_of_notes = '1988-04-11 04:56:26' group by t0.teacher_id) as t1, (select t0.teacher_id, avg(t1.student_id) as c0 from teachers as t0 join assess...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select t1.c0 - t0.c0 from (select avg(t1.student_id) as c0 from teachers as t0 join assessment_notes as t1 on t0.teacher_id = t1.teacher_id where t0.teacher_id = 14 and t1.date_of_notes = '1988-04-11 04:56:26' group by t0.teacher_id) as t1, (select t...
{ "index": 3513, "split": "train" }
Can you tell me the customer IDs, order IDs, and the highest order item ID for the last 10 orders that include products 3 or 4, sorted by the highest order item ID?
tracking_orders
select t0.customer_id, t0.order_id as c0, max(t1.order_id) as c2 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.product_id between 3 and 4 group by c0 order by c2 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 t0.customer_id, t0.order_id as c0, max(t1.order_id) as c2 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.product_id between 3 and 4 group by c0 order by c2 asc nulls last limit 10" }, "style": "rule" }
{ "index": 787, "split": "train" }
How does the total sum of country IDs in the league table differ between the countries with IDs 4769 and 10257?
soccer_1
select t1.c0 - t0.c0 from (select sum(t1.country_id) as c0 from country as t0 join league as t1 on t0.id = t1.country_id where t0.id = 10257 group by t0.id) as t1, (select t0.id, sum(t1.country_id) as c0 from country as t0 join league as t1 on t0.id = t1.country_id where t0.id = 4769 group by t0.id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select t1.c0 - t0.c0 from (select sum(t1.country_id) as c0 from country as t0 join league as t1 on t0.id = t1.country_id where t0.id = 10257 group by t0.id) as t1, (select t0.id, sum(t1.country_id) as c0 from country as t0 join league as t1 on t0.id = t1.countr...
{ "index": 3623, "split": "train" }
How many days have passed between the start date and the end date of each employment record?
hr_1
select julianday(t1.c3) - julianday(t0.c1) from (select end_date as c3 from job_history) as t1, (select start_date as c1 from job_history) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "hr_1", "sql": "select julianday(t1.c3) - julianday(t0.c1) from (select end_date as c3 from job_history) as t1, (select start_date as c1 from job_history) as t0" }, "style": "rule" }
{ "index": 3717, "split": "train" }
Can you provide the IDs, birth states, ages, and temporary/acting status of the department heads who are leading either the department with the most frequent name containing "Transpo" or "Treasury," or the department with ID 15?
department_management
select t0.head_id, t0.born_state, t0.age, t1.temporary_acting from head as t0 join management as t1 on t0.head_id = t1.head_id join department as t2 on t1.department_id = t2.department_id, (select department_id as c4 from department where name like '%Transpo%' or name like '%Treasury%' group by c4 order by count(*) asc...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_management", "sql": "select t0.head_id, t0.born_state, t0.age, t1.temporary_acting from head as t0 join management as t1 on t0.head_id = t1.head_id join department as t2 on t1.department_id = t2.department_id, (select department_id as c4 from department where name like...
{ "index": 1734, "split": "train" }
List the first 10 debate venues ordered by their debate ID, with any debates missing an ID appearing at the end.
debate
select venue from debate order by debate_id 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": "debate", "sql": "select venue from debate order by debate_id asc nulls last limit 10" }, "style": "rule" }
{ "index": 1043, "split": "train" }
What are the average number of times these products were booked, the total number of bookings, along with each product's name and ID, for the five products with a daily hire cost higher than the total number of products, ordered from those booked the least to most?
products_for_hire
select avg(t0.booked_count) as c0, count(*), t1.product_name, t1.product_id as c1 from products_booked as t0 join products_for_hire as t1 on t0.product_id = t1.product_id, (select count(daily_hire_cost) as c2 from products_for_hire) as t0 where t1.daily_hire_cost > t0.c2 group by c1 order by c0 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select avg(t0.booked_count) as c0, count(*), t1.product_name, t1.product_id as c1 from products_booked as t0 join products_for_hire as t1 on t0.product_id = t1.product_id, (select count(daily_hire_cost) as c2 from products_for_hire) as t0 where t1.dail...
{ "index": 1574, "split": "train" }
What are the catalog entry ID and the smallest attribute ID for catalog entry 6, considering only attribute IDs between 1 and 3?
product_catalog
select catalog_entry_id as c1, min(attribute_id) from catalog_contents_additional_attributes where attribute_id between 1 and 3 and c1 = 6 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": "product_catalog", "sql": "select catalog_entry_id as c1, min(attribute_id) from catalog_contents_additional_attributes where attribute_id between 1 and 3 and c1 = 6 group by c1" }, "style": "rule" }
{ "index": 1331, "split": "train" }
Is the total of account ID 15's transaction amounts with transaction types containing 'd' less than the combined total of account IDs summed over all accounts that have transactions with 'd' in their type?
customers_card_transactions
select t2.c3 < t1.c2 from (select sum(t1.account_id) as c3 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 15 group by t0.account_id) as t2, (select sum(t0.c3) as c2 from (select sum(t1.account_id) as c3 from accounts as t0 join financial_transactions 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": "customers_card_transactions", "sql": "select t2.c3 < t1.c2 from (select sum(t1.account_id) as c3 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 15 group by t0.account_id) as t2, (select sum(t0.c3) as c2 from (select su...
{ "index": 3313, "split": "train" }
How many distinct built years and architect IDs are associated with each female architect who has built four or fewer mills, and what are their architect IDs?
architecture
select count(distinct (t0.built_year)), count(distinct (t0.architect_id)), t1.id as c2 from mill as t0 join architect as t1 on t0.architect_id = t1.id where t1.gender = 'female' group by c2 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": "architecture", "sql": "select count(distinct (t0.built_year)), count(distinct (t0.architect_id)), t1.id as c2 from mill as t0 join architect as t1 on t0.architect_id = t1.id where t1.gender = 'female' group by c2 having count(*) <= 4" }, "style": "rule" }
{ "index": 2451, "split": "train" }
What are the three positions that appear most frequently among players belonging to the team with the fewest players, sorted by the number of different positions?
school_player
select t0.position as c2, count(*) from player as t0, (select team as c0 from player group by c0 order by count(*) asc nulls last limit 1) as t0 where t0.team = t0.c0 group by c2 order by count(distinct (t0.position)) 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": "school_player", "sql": "select t0.position as c2, count(*) from player as t0, (select team as c0 from player group by c0 order by count(*) asc nulls last limit 1) as t0 where t0.team = t0.c0 group by c2 order by count(distinct (t0.position)) desc limit 3" }, "style": "rule" }
{ "index": 345, "split": "train" }
For each player position in the tryouts, which are the ten positions with the fewest players making decisions that contain 'n' or end with 's', when sorted by the number of unique players involved?
soccer_2
select ppos as c1, count(decision), count(*) from tryout where decision like '%n%' or decision like '%s' group by c1 order by count(distinct (pid)) asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_2", "sql": "select ppos as c1, count(decision), count(*) from tryout where decision like '%n%' or decision like '%s' group by c1 order by count(distinct (pid)) asc nulls last limit 10" }, "style": "rule" }
{ "index": 2299, "split": "train" }
What are the service ID, event details, and event ID from the events table, along with the service ID from the services table, for entries where the service ID is 5?
local_govt_in_alabama
select t0.service_id, t0.event_details, t0.event_id, t1.service_id as c2 from events as t0 join services as t1 on t0.service_id = t1.service_id where c2 = 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": "local_govt_in_alabama", "sql": "select t0.service_id, t0.event_details, t0.event_id, t1.service_id as c2 from events as t0 join services as t1 on t0.service_id = t1.service_id where c2 = 5" }, "style": "rule" }
{ "index": 1879, "split": "train" }
Did the staff member with ID 5 join the driving school after their previous recorded join date?
driving_school
select date_joined_staff > date_joined_staff from staff where staff_id = 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select date_joined_staff > date_joined_staff from staff where staff_id = 5" }, "style": "rule" }
{ "index": 3085, "split": "train" }
Can you list the location, name, and opening year of cinemas that are screening "The Case of the Mystery Weekend," but not the film with ID 5?
cinema
select anon_1.c1, anon_1.c2, anon_1.c0 from (select t0.location as c1, t0.name as c2, t0.openning_year as c0 from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id join film as t2 on t1.film_id = t2.film_id where t2.title = 'The Case of the Mystery Weekend' except select t0.location as c1, t0.name as c2, ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cinema", "sql": "select anon_1.c1, anon_1.c2, anon_1.c0 from (select t0.location as c1, t0.name as c2, t0.openning_year as c0 from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id join film as t2 on t1.film_id = t2.film_id where t2.title = 'The Case of the Mystery ...
{ "index": 2560, "split": "train" }
What are the ten products with the fewest order items in orders with an ID less than 2? For each of these products, what is their size, ID, and how many times were they ordered in these early orders?
customers_and_invoices
select t0.product_size, t0.product_id as c2, count(*) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_id < 2 group by c2 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": "customers_and_invoices", "sql": "select t0.product_size, t0.product_id as c2, count(*) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_id < 2 group by c2 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 1535, "split": "train" }
Show the names of all employees who are certified for the aircraft with aid number 9.
flight_1
select t0.name from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.aid = 9
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_1", "sql": "select t0.name from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.aid = 9" }, "style": "rule" }
{ "index": 1786, "split": "train" }
What is the difference in monthly rental amounts between the students with IDs 10 and 6?
behavior_monitoring
select t1.c2 - t0.c2 from (select monthly_rental as c2 from student_addresses where student_id = 6) as t1, (select monthly_rental as c2 from student_addresses where student_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": "behavior_monitoring", "sql": "select t1.c2 - t0.c2 from (select monthly_rental as c2 from student_addresses where student_id = 6) as t1, (select monthly_rental as c2 from student_addresses where student_id = 10) as t0" }, "style": "rule" }
{ "index": 3585, "split": "train" }
Is the pages per minute color capability higher for the product with ID 1 than for the product with ID 6?
store_product
select t1.c1 > t0.c1 from (select pages_per_minute_color as c1 from product where product_id = 6) as t1, (select pages_per_minute_color as c1 from product where product_id = 1) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select t1.c1 > t0.c1 from (select pages_per_minute_color as c1 from product where product_id = 6) as t1, (select pages_per_minute_color as c1 from product where product_id = 1) as t0" }, "style": "rule" }
{ "index": 3556, "split": "train" }
What are the locations, names, IDs, and types of all mills, including those associated with architects who designed bridges located in places ending with ", Ch"?
architecture
select anon_1.c1, anon_1.c2, anon_1.c0, anon_1.c3 from (select location as c1, name as c2, id as c0, type as c3 from mill union select t0.location as c1, t0.name as c2, t0.id as c0, t0.type as c3 from mill as t0 join architect as t1 on t0.architect_id = t1.id join bridge as t2 on t1.id = t2.architect_id where t2.locati...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "architecture", "sql": "select anon_1.c1, anon_1.c2, anon_1.c0, anon_1.c3 from (select location as c1, name as c2, id as c0, type as c3 from mill union select t0.location as c1, t0.name as c2, t0.id as c0, t0.type as c3 from mill as t0 join architect as t1 on t0.architect_id = t1....
{ "index": 28, "split": "train" }
Which pilots, with their positions, ages, and IDs, are linked to pilot record 2 but are not assigned to aircraft 6?
pilot_record
select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.position as c2, t0.age as c0, t0.pilot_id as c1 from pilot as t0 join pilot_record as t1 on t0.pilot_id = t1.pilot_id where t1.pilot_id = 2 except select t0.position as c2, t0.age as c0, t0.pilot_id as c1 from pilot as t0 join pilot_record as t1 on t0.pilot_id = t1...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "pilot_record", "sql": "select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.position as c2, t0.age as c0, t0.pilot_id as c1 from pilot as t0 join pilot_record as t1 on t0.pilot_id = t1.pilot_id where t1.pilot_id = 2 except select t0.position as c2, t0.age as c0, t0.pilot_id as ...
{ "index": 920, "split": "train" }
What is the country, gender, name, file ID, and song rating of the first artist when ordered alphabetically by country, whose genre has a rating containing "7" or whose genre rating appears in the list of all song ratings?
music_1
select t0.country as c2, t0.gender, t0.artist_name, t1.f_id, t1.rating as c1 from artist as t0 join song as t1 on t0.artist_name = t1.artist_name join genre as t2 on t1.genre_is = t2.g_name where t2.rating like '%7%' or t2.rating in (select c1 as c1 from song) 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": "music_1", "sql": "select t0.country as c2, t0.gender, t0.artist_name, t1.f_id, t1.rating as c1 from artist as t0 join song as t1 on t0.artist_name = t1.artist_name join genre as t2 on t1.genre_is = t2.g_name where t2.rating like '%7%' or t2.rating in (select c1 as c1 from song) o...
{ "index": 1414, "split": "train" }
For each restaurant address, what is the total number of restaurants located there and their average rating?
restaurant_1
select address as c0, count(address), avg(rating) from restaurant 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": "restaurant_1", "sql": "select address as c0, count(address), avg(rating) from restaurant group by c0" }, "style": "rule" }
{ "index": 2948, "split": "train" }
Can you list the five images with the highest names in reverse alphabetical order?
document_management
select image_name as c0 from images 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": "document_management", "sql": "select image_name as c0 from images order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2310, "split": "train" }
How many days are there between the date a card with a type code containing "d" becomes valid and the date it is no longer valid?
customers_card_transactions
select julianday(t1.c1) - julianday(t0.c2) from (select date_valid_from as c1 from customers_cards where card_type_code like '%d%' and card_type_code like '%d%') as t1, (select date_valid_to as c2 from customers_cards) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select julianday(t1.c1) - julianday(t0.c2) from (select date_valid_from as c1 from customers_cards where card_type_code like '%d%' and card_type_code like '%d%') as t1, (select date_valid_to as c2 from customers_cards) as t0" }, "style": ...
{ "index": 3698, "split": "train" }
Which booking has the highest number of products booked that are either product 4 or product 5, and what is its end date?
products_for_hire
select t0.booking_id, t0.booking_end_date from bookings as t0 join products_booked as t1 on t0.booking_id = t1.booking_id, (select booking_id as c2 from products_booked where product_id = 4 or product_id = 5 group by c2 order by count(*) desc limit 1) as t0 where t1.booking_id = t0.c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select t0.booking_id, t0.booking_end_date from bookings as t0 join products_booked as t1 on t0.booking_id = t1.booking_id, (select booking_id as c2 from products_booked where product_id = 4 or product_id = 5 group by c2 order by count(*) desc limit 1) ...
{ "index": 2994, "split": "train" }
Which years are recorded in the farm competitions or in the farm data, showing all years that have either an event or farm information?
farm
select anon_1.c1 from (select year as c1 from farm_competition union select year from farm) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "farm", "sql": "select anon_1.c1 from (select year as c1 from farm_competition union select year from farm) as anon_1" }, "style": "rule" }
{ "index": 414, "split": "train" }
Can you tell me the IDs and names of the first 10 playlists associated with employees whose addresses end with '20 Jasper Ave NW' or 've SW,' when sorted by playlist name in reverse alphabetical order?
store_1
select t0.id, t0.name as c0 from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id join tracks as t2 on t1.track_id = t2.id join invoice_lines as t3 on t2.id = t3.track_id join invoices as t4 on t3.invoice_id = t4.id join customers as t5 on t4.customer_id = t5.id join employees as t6 on t5.support_re...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t0.id, t0.name as c0 from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id join tracks as t2 on t1.track_id = t2.id join invoice_lines as t3 on t2.id = t3.track_id join invoices as t4 on t3.invoice_id = t4.id join customers as t5 on t4...
{ "index": 1902, "split": "train" }
Which are the IDs of enzymes that have two or fewer interactions with medicines, specifically considering the medicine with ID 2, and what are the top 10 of these enzymes sorted by their chromosomal location in alphabetical order?
medicine_enzyme_interaction
select t0.id as c0 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.medicine_id = 2 group by c0 having count(*) <= 2 order by t0.location 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": "medicine_enzyme_interaction", "sql": "select t0.id as c0 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.medicine_id = 2 group by c0 having count(*) <= 2 order by t0.location asc nulls last limit 10" }, "style": "rule" }
{ "index": 1905, "split": "train" }
Which products are not associated with any complaints that were handled by staff member 120? Please specify their category code, product ID, name, description, and price.
customer_complaints
select anon_1.c4, anon_1.c1, anon_1.c0, anon_1.c2, anon_1.c3 from (select product_category_code as c4, product_id as c1, product_name as c0, product_description as c2, product_price as c3 from products except select t0.product_category_code as c4, t0.product_id as c1, t0.product_name as c0, t0.product_description as c2...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_complaints", "sql": "select anon_1.c4, anon_1.c1, anon_1.c0, anon_1.c2, anon_1.c3 from (select product_category_code as c4, product_id as c1, product_name as c0, product_description as c2, product_price as c3 from products except select t0.product_category_code as c4, t0...
{ "index": 553, "split": "train" }
Show the work type, journal ID, and editor ID for the committee record with the highest editor ID.
journal_committee
select work_type, journal_id, editor_id as c1 from journal_committee 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": "journal_committee", "sql": "select work_type, journal_id, editor_id as c1 from journal_committee order by c1 desc limit 1" }, "style": "rule" }
{ "index": 2986, "split": "train" }
What are the primary affiliation, department, physician's name, and SSN for physicians who have appointments where the prepnurse ID is 101 or higher, or 103 or lower?
hospital_1
select t0.primaryaffiliation, t0.department, t0.physician, t1.ssn from affiliated_with as t0 join physician as t1 on t0.physician = t1.employeeid join appointment as t2 on t1.employeeid = t2.physician where t2.prepnurse <= 103 or t2.prepnurse >= 101
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "hospital_1", "sql": "select t0.primaryaffiliation, t0.department, t0.physician, t1.ssn from affiliated_with as t0 join physician as t1 on t0.physician = t1.employeeid join appointment as t2 on t1.employeeid = t2.physician where t2.prepnurse <= 103 or t2.prepnurse >= 101" }, "...
{ "index": 1425, "split": "train" }
For each catalog level name in the catalog structure, how many unique catalog level names are there, and sorted by the count of these unique names?
product_catalog
select catalog_level_name as c1, count(distinct (catalog_level_name)) as c0 from catalog_structure group by c1 order by c0 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select catalog_level_name as c1, count(distinct (catalog_level_name)) as c0 from catalog_structure group by c1 order by c0 asc nulls last" }, "style": "rule" }
{ "index": 634, "split": "train" }
Is the total resolution of songs in the 'nazrul' genre with a file ID less than 4 less than the average of total resolutions across all genres?
music_1
select t2.c3 < t1.c2 from (select sum(t1.resolution) as c3 from genre as t0 join song as t1 on t0.g_name = t1.genre_is where t0.g_name = 'nazrul' and t1.f_id < 4 group by t0.g_name) as t2, (select avg(t0.c3) as c2 from (select sum(t1.resolution) as c3 from genre as t0 join song as t1 on t0.g_name = t1.genre_is 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": "music_1", "sql": "select t2.c3 < t1.c2 from (select sum(t1.resolution) as c3 from genre as t0 join song as t1 on t0.g_name = t1.genre_is where t0.g_name = 'nazrul' and t1.f_id < 4 group by t0.g_name) as t2, (select avg(t0.c3) as c2 from (select sum(t1.resolution) as c3 from genre...
{ "index": 3318, "split": "train" }
Did the player with ID 4994 have a birthday earlier than the player with ID 9966?
soccer_1
select t1.c1 < t0.c1 from (select birthday as c1 from player where id = 4994) as t1, (select birthday as c1 from player where id = 9966) 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 = 4994) as t1, (select birthday as c1 from player where id = 9966) as t0" }, "style": "rule" }
{ "index": 3142, "split": "train" }
What is the date of the most recent logon for the student with ID 13?
e_learning
select date_of_latest_logon < date_of_latest_logon from students where student_id = 13
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 date_of_latest_logon < date_of_latest_logon from students where student_id = 13" }, "style": "rule" }
{ "index": 3133, "split": "train" }
What are the job titles and names of the five individuals whose job starts with 'doctor' and whose gender contains 'ma', who have the fewest friendship connections?
network_2
select t0.job as c1, t0.name as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where c1 like 'doctor%' and t0.gender like '%ma%' group by c0 order by count(*) asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select t0.job as c1, t0.name as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where c1 like 'doctor%' and t0.gender like '%ma%' group by c0 order by count(*) asc nulls last limit 5" }, "style": "rule" }
{ "index": 786, "split": "train" }
Can you list the first three students (by student ID) along with their gender and first name, and provide details about their visits to restaurants? Specifically, include the restaurant ID and the amount they spent during each visit, but only for visits to restaurants whose types are either not listed in the restaurant...
restaurant_1
select t0.stuid as c1, t0.sex, t0.fname, t1.resid, t1.spent from student as t0 join visits_restaurant as t1 on t0.stuid = t1.stuid join restaurant as t2 on t1.resid = t2.resid join type_of_restaurant as t3 on t2.resid = t3.resid where (not t3.restypeid in (select restaurant_type.restypeid as c3 from restaurant_type)) 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": "restaurant_1", "sql": "select t0.stuid as c1, t0.sex, t0.fname, t1.resid, t1.spent from student as t0 join visits_restaurant as t1 on t0.stuid = t1.stuid join restaurant as t2 on t1.resid = t2.resid join type_of_restaurant as t3 on t2.resid = t3.resid where (not t3.restypeid in (...
{ "index": 60, "split": "train" }
How many country IDs are there, and how many country records are in the database?
match_season
select count(country_id), count(*) from country
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "match_season", "sql": "select count(country_id), count(*) from country" }, "style": "rule" }
{ "index": 1316, "split": "train" }
Which customer has the highest product ID in their orders, and among those with the lowest maximum product ID, what are their customer number and phone number?
customers_and_products_contacts
select t0.customer_number, t0.customer_phone, max(t2.product_id) as c0 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id group by t0.customer_id 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_and_products_contacts", "sql": "select t0.customer_number, t0.customer_phone, max(t2.product_id) as c0 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id group by t0.customer_id order by...
{ "index": 2879, "split": "train" }
List the order details, customer IDs, product quantities, and order IDs for orders that include a product named "Learning English" or any product whose name ends with "story," sorted by order ID.
customers_and_invoices
select t0.order_details, t0.customer_id, t1.product_quantity, t1.order_id as c1 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id join products as t2 on t1.product_id = t2.product_id where t2.product_name = 'Learning English' or t2.product_name like '%story' order by c1 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t0.order_details, t0.customer_id, t1.product_quantity, t1.order_id as c1 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id join products as t2 on t1.product_id = t2.product_id where t2.product_name = 'Learning English' o...
{ "index": 1920, "split": "train" }
What is the price and ID of the cheapest product that has a total purchase value exceeding 48,100.23?
department_store
select t0.product_price as c0 from products as t0 join product_suppliers as t1 on t0.product_id = t1.product_id where t1.total_value_purchased > 48100.23 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": "department_store", "sql": "select t0.product_price as c0 from products as t0 join product_suppliers as t1 on t0.product_id = t1.product_id where t1.total_value_purchased > 48100.23 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 452, "split": "train" }
Which are the latest three workshops that accepted submissions with IDs 3 or 5? For each, return the workshop ID, date, acceptance workshop ID, and acceptance submission ID.
workshop_paper
select t0.workshop_id as c2, t0.date, t1.workshop_id, t1.submission_id from workshop as t0 join acceptance as t1 on t0.workshop_id = t1.workshop_id join submission as t2 on t1.submission_id = t2.submission_id where t2.submission_id = 3 or t2.submission_id = 5 order by c2 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "workshop_paper", "sql": "select t0.workshop_id as c2, t0.date, t1.workshop_id, t1.submission_id from workshop as t0 join acceptance as t1 on t0.workshop_id = t1.workshop_id join submission as t2 on t1.submission_id = t2.submission_id where t2.submission_id = 3 or t2.submission_id...
{ "index": 1538, "split": "train" }
Which members have made purchases at branches with IDs starting with "1" and are also registered at branch 1, and what are their names and membership levels?
shop_membership
select anon_1.c1, anon_1.c0 from (select t0.name as c1, t0.level as c0 from member as t0 join purchase as t1 on t0.member_id = t1.member_id where t1.branch_id like '1%' intersect select t0.name as c1, t0.level as c0 from member as t0 join membership_register_branch as t1 on t0.member_id = t1.member_id where t1.branch_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": "shop_membership", "sql": "select anon_1.c1, anon_1.c0 from (select t0.name as c1, t0.level as c0 from member as t0 join purchase as t1 on t0.member_id = t1.member_id where t1.branch_id like '1%' intersect select t0.name as c1, t0.level as c0 from member as t0 join membership_regi...
{ "index": 143, "split": "train" }
What are the age, city code, and sex of students, along with their club IDs, for members who belong to the club named "Tennis Club" or clubs with names similar to "Tennis Cl"?
club_1
select t0.age, t0.city_code, t0.sex, t1.clubid from student as t0 join member_of_club as t1 on t0.stuid = t1.stuid join club as t2 on t1.clubid = t2.clubid where t2.clubname = 'Tennis Club' or t2.clubname like '%Tennis Cl%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "club_1", "sql": "select t0.age, t0.city_code, t0.sex, t1.clubid from student as t0 join member_of_club as t1 on t0.stuid = t1.stuid join club as t2 on t1.clubid = t2.clubid where t2.clubname = 'Tennis Club' or t2.clubname like '%Tennis Cl%'" }, "style": "rule" }
{ "index": 2629, "split": "train" }
What is the project ID associated with task ID 11?
tracking_grants_for_research
select project_id from tasks where task_id = 11
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select project_id from tasks where task_id = 11" }, "style": "rule" }
{ "index": 3862, "split": "train" }
What are the other characteristic details and data types of characteristics associated with products having IDs 5 or 6?
products_gen_characteristics
select t0.other_characteristic_details, t0.characteristic_data_type from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.product_id = 5 or t1.product_id = 6
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select t0.other_characteristic_details, t0.characteristic_data_type from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.product_id = 5 or t1.product_id = 6" }, "style": "r...
{ "index": 2292, "split": "train" }
When listing rent arrears records related to cross-reference ID 2, numbered in order, is there a record with a council tax ID of 7? If so, what is its rank among those records?
local_govt_mdm
select t1.c3, t1.c4 as c5 from (select row_number() over (order by cmi_cross_ref_id asc nulls last) as c3, council_tax_id as c4 from rent_arrears where cmi_cross_ref_id = 2) as t1 where c5 = 7
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_mdm", "sql": "select t1.c3, t1.c4 as c5 from (select row_number() over (order by cmi_cross_ref_id asc nulls last) as c3, council_tax_id as c4 from rent_arrears where cmi_cross_ref_id = 2) as t1 where c5 = 7" }, "style": "rule" }
{ "index": 3490, "split": "train" }
What is the number just before the smallest project ID assigned to researchers?
tracking_grants_for_research
select t0.c1 - 1 from (select min(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' group by t0.role_code) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t0.c1 - 1 from (select min(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' group by t0.role_code) as t0" }, "style": "rule" }
{ "index": 3832, "split": "train" }
Which guests have the highest occurrence last name in the database, and how many apartment bookings do they have? Please include their first names and guest IDs.
apartment_rentals
select count(t0.apt_id), t1.guest_first_name, t1.guest_id as c2 from apartment_bookings as t0 join guests as t1 on t0.guest_id = t1.guest_id, (select guest_last_name as c1 from guests group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.guest_last_name = t0.c1 group by c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select count(t0.apt_id), t1.guest_first_name, t1.guest_id as c2 from apartment_bookings as t0 join guests as t1 on t0.guest_id = t1.guest_id, (select guest_last_name as c1 from guests group by c1 order by count(*) asc nulls last limit 1) as t0 where t1...
{ "index": 2216, "split": "train" }
Which cities are associated with people whose IDs are less than or equal to 171?
student_assessment
select t0.city from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where t1.person_id < 131 or t1.person_id <= 171
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.city from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where t1.person_id < 131 or t1.person_id <= 171" }, "style": "rule" }
{ "index": 1141, "split": "train" }
Is the maximum activity ID linked to activity 778 greater than 772?
activity_1
select t0.c1 > 772 from (select max(t1.actid) as c1 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t0.actid = 778 group by t0.actid) 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": "activity_1", "sql": "select t0.c1 > 772 from (select max(t1.actid) as c1 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t0.actid = 778 group by t0.actid) as t0" }, "style": "rule" }
{ "index": 3286, "split": "train" }
What are the campuses and their respective number of graduates, along with the years, for discipline enrollments at campuses that have degrees awarded at campus 15 or campus 18?
csu_1
select t0.campus, t0.graduate, t1.year, t1.campus from discipline_enrollments as t0 join campuses as t1 on t0.campus = t1.id join degrees as t2 on t1.id = t2.campus where t2.campus = 15 or t2.campus = 18
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "csu_1", "sql": "select t0.campus, t0.graduate, t1.year, t1.campus from discipline_enrollments as t0 join campuses as t1 on t0.campus = t1.id join degrees as t2 on t1.id = t2.campus where t2.campus = 15 or t2.campus = 18" }, "style": "rule" }
{ "index": 2241, "split": "train" }
What is the rank of customer ID 14 among addresses with IDs less than 3 when sorted in ascending order?
customer_deliveries
select t1.c1, t1.c4 as c2 from (select row_number() over (order by address_id asc nulls last) as c1, customer_id as c4 from customer_addresses where address_id < 3) as t1 where c2 = 14
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_deliveries", "sql": "select t1.c1, t1.c4 as c2 from (select row_number() over (order by address_id asc nulls last) as c1, customer_id as c4 from customer_addresses where address_id < 3) as t1 where c2 = 14" }, "style": "rule" }
{ "index": 3473, "split": "train" }
Which device ID appears most often in the database, and how many times does it occur?
device
select device_id as c0, count(distinct (device_id)) as c2 from device group by c0 order by c2 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "device", "sql": "select device_id as c0, count(distinct (device_id)) as c2 from device group by c0 order by c2 desc limit 1" }, "style": "rule" }
{ "index": 3654, "split": "train" }
What is the difference between the all-time highest salary and each player's salary in 1995?
baseball_1
select t2.c2 - t0.c0 from (select max(salary) as c2 from salary) as t2, (select salary as c0 from salary where year = 1995) 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": "baseball_1", "sql": "select t2.c2 - t0.c0 from (select max(salary) as c2 from salary) as t2, (select salary as c0 from salary where year = 1995) as t0" }, "style": "rule" }
{ "index": 3159, "split": "train" }
Is the total sum of department store IDs for the store chain with ID 4 greater than 2?
department_store
select t0.c1 > 2 from (select sum(t1.dept_store_chain_id) as c1 from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id where t0.dept_store_chain_id = 4 group by t0.dept_store_chain_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": "department_store", "sql": "select t0.c1 > 2 from (select sum(t1.dept_store_chain_id) as c1 from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id where t0.dept_store_chain_id = 4 group by t0.dept_store_chain_id) as t0" ...
{ "index": 3902, "split": "train" }
What are the top 10 job titles along with their highest salaries for jobs in the department that has the most employees or in departments whose names contain "Resou," sorted by the highest salary?
hr_1
select t0.job_title, t0.max_salary as c1 from jobs as t0 join employees as t1 on t0.job_id = t1.job_id join departments as t2 on t1.department_id = t2.department_id, (select department_name as c0 from departments group by c0 order by count(*) desc limit 1) as t0 where t2.department_name = t0.c0 or t2.department_name li...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "hr_1", "sql": "select t0.job_title, t0.max_salary as c1 from jobs as t0 join employees as t1 on t0.job_id = t1.job_id join departments as t2 on t1.department_id = t2.department_id, (select department_name as c0 from departments group by c0 order by count(*) desc limit 1) as t0 wh...
{ "index": 1014, "split": "train" }
What is the first product category listed in the Mailshot Campaigns table when sorted alphabetically, with any null categories coming last?
customers_campaigns_ecommerce
select product_category as c0 from mailshot_campaigns 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_campaigns_ecommerce", "sql": "select product_category as c0 from mailshot_campaigns order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 2110, "split": "train" }
Which mountains have been photographed using camera lenses that start with "Olympus 15mm f/8.0 Body," and what are their names, countries, and heights?
mountain_photos
select t0.name, t0.country, t0.height from mountain as t0 join photos as t1 on t0.id = t1.mountain_id join camera_lens as t2 on t1.camera_lens_id = t2.id where t2.name like 'Olympus 15mm f/8.0 Body %'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "mountain_photos", "sql": "select t0.name, t0.country, t0.height from mountain as t0 join photos as t1 on t0.id = t1.mountain_id join camera_lens as t2 on t1.camera_lens_id = t2.id where t2.name like 'Olympus 15mm f/8.0 Body %'" }, "style": "rule" }
{ "index": 1747, "split": "train" }
What is the percentage change in the lowest total customer ID sum for customers with policies starting on March 16, 2017, compared to those with policies starting on December 20, 2017?
insurance_and_eClaims
select (min(t0.c2) / cast(min(t1.c2) as real) - 1) * 100 from (select sum(t1.customer_id) as c2 from customers as t0 join policies as t1 on t0.customer_id = t1.customer_id where t1.start_date = '2017-03-16 18:16:52' group by t0.customer_id) as t0, (select t0.customer_id, sum(t1.customer_id) as c2 from customers as t0 j...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_and_eClaims", "sql": "select (min(t0.c2) / cast(min(t1.c2) as real) - 1) * 100 from (select sum(t1.customer_id) as c2 from customers as t0 join policies as t1 on t0.customer_id = t1.customer_id where t1.start_date = '2017-03-16 18:16:52' group by t0.customer_id) as t0, ...
{ "index": 3036, "split": "train" }
Which are the first ten artists (by name) along with their artist ids, and their album titles with corresponding artist ids, for albums that use either the most common media type or media type id 1? The results should be sorted alphabetically by the artist's name, with null names appearing last.
chinook_1
select t0.name as c0, t0.artistid, t1.artistid, t1.title from artist as t0 join album as t1 on t0.artistid = t1.artistid join track as t2 on t1.albumid = t2.albumid join mediatype as t3 on t2.mediatypeid = t3.mediatypeid, (select mediatypeid as c1 from mediatype group by c1 order by count(*) desc limit 1) as t0 where t...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "chinook_1", "sql": "select t0.name as c0, t0.artistid, t1.artistid, t1.title from artist as t0 join album as t1 on t0.artistid = t1.artistid join track as t2 on t1.albumid = t2.albumid join mediatype as t3 on t2.mediatypeid = t3.mediatypeid, (select mediatypeid as c1 from mediaty...
{ "index": 1725, "split": "train" }
Who are the top three persons, ordered by gender from Z to A, who are friends with the person whose friendships have the highest average year, considering only friendships that have lasted at least five years? For each of these persons, what is their job?
network_2
select t0.job from person as t0 join personfriend as t1 on t0.name = t1.friend, (select friend as c0 from personfriend group by c0 order by avg(year) desc limit 1) as t0 where t1.friend = t0.c0 and t1.year >= 5 order by t0.gender 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": "network_2", "sql": "select t0.job from person as t0 join personfriend as t1 on t0.name = t1.friend, (select friend as c0 from personfriend group by c0 order by avg(year) desc limit 1) as t0 where t1.friend = t0.c0 and t1.year >= 5 order by t0.gender desc limit 3" }, "style": ...
{ "index": 1899, "split": "train" }
Which activities does the student with ID 1025 participate in that are not associated with students whose advisors have IDs of 8918 or higher?
activity_1
select anon_1.c1, anon_1.c0 from (select t0.actid as c1, t0.activity_name as c0 from activity as t0 join participates_in as t1 on t0.actid = t1.actid join student as t2 on t1.stuid = t2.stuid where t2.stuid = 1025 except select t0.actid as c1, t0.activity_name as c0 from activity as t0 join participates_in as t1 on t0....
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "activity_1", "sql": "select anon_1.c1, anon_1.c0 from (select t0.actid as c1, t0.activity_name as c0 from activity as t0 join participates_in as t1 on t0.actid = t1.actid join student as t2 on t1.stuid = t2.stuid where t2.stuid = 1025 except select t0.actid as c1, t0.activity_nam...
{ "index": 2652, "split": "train" }
For each market, what is the highest number of phones in stock?
phone_market
select market_id as c0, max(num_of_stock) from phone_market 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": "phone_market", "sql": "select market_id as c0, max(num_of_stock) from phone_market group by c0" }, "style": "rule" }
{ "index": 1209, "split": "train" }
Show the cities, states or provinces, and address IDs for all addresses in countries starting with "U," ordered by address ID.
customers_and_products_contacts
select city, state_province_county, address_id as c2 from addresses where country like 'U%' order by c2 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select city, state_province_county, address_id as c2 from addresses where country like 'U%' order by c2 asc nulls last" }, "style": "rule" }
{ "index": 1196, "split": "train" }
What are the names of the three persons, in reverse alphabetical order, who have fewer than two friends, are female or male (gender ending with 'le'), and do not appear as friends for anyone in years after 12 (specifically, their names are not among those who became friends with someone else in year greater than 12, wh...
network_2
select avg(t0.year), t1.job from personfriend as t0 join person as t1 on t0.friend = t1.name where (not t1.name in (select t0.friend as c0 from personfriend where t0.year > 12 and t0.name like '%b')) and t1.gender like '%le' group by t1.name having count(*) < 2 order by t1.name 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": "network_2", "sql": "select avg(t0.year), t1.job from personfriend as t0 join person as t1 on t0.friend = t1.name where (not t1.name in (select t0.friend as c0 from personfriend where t0.year > 12 and t0.name like '%b')) and t1.gender like '%le' group by t1.name having count(*) < ...
{ "index": 589, "split": "train" }
What is the team and starting year of the technician with ID 5?
machine_repair
select t0.team, t0.starting_year from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id where t1.technician_id = 5 or t1.technician_id = 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "machine_repair", "sql": "select t0.team, t0.starting_year from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id where t1.technician_id = 5 or t1.technician_id = 5" }, "style": "rule" }
{ "index": 126, "split": "train" }
How many days passed between the order date and the actual delivery date for order ID 2?
cre_Drama_Workshop_Groups
select julianday(t1.c1) - julianday(t0.c3) from (select actual_delivery_date as c1 from customer_orders where order_id = 2 and order_id = 2) as t1, (select order_date as c3 from customer_orders) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Drama_Workshop_Groups", "sql": "select julianday(t1.c1) - julianday(t0.c3) from (select actual_delivery_date as c1 from customer_orders where order_id = 2 and order_id = 2) as t1, (select order_date as c3 from customer_orders) as t0" }, "style": "rule" }
{ "index": 3683, "split": "train" }
Is the total amount booked for product 4 more than 110.2?
products_for_hire
select t0.c0 > 110.2 from (select sum(t1.booked_amount) as c0 from products_for_hire as t0 join products_booked as t1 on t0.product_id = t1.product_id where t0.product_id = 4 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": "products_for_hire", "sql": "select t0.c0 > 110.2 from (select sum(t1.booked_amount) as c0 from products_for_hire as t0 join products_booked as t1 on t0.product_id = t1.product_id where t0.product_id = 4 group by t0.product_id) as t0" }, "style": "rule" }
{ "index": 3299, "split": "train" }
Which aircraft name with aid 9 is the least common in the database?
flight_1
select t0.c2 as c0, count(distinct (t0.c1)) as c3 from (select name as c2, aid as c1 from aircraft where c1 = 9) as t0 group by c0 order by c3 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_1", "sql": "select t0.c2 as c0, count(distinct (t0.c1)) as c3 from (select name as c2, aid as c1 from aircraft where c1 = 9) as t0 group by c0 order by c3 asc nulls last limit 1" }, "style": "rule" }
{ "index": 3665, "split": "train" }
Which players have a high school score of exactly 600, and what is their highest high school score?
soccer_2
select pname as c1, max(hs) from player where hs = 600 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": "soccer_2", "sql": "select pname as c1, max(hs) from player where hs = 600 group by c1" }, "style": "rule" }
{ "index": 1233, "split": "train" }
Can you list the first names and IDs of staff members, along with the number of unique staff members they are assigned to (where the assigned staff ID is greater than 2 and the problem log ID is 12)?
tracking_software_problems
select t0.staff_first_name, t0.staff_id as c0, count(distinct (t1.assigned_to_staff_id)) from staff as t0 join problem_log as t1 on t0.staff_id = t1.assigned_to_staff_id where t1.assigned_to_staff_id > 2 and t1.problem_log_id = 12 group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t0.staff_first_name, t0.staff_id as c0, count(distinct (t1.assigned_to_staff_id)) from staff as t0 join problem_log as t1 on t0.staff_id = t1.assigned_to_staff_id where t1.assigned_to_staff_id > 2 and t1.problem_log_id = 12 group by c0"...
{ "index": 2635, "split": "train" }
What are the address IDs and customer IDs for customer addresses that are located in areas with "ado" in their state or county name?
customer_deliveries
select anon_1.c1, anon_1.c0 from (select address_id as c1, customer_id as c0 from customer_addresses intersect select t0.address_id as c1, t0.customer_id as c0 from customer_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id where t1.state_province_county like '%ado%') 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": "customer_deliveries", "sql": "select anon_1.c1, anon_1.c0 from (select address_id as c1, customer_id as c0 from customer_addresses intersect select t0.address_id as c1, t0.customer_id as c0 from customer_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id where ...
{ "index": 1621, "split": "train" }
What is the difference in the number of unique sale transactions that occurred on January 18, 2004, at 8:37:50 PM, compared to those on April 7, 2002, at 8:28:37 PM?
tracking_share_transactions
select t1.c1 - t0.c1 from (select count(distinct (t1.transaction_id)) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'SALE' and t1.date_of_transaction = '2004-01-18 20:37:50' group by t0.transaction_type_code) as t1,...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select t1.c1 - t0.c1 from (select count(distinct (t1.transaction_id)) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'SALE' and t1.date_of...
{ "index": 3533, "split": "train" }
Which heads have management records indicating their leadership is temporarily acting and ending with an "o", excluding the head with ID 4, and what are their ages, birth states, and names?
department_management
select anon_1.c1, anon_1.c0, anon_1.c2 from (select t0.age as c1, t0.born_state as c0, t0.name as c2 from head as t0 join management as t1 on t0.head_id = t1.head_id where t1.temporary_acting like '%o' except select t0.age as c1, t0.born_state as c0, t0.name as c2 from head as t0 join management as t1 on t0.head_id = t...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_management", "sql": "select anon_1.c1, anon_1.c0, anon_1.c2 from (select t0.age as c1, t0.born_state as c0, t0.name as c2 from head as t0 join management as t1 on t0.head_id = t1.head_id where t1.temporary_acting like '%o' except select t0.age as c1, t0.born_state as c...
{ "index": 212, "split": "train" }
What is the fifth ranked building when ordering all buildings by their number of floors in ascending order among those with a height between 204 and 579 feet?
protein_institute
select t1.c2, t1.c0 as c5 from (select row_number() over (order by floors asc nulls last) as c2, building_id as c0 from building where height_feet between 204 and 579) as t1 where c5 = 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": "protein_institute", "sql": "select t1.c2, t1.c0 as c5 from (select row_number() over (order by floors asc nulls last) as c2, building_id as c0 from building where height_feet between 204 and 579) as t1 where c5 = 5" }, "style": "rule" }
{ "index": 3498, "split": "train" }
What is the number of years between 1995.5 and the average year when accelerator 9 has been compatible with browsers?
browser_web
select t0.c1 - 1995.5 from (select avg(t1.compatible_since_year) as c1 from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id where t0.id = 9 group by t0.id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "browser_web", "sql": "select t0.c1 - 1995.5 from (select avg(t1.compatible_since_year) as c1 from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id where t0.id = 9 group by t0.id) as t0" }, "style": "rule" }
{ "index": 3214, "split": "train" }
Does product 6 have a higher pages per minute color rating than the total number of unique pages per minute color options found among products with a maximum page size that includes "56"?
store_product
select t2.c2 > t1.c3 from (select pages_per_minute_color as c2 from product where product_id = 6) as t2, (select count(distinct (pages_per_minute_color)) as c3 from product where max_page_size like '%56%') as t1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select t2.c2 > t1.c3 from (select pages_per_minute_color as c2 from product where product_id = 6) as t2, (select count(distinct (pages_per_minute_color)) as c3 from product where max_page_size like '%56%') as t1" }, "style": "rule" }
{ "index": 3283, "split": "train" }
Can you tell me the participant type, details, and ID for everyone involved in services with type codes containing "of," except for those participating in the service with ID 6?
local_govt_in_alabama
select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.participant_type_code as c2, t0.participant_details as c1, t0.participant_id as c0 from participants as t0 join participants_in_events as t1 on t0.participant_id = t1.participant_id join events as t2 on t1.event_id = t2.event_id join services as t3 on t2.service_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": "local_govt_in_alabama", "sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.participant_type_code as c2, t0.participant_details as c1, t0.participant_id as c0 from participants as t0 join participants_in_events as t1 on t0.participant_id = t1.participant_id join events...
{ "index": 1234, "split": "train" }
Who are the last three staff members, listed in reverse alphabetical order by last name, along with their phone numbers, who handled complaints about products priced above 2.88?
customer_complaints
select t0.phone_number, t0.last_name as c0 from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id join products as t2 on t1.product_id = t2.product_id where t2.product_price > 2.88 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": "customer_complaints", "sql": "select t0.phone_number, t0.last_name as c0 from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id join products as t2 on t1.product_id = t2.product_id where t2.product_price > 2.88 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 585, "split": "train" }
What are the three most recent actual delivery dates for customer orders?
cre_Drama_Workshop_Groups
select actual_delivery_date as c0 from customer_orders order by c0 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Drama_Workshop_Groups", "sql": "select actual_delivery_date as c0 from customer_orders order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 44, "split": "train" }
Which store IDs are associated with the most frequently used product, or with product ID 3, retrieving the one with the highest store ID?
store_product
select t0.store_id as c0 from store_product as t0, (select product_id as c1 from store_product group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.product_id = t0.c1 or t0.product_id = 3 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": "store_product", "sql": "select t0.store_id as c0 from store_product as t0, (select product_id as c1 from store_product group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.product_id = t0.c1 or t0.product_id = 3 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 2318, "split": "train" }