question
stringlengths
1
606
db_id
stringclasses
139 values
external_knowledge
stringclasses
1 value
sql
stringlengths
19
1.35k
data_source
stringclasses
1 value
prompt
listlengths
2
2
ability
stringclasses
1 value
reward_model
dict
extra_info
dict
Which birth states have heads who are either 50 or older or between 53 and 67 years old, and how many heads from each state meet these age criteria?
department_management
select born_state as c1, count(age) from head where age >= 50.0 or age between 53.0 and 67.0 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": "department_management", "sql": "select born_state as c1, count(age) from head where age >= 50.0 or age between 53.0 and 67.0 group by c1" }, "style": "rule" }
{ "index": 1565, "split": "train" }
How many unique file IDs are there for each genre whose rating starts with 9, along with the genre names?
music_1
select count(distinct (t0.f_id)), t1.g_name as c1 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where t1.rating like '9%' group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select count(distinct (t0.f_id)), t1.g_name as c1 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where t1.rating like '9%' group by c1" }, "style": "rule" }
{ "index": 2051, "split": "train" }
Who are the five most recent Customers who have complaints about products with IDs 118 or 119, where the staff handling their complaints has an ID at least as high as the total number of different staff members involved in complaints?
customer_complaints
select t0.customer_id as c1 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id, (select count(distinct (staff_id)) as c0 from complaints) as t0 where t1.product_id between 118 and 119 and t1.staff_id >= t0.c0 order by c1 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_complaints", "sql": "select t0.customer_id as c1 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id, (select count(distinct (staff_id)) as c0 from complaints) as t0 where t1.product_id between 118 and 119 and t1.staff_id >= t0.c0 order by c1 de...
{ "index": 1860, "split": "train" }
What is the percentage difference in the number of circuits that had their earliest race at 20:00:00 compared to those that had their earliest race at 16:00:00?
formula_1
select (count(t0.c0) / cast(count(t1.c0) as real) - 1) * 100 from (select min(t1.circuitid) as c0 from circuits as t0 join races as t1 on t0.circuitid = t1.circuitid where t1.time = '20:00:00' group by t0.circuitid) as t0, (select t0.circuitid, min(t1.circuitid) as c0 from circuits as t0 join races as t1 on t0.circuiti...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "formula_1", "sql": "select (count(t0.c0) / cast(count(t1.c0) as real) - 1) * 100 from (select min(t1.circuitid) as c0 from circuits as t0 join races as t1 on t0.circuitid = t1.circuitid where t1.time = '20:00:00' group by t0.circuitid) as t0, (select t0.circuitid, min(t1.circuiti...
{ "index": 3034, "split": "train" }
What are the first five friendship records, including the year, friend's name, and person's name, for people whose names contain the letter "e," sorted alphabetically by their names?
network_2
select t0.year, t0.friend, t0.name as c1 from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.name like '%e%' order by c1 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select t0.year, t0.friend, t0.name as c1 from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.name like '%e%' order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 837, "split": "train" }
Which products, maximum page sizes, product IDs, and store IDs are associated with the product that has an ID of 1?
store_product
select distinct t0.product, t0.max_page_size, t0.product_id, t1.store_id from product as t0 join store_product as t1 on t0.product_id = t1.product_id where t1.product_id = 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select distinct t0.product, t0.max_page_size, t0.product_id, t1.store_id from product as t0 join store_product as t1 on t0.product_id = t1.product_id where t1.product_id = 1" }, "style": "rule" }
{ "index": 2329, "split": "train" }
Who are the first three employees with aid 4 in their certification, listed by their employee IDs, along with their names?
flight_1
select t0.eid as c0, t0.name, t1.eid from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.aid = 4 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": "flight_1", "sql": "select t0.eid as c0, t0.name, t1.eid from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.aid = 4 order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 1511, "split": "train" }
Among students with IDs less than 1016 or between 1021 and 1027, which allergy has the fewest students?
allergy_1
select allergy as c0 from has_allergy where stuid < 1016 or stuid between 1021 and 1027 group by c0 order by count(stuid) 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": "allergy_1", "sql": "select allergy as c0 from has_allergy where stuid < 1016 or stuid between 1021 and 1027 group by c0 order by count(stuid) asc nulls last limit 1" }, "style": "rule" }
{ "index": 262, "split": "train" }
Which enzymes that have fewer than two activating medicine interactions are these, and what are their names, locations, and IDs?
medicine_enzyme_interaction
select t0.name, t0.location, t0.id as c2 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.interaction_type = 'activitor' group by c2 having count(*) < 2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select t0.name, t0.location, t0.id as c2 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.interaction_type = 'activitor' group by c2 having count(*) < 2" }, "style": "rule" }
{ "index": 1810, "split": "train" }
Which members are in charge of events for both parties with IDs of 3 and parties with IDs of 2 or higher?
party_people
select anon_1.c1, anon_1.c0 from (select t0.member_id as c1, t0.party_id as c0 from member as t0 join party_events as t1 on t0.member_id = t1.member_in_charge_id where t1.party_id >= 2 intersect select t0.member_id as c1, t0.party_id as c0 from member as t0 join party_events as t1 on t0.member_id = t1.member_in_charge_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "party_people", "sql": "select anon_1.c1, anon_1.c0 from (select t0.member_id as c1, t0.party_id as c0 from member as t0 join party_events as t1 on t0.member_id = t1.member_in_charge_id where t1.party_id >= 2 intersect select t0.member_id as c1, t0.party_id as c0 from member as t0...
{ "index": 2057, "split": "train" }
Can you tell me the five apartments with the smallest number of unique booking start dates for guests with ID less than or equal to 13 or exactly 15? For each of these apartments, I’d like to know the count of their distinct booking start dates and the minimum number of bedrooms they have. --- This version is clearer...
apartment_rentals
select count(distinct (t0.room_count)), min(t0.bedroom_count) from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id where t1.guest_id <= 13 or t1.guest_id between 15 and 15 order by count(distinct (t1.booking_start_date)) asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select count(distinct (t0.room_count)), min(t0.bedroom_count) from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id where t1.guest_id <= 13 or t1.guest_id between 15 and 15 order by count(distinct (t1.booking_start_date)) asc nul...
{ "index": 1943, "split": "train" }
What are the apartment numbers and bathroom counts for apartments with bookings that end on or after November 13, 2017, sorted alphabetically by apartment type?
apartment_rentals
select t0.apt_id, t0.bathroom_count from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id where t1.booking_end_date >= '2017-11-13 13:59:45' order by t0.apt_type_code 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": "apartment_rentals", "sql": "select t0.apt_id, t0.bathroom_count from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id where t1.booking_end_date >= '2017-11-13 13:59:45' order by t0.apt_type_code asc nulls last" }, "style": "rule" }
{ "index": 2041, "split": "train" }
Did the latest revision date of catalog 1 come before that of catalog 4?
product_catalog
select t1.c0 < t0.c0 from (select date_of_latest_revision as c0 from catalogs where catalog_id = 1) as t1, (select date_of_latest_revision as c0 from catalogs where catalog_id = 4) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select t1.c0 < t0.c0 from (select date_of_latest_revision as c0 from catalogs where catalog_id = 1) as t1, (select date_of_latest_revision as c0 from catalogs where catalog_id = 4) as t0" }, "style": "rule" }
{ "index": 3139, "split": "train" }
Which letter grades correspond to students who received a grade with "B+" in it or a grade of D-?
college_3
select t0.lettergrade from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t1.grade like '%B+%' or t1.grade = 'D-'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_3", "sql": "select t0.lettergrade from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t1.grade like '%B+%' or t1.grade = 'D-'" }, "style": "rule" }
{ "index": 2557, "split": "train" }
What are the elevation, city, airport ID, and smallest destination airport ID for each airport with source airport IDs between 344 and 374?
flight_4
select t0.elevation, t0.city, t0.apid as c1, min(t1.dst_apid) from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.src_apid between 344 and 374 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": "flight_4", "sql": "select t0.elevation, t0.city, t0.apid as c1, min(t1.dst_apid) from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.src_apid between 344 and 374 group by c1" }, "style": "rule" }
{ "index": 1533, "split": "train" }
Can you list the top 10 endowments by amount, along with their school IDs, for schools whose total budget percentage budgeted is either less than or equal to 2.4% or exactly equal to the average budget percentage across all schools? Please sort the list by the endowment amount in descending order.
school_finance
select t0.amount as c2, t0.school_id, t1.school_id from endowment as t0 join school as t1 on t0.school_id = t1.school_id join budget as t2 on t1.school_id = t2.school_id, (select avg(total_budget_percent_budgeted) as c0 from budget) as t0 where t2.total_budget_percent_budgeted <= 2.4 or t2.total_budget_percent_budgeted...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_finance", "sql": "select t0.amount as c2, t0.school_id, t1.school_id from endowment as t0 join school as t1 on t0.school_id = t1.school_id join budget as t2 on t1.school_id = t2.school_id, (select avg(total_budget_percent_budgeted) as c0 from budget) as t0 where t2.total_b...
{ "index": 1449, "split": "train" }
Which ship's nationality, name, and tonnage come first when listing all ships in reverse alphabetical order of their nationality?
ship_mission
select nationality as c1, name, tonnage from ship 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": "ship_mission", "sql": "select nationality as c1, name, tonnage from ship order by c1 desc limit 1" }, "style": "rule" }
{ "index": 2621, "split": "train" }
What is the percentage change in the minimum total activity for restaurants with addresses starting with "32" between October 8th at 1:00 PM and October 9th at 6:15 PM in 2017?
restaurant_1
select (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select sum(t1.resid) as c0 from restaurant as t0 join visits_restaurant as t1 on t0.resid = t1.resid where t1.time = '2017-10-08 13:00:30' and t0.address like '32%' group by t0.resid) as t0, (select t0.resid, sum(t1.resid) as c0 from restaurant as t0 join v...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select sum(t1.resid) as c0 from restaurant as t0 join visits_restaurant as t1 on t0.resid = t1.resid where t1.time = '2017-10-08 13:00:30' and t0.address like '32%' group by t0.resid) as t0, (se...
{ "index": 3044, "split": "train" }
Is the checking account balance of customer 5 less than that of customer 2?
small_bank_1
select t1.c0 < t0.c0 from (select balance as c0 from checking where custid = 2) as t1, (select balance as c0 from checking where custid = 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": "small_bank_1", "sql": "select t1.c0 < t0.c0 from (select balance as c0 from checking where custid = 2) as t1, (select balance as c0 from checking where custid = 5) as t0" }, "style": "rule" }
{ "index": 3573, "split": "train" }
What are the distances and names of aircraft, along with their identifiers, that are certificated to employees earning less than 178,345 in salary?
flight_1
select t0.distance, t0.name, t1.aid from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid where t2.salary < 178345
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.distance, t0.name, t1.aid from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid where t2.salary < 178345" }, "style": "rule" }
{ "index": 2155, "split": "train" }
What are the names of the ten parties, with election years after the earliest recorded year, ranked from the earliest to latest on average election year?
election
select t0.party as c0 from party as t0, (select min(year) as c1 from party) as t0 where t0.year > t0.c1 group by c0 order by avg(t0.year) 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": "election", "sql": "select t0.party as c0 from party as t0, (select min(year) as c1 from party) as t0 where t0.year > t0.c1 group by c0 order by avg(t0.year) asc nulls last limit 10" }, "style": "rule" }
{ "index": 2630, "split": "train" }
What are the names and IDs of the amenities available in the dorm with dorm ID 160?
dorm_1
select t0.amenity_name from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t1.dormid = 160
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select t0.amenity_name from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t1.dormid = 160" }, "style": "rule" }
{ "index": 2348, "split": "train" }
What are the order status, customer ID, order date, and product ID for orders where the quantity is either exactly 9 or starts with the digit "7"?
customers_and_addresses
select t0.order_status, t0.customer_id, t0.order_date, t1.product_id from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.order_quantity = 9 or t1.order_quantity like '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": "customers_and_addresses", "sql": "select t0.order_status, t0.customer_id, t0.order_date, t1.product_id from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.order_quantity = 9 or t1.order_quantity like '7%'" }, "style": "rule" }
{ "index": 2444, "split": "train" }
Is grant ID 15 greater than the average of the maximum grant IDs across all grant groups?
tracking_grants_for_research
select t2.c1 > t1.c3 from (select max(t1.grant_id) as c1 from grants as t0 join documents as t1 on t0.grant_id = t1.grant_id where t0.grant_id = 15 group by t0.grant_id) as t2, (select avg(t0.c1) as c3 from (select max(t1.grant_id) as c1 from grants as t0 join documents as t1 on t0.grant_id = t1.grant_id group by t0.gr...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c1 > t1.c3 from (select max(t1.grant_id) as c1 from grants as t0 join documents as t1 on t0.grant_id = t1.grant_id where t0.grant_id = 15 group by t0.grant_id) as t2, (select avg(t0.c1) as c3 from (select max(t1.grant_id) as c1 fro...
{ "index": 3285, "split": "train" }
How many days are there between the date a customer’s card was valid from and the date it was valid until?
customers_card_transactions
select julianday(t1.c2) - julianday(t0.c0) from (select date_valid_to as c2 from customers_cards) as t1, (select date_valid_from as c0 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.c2) - julianday(t0.c0) from (select date_valid_to as c2 from customers_cards) as t1, (select date_valid_from as c0 from customers_cards) as t0" }, "style": "rule" }
{ "index": 3697, "split": "train" }
What is the average invoice number for refund transactions made by account number 12?
customers_and_invoices
select t0.c1 from (select avg(t1.invoice_number) as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 12 and t1.transaction_type = 'Refund' group by t0.account_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t0.c1 from (select avg(t1.invoice_number) as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 12 and t1.transaction_type = 'Refund' group by t0.account_id) as t0" }, "style"...
{ "index": 3370, "split": "train" }
List the venues and the total number of audience members for debates with IDs 5 and 2, grouping the results by each venue.
debate
select venue as c1, sum(num_of_audience) from debate where debate_id = 5 or debate_id = 2 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": "debate", "sql": "select venue as c1, sum(num_of_audience) from debate where debate_id = 5 or debate_id = 2 group by c1" }, "style": "rule" }
{ "index": 1229, "split": "train" }
Which apartment buildings have apartments with type codes ending in "uplex" or equal to "Studio," and what are their descriptions and building IDs?
apartment_rentals
select t0.building_description from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.apt_type_code like '%uplex' or t1.apt_type_code = 'Studio'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select t0.building_description from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.apt_type_code like '%uplex' or t1.apt_type_code = 'Studio'" }, "style": "rule" }
{ "index": 440, "split": "train" }
List the names, addresses, and school codes of the three departments whose names come last alphabetically.
college_1
select dept_name as c1, dept_address, school_code from department order by c1 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_1", "sql": "select dept_name as c1, dept_address, school_code from department order by c1 desc limit 3" }, "style": "rule" }
{ "index": 56, "split": "train" }
How many different nationalities are there among architects who have built a mill named "Moulin Bertrand" or architects whose mills are not listed in the architect database?
architecture
select count(distinct (t0.nationality)) from architect as t0 join mill as t1 on t0.id = t1.architect_id where t1.name like '%Moulin Bertrand' or (not t1.name in (select t0.name as c1 from architect))
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.nationality)) from architect as t0 join mill as t1 on t0.id = t1.architect_id where t1.name like '%Moulin Bertrand' or (not t1.name in (select t0.name as c1 from architect))" }, "style": "rule" }
{ "index": 1828, "split": "train" }
Which product details and ID correspond to the product that appears more than once in the order with the highest average product ID, where we select the product with the fewest appearances in that order?
customers_and_addresses
select t0.product_details, t0.product_id as c2 from products as t0 join order_items as t1 on t0.product_id = t1.product_id, (select order_id as c0 from order_items group by c0 order by avg(product_id) desc limit 1) as t0 where t1.order_id = t0.c0 group by c2 having count(*) > 1 order by count(*) 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_addresses", "sql": "select t0.product_details, t0.product_id as c2 from products as t0 join order_items as t1 on t0.product_id = t1.product_id, (select order_id as c0 from order_items group by c0 order by avg(product_id) desc limit 1) as t0 where t1.order_id = t0.c0...
{ "index": 370, "split": "train" }
Does train number 6 have a higher train number than all trains scheduled at times ending with "2:10"?
station_weather
select t2.c1 > t1.c0 from (select train_number as c1 from train where id = 6) as t2, (select max(train_number) as c0 from train where time like '%2:10') 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": "station_weather", "sql": "select t2.c1 > t1.c0 from (select train_number as c1 from train where id = 6) as t2, (select max(train_number) as c0 from train where time like '%2:10') as t1" }, "style": "rule" }
{ "index": 3282, "split": "train" }
What is the total attendance at the park with the ID PHI09?
baseball_1
select sum(t0.attendance), t1.park_id as c0 from home_game as t0 join park as t1 on t0.park_id = t1.park_id where c0 = 'PHI09' group by c0 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": "baseball_1", "sql": "select sum(t0.attendance), t1.park_id as c0 from home_game as t0 join park as t1 on t0.park_id = t1.park_id where c0 = 'PHI09' group by c0 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 140, "split": "train" }
Which student has a minimum course ID that ranks 15th when all students who logged in after January 10, 2018, are sorted by their earliest enrolled course ID in ascending order?
e_learning
select t1.c5, t1.c0 as c3 from (select row_number() over (order by t0.c2 asc nulls last) as c5, t0.c1 as c0 from (select t0.student_id as c1, min(t1.course_id) as c2 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t0.date_of_latest_logon >= '2018-01-10 11:27:03' group by c...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t1.c5, t1.c0 as c3 from (select row_number() over (order by t0.c2 asc nulls last) as c5, t0.c1 as c0 from (select t0.student_id as c1, min(t1.course_id) as c2 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id wher...
{ "index": 3892, "split": "train" }
How does the film with a minimum store ID of 637 rank among all films when sorted from the highest to the lowest minimum store ID?
sakila_1
select t1.c1, t1.c0 as c2 from (select row_number() over (order by t0.c4 desc) as c1, t0.c5 as c0 from (select t0.film_id as c5, min(t1.store_id) as c4 from film as t0 join inventory as t1 on t0.film_id = t1.film_id group by c5) as t0) as t1 where c2 = 637
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "sakila_1", "sql": "select t1.c1, t1.c0 as c2 from (select row_number() over (order by t0.c4 desc) as c1, t0.c5 as c0 from (select t0.film_id as c5, min(t1.store_id) as c4 from film as t0 join inventory as t1 on t0.film_id = t1.film_id group by c5) as t0) as t1 where c2 = 637" }...
{ "index": 3499, "split": "train" }
Who is the faculty member with the lowest faculty ID participating in activity 772 or any activity with an ID less than 773, and what is that activity's ID?
activity_1
select t0.facid as c0, t0.actid from faculty_participates_in as t0 join activity as t1 on t0.actid = t1.actid join participates_in as t2 on t1.actid = t2.actid where t2.actid = 772 or t2.actid < 773 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": "activity_1", "sql": "select t0.facid as c0, t0.actid from faculty_participates_in as t0 join activity as t1 on t0.actid = t1.actid join participates_in as t2 on t1.actid = t2.actid where t2.actid = 772 or t2.actid < 773 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 850, "split": "train" }
Among the staff roles involved in projects with IDs 7 or higher, which role description comes first alphabetically?
tracking_grants_for_research
select t0.role_description as c0 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t1.project_id >= 7 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": "tracking_grants_for_research", "sql": "select t0.role_description as c0 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t1.project_id >= 7 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 1221, "split": "train" }
Which five aircraft, along with their distances, are associated with employees earning less than the highest-paid employee, listed in alphabetical order by aircraft name?
flight_1
select t0.distance, t0.name as c0 from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid, (select max(salary) as c1 from employee) as t0 where t2.salary < t0.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": "flight_1", "sql": "select t0.distance, t0.name as c0 from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid, (select max(salary) as c1 from employee) as t0 where t2.salary < t0.c1 order by c0 asc nulls last limit 5" }, "style": "r...
{ "index": 2406, "split": "train" }
What are the store phone numbers, currency codes, and workshop group IDs for groups associated with customers who are either not performers or have names starting with "Ale"?
cre_Drama_Workshop_Groups
select t0.store_phone, t0.currency_code, t0.workshop_group_id from drama_workshop_groups as t0 join addresses as t1 on t0.address_id = t1.address_id join customers as t2 on t1.address_id = t2.address_id where (not t2.customer_name in (select performers.customer_name as c1 from performers)) or t2.customer_name like 'Ale...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Drama_Workshop_Groups", "sql": "select t0.store_phone, t0.currency_code, t0.workshop_group_id from drama_workshop_groups as t0 join addresses as t1 on t0.address_id = t1.address_id join customers as t2 on t1.address_id = t2.address_id where (not t2.customer_name in (select pe...
{ "index": 859, "split": "train" }
When did the person with ID 1 reach their highest weight?
entrepreneur
select t0.date_of_birth, t0.weight as c0 from people as t0, (select max(weight) as c2 from people where people_id = 1) as t1 where c0 = t1.c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "entrepreneur", "sql": "select t0.date_of_birth, t0.weight as c0 from people as t0, (select max(weight) as c2 from people where people_id = 1) as t1 where c0 = t1.c2" }, "style": "rule" }
{ "index": 3934, "split": "train" }
Which restaurant types and their corresponding restaurant IDs are not associated with the restaurant type that has a Restypeid of 2?
restaurant_1
select restypeid as c2, resid from type_of_restaurant where (not c2 in (select c2 as c1 from restaurant_type where c2 = 2))
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "restaurant_1", "sql": "select restypeid as c2, resid from type_of_restaurant where (not c2 in (select c2 as c1 from restaurant_type where c2 = 2))" }, "style": "rule" }
{ "index": 2793, "split": "train" }
Which are the ten most recent team IDs and their names for teams that participated in seasons representing countries where the official native language starts with "Eng"?
match_season
select t0.team_id as c0, t0.name from team as t0 join match_season as t1 on t0.team_id = t1.team join country as t2 on t1.country = t2.country_id where t2.official_native_language like 'Eng%' order by c0 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "match_season", "sql": "select t0.team_id as c0, t0.name from team as t0 join match_season as t1 on t0.team_id = t1.team join country as t2 on t1.country = t2.country_id where t2.official_native_language like 'Eng%' order by c0 desc limit 10" }, "style": "rule" }
{ "index": 2926, "split": "train" }
Is the number of stories in building 11 greater than the total number of stories entries across all buildings?
company_office
select t2.c2 > t1.c3 from (select stories as c2 from buildings where id = 11) as t2, (select count(stories) as c3 from buildings) 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": "company_office", "sql": "select t2.c2 > t1.c3 from (select stories as c2 from buildings where id = 11) as t2, (select count(stories) as c3 from buildings) as t1" }, "style": "rule" }
{ "index": 3265, "split": "train" }
Does the percentage difference in the customer ID for customer 16 who moved in on March 27, 2015, exceed the minimal percentage change observed among all customers who moved in on that date?
local_govt_and_lot
select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c2 from (select min(t1.customer_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t2, (select abs((min(t0.c0) / cast(min(...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c2 from (select min(t1.customer_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00...
{ "index": 3827, "split": "train" }
What are the characteristic type codes and names for all characteristics associated with the product that has the ID 11?
products_gen_characteristics
select t0.characteristic_type_code, t0.characteristic_name from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.product_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": "products_gen_characteristics", "sql": "select t0.characteristic_type_code, t0.characteristic_name from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.product_id = 11" }, "style": "rule" }
{ "index": 916, "split": "train" }
List the names, prices, and product types of products with IDs of 10 or higher, along with the associated order IDs.
department_store
select t0.product_name, t0.product_price, t0.product_type_code, t1.order_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id >= 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select t0.product_name, t0.product_price, t0.product_type_code, t1.order_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id >= 10" }, "style": "rule" }
{ "index": 2160, "split": "train" }
Can you tell me the top 10 countries whose names start with 'Portugal', along with the total number of leagues, the number of unique league names, and the number of such countries, sorted by the number of country names in descending order?
soccer_1
select count(t0.id), count(distinct (t0.name)), count(t1.name) as c0 from league as t0 join country as t1 on t0.country_id = t1.id where t1.name like 'Portugal%' order by c0 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select count(t0.id), count(distinct (t0.name)), count(t1.name) as c0 from league as t0 join country as t1 on t0.country_id = t1.id where t1.name like 'Portugal%' order by c0 desc limit 10" }, "style": "rule" }
{ "index": 1749, "split": "train" }
What are the types and group equity shareholdings of companies that have operated flights traveling at exactly 240.0 velocity?
flight_company
select t0.type, t0.group_equity_shareholding from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t1.velocity = 240.0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_company", "sql": "select t0.type, t0.group_equity_shareholding from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t1.velocity = 240.0" }, "style": "rule" }
{ "index": 2101, "split": "train" }
What are the dock count, name, and ID of the station with more than 5 bikes available, which is the most frequently reported station in the status table, and has the least number of docks among stations with at least 4 status reports?
bike_1
select t0.dock_count as c1, t0.name, t0.id as c0 from station as t0 join status as t1 on t0.id = t1.station_id, (select station_id as c2 from status group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.bikes_available > 5 and t1.station_id = t0.c2 group by c0 having count(*) > 4 order by c1 asc nulls la...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select t0.dock_count as c1, t0.name, t0.id as c0 from station as t0 join status as t1 on t0.id = t1.station_id, (select station_id as c2 from status group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.bikes_available > 5 and t1.station_id = t0.c2...
{ "index": 268, "split": "train" }
Does the average account ID for invoice number 12, considering only transactions with "ayme" in their type, exceed the total count of unique average account IDs across all invoices with such "ayme" transactions?
customers_and_invoices
select t2.c0 > t1.c2 from (select avg(t1.account_id) as c0 from invoices as t0 join financial_transactions as t1 on t0.invoice_number = t1.invoice_number where t0.invoice_number = 12 group by t0.invoice_number) as t2, (select count(distinct (t0.c0)) as c2 from (select avg(t1.account_id) as c0 from invoices as t0 join f...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t2.c0 > t1.c2 from (select avg(t1.account_id) as c0 from invoices as t0 join financial_transactions as t1 on t0.invoice_number = t1.invoice_number where t0.invoice_number = 12 group by t0.invoice_number) as t2, (select count(distinct (t0.c0...
{ "index": 3269, "split": "train" }
What are the department IDs and head IDs listed in the management records?
department_management
select department_id, head_id from management
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 department_id, head_id from management" }, "style": "rule" }
{ "index": 1806, "split": "train" }
Which medicines have an interaction type of 'activator' with enzymes, and what are their names, IDs, and approval statuses?
medicine_enzyme_interaction
select t0.name, t0.id, t0.fda_approved from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.interaction_type = 'activitor'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.name, t0.id, t0.fda_approved from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.interaction_type = 'activitor'" }, "style": "rule" }
{ "index": 660, "split": "train" }
Can you provide the names and IDs of products that appear in orders with IDs up to 15, where each product was ordered with a quantity of exactly 5? Additionally, sort these products by how many times they meet these criteria, showing the most frequently occurring ones last.
customers_and_invoices
select t0.product_name, t0.product_id as c1 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_id <= 15 and t1.product_quantity = 5 group by c1 order by count(*) 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.product_name, t0.product_id as c1 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_id <= 15 and t1.product_quantity = 5 group by c1 order by count(*) asc nulls last" }, "style": "rule" }
{ "index": 2738, "split": "train" }
What are the names, IDs, and distances of aircraft that are not operated by any certified employees?
flight_1
select anon_1.c2, anon_1.c1, anon_1.c0 from (select name as c2, aid as c1, distance as c0 from aircraft except select t0.name as c2, t0.aid as c1, t0.distance as c0 from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid where (not t2.eid in (select eid from certificate))) a...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_1", "sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select name as c2, aid as c1, distance as c0 from aircraft except select t0.name as c2, t0.aid as c1, t0.distance as c0 from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2...
{ "index": 576, "split": "train" }
What are the station IDs, the number of bikes available, and the station's unique ID for all stations located between latitudes 37.481758 and 37.774814?
bike_1
select t0.station_id, t0.bikes_available, t1.id from status as t0 join station as t1 on t0.station_id = t1.id where t1.lat between 37.481758 and 37.774814
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select t0.station_id, t0.bikes_available, t1.id from status as t0 join station as t1 on t0.station_id = t1.id where t1.lat between 37.481758 and 37.774814" }, "style": "rule" }
{ "index": 1611, "split": "train" }
Which artists have tracks that are 312,372 milliseconds or shorter?
store_1
select t0.artist_id from albums as t0 join tracks as t1 on t0.id = t1.album_id where t1.milliseconds <= 312372
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.artist_id from albums as t0 join tracks as t1 on t0.id = t1.album_id where t1.milliseconds <= 312372" }, "style": "rule" }
{ "index": 1309, "split": "train" }
How many days elapsed between the actual delivery date of July 21, 1992, at 10:11 PM and each order date in the system?
cre_Drama_Workshop_Groups
select julianday(t1.c0) - julianday(t0.c2) from (select actual_delivery_date as c0 from customer_orders where c0 = '1992-07-21 22:11:11' and c0 = '1992-07-21 22:11:11') as t1, (select order_date as c2 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.c0) - julianday(t0.c2) from (select actual_delivery_date as c0 from customer_orders where c0 = '1992-07-21 22:11:11' and c0 = '1992-07-21 22:11:11') as t1, (select order_date as c2 from customer_orders) as t0" }, "style"...
{ "index": 3915, "split": "train" }
What are the teams of technicians who are assigned to repair the machine with ID 7?
machine_repair
select t0.team from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id where t1.machine_id = 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": "machine_repair", "sql": "select t0.team from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id where t1.machine_id = 7" }, "style": "rule" }
{ "index": 669, "split": "train" }
What are the artist IDs, album IDs, and titles of albums that do not contain any tracks with the media type 'Protected AAC audio file'?
chinook_1
select anon_1.c1, anon_1.c2, anon_1.c0 from (select artistid as c1, albumid as c2, title as c0 from album except select t0.artistid as c1, t0.albumid as c2, t0.title as c0 from album as t0 join track as t1 on t0.albumid = t1.albumid join mediatype as t2 on t1.mediatypeid = t2.mediatypeid where t2.name = 'Protected AAC ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "chinook_1", "sql": "select anon_1.c1, anon_1.c2, anon_1.c0 from (select artistid as c1, albumid as c2, title as c0 from album except select t0.artistid as c1, t0.albumid as c2, t0.title as c0 from album as t0 join track as t1 on t0.albumid = t1.albumid join mediatype as t2 on t1....
{ "index": 1202, "split": "train" }
What are the names of the three start stations with the smallest start station IDs for trips?
bike_1
select start_station_name from trip order by start_station_id asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select start_station_name from trip order by start_station_id asc nulls last limit 3" }, "style": "rule" }
{ "index": 618, "split": "train" }
For each address that contains "rrison Squar" or has the least common address line, how many teachers are linked to it, and what is its address ID?
behavior_monitoring
select count(*), t0.address_id as c2 from addresses as t0 join teachers as t1 on t0.address_id = t1.address_id, (select line_1 as c0 from addresses group by c0 order by count(*) asc nulls last limit 1) as t0 where t0.line_1 like '%rrison Squar%' or t0.line_1 = t0.c0 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": "behavior_monitoring", "sql": "select count(*), t0.address_id as c2 from addresses as t0 join teachers as t1 on t0.address_id = t1.address_id, (select line_1 as c0 from addresses group by c0 order by count(*) asc nulls last limit 1) as t0 where t0.line_1 like '%rrison Squar%' or t...
{ "index": 323, "split": "train" }
Which addresses have customers with mobile phone numbers containing "85x," and what are the State/Province/County, Country, Address ID, and the total amount they owe?
driving_school
select t0.state_province_county, t0.country, t0.address_id as c3, sum(t1.amount_outstanding) from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id where t1.cell_mobile_phone_number like '%85x%' group by c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select t0.state_province_county, t0.country, t0.address_id as c3, sum(t1.amount_outstanding) from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id where t1.cell_mobile_phone_number like '%85x%' group by c3" }, "style": "r...
{ "index": 851, "split": "train" }
Which documents have a structure code of 8, and what are their names and corresponding structure codes?
document_management
select t0.document_name, t0.document_structure_code from documents as t0 join document_structures as t1 on t0.document_structure_code = t1.document_structure_code where t1.document_structure_code = 8
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "document_management", "sql": "select t0.document_name, t0.document_structure_code from documents as t0 join document_structures as t1 on t0.document_structure_code = t1.document_structure_code where t1.document_structure_code = 8" }, "style": "rule" }
{ "index": 2034, "split": "train" }
What are the student IDs and activity IDs for the first ten students participating in activities overseen by faculty members with the most common last name or whose last name includes "a," sorted by student ID?
activity_1
select t0.stuid as c1, t0.actid from participates_in as t0 join activity as t1 on t0.actid = t1.actid join faculty_participates_in as t2 on t1.actid = t2.actid join faculty as t3 on t2.facid = t3.facid, (select lname as c2 from faculty group by c2 order by count(*) asc nulls last limit 1) as t0 where t3.lname = t0.c2 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": "activity_1", "sql": "select t0.stuid as c1, t0.actid from participates_in as t0 join activity as t1 on t0.actid = t1.actid join faculty_participates_in as t2 on t1.actid = t2.actid join faculty as t3 on t2.facid = t3.facid, (select lname as c2 from faculty group by c2 order by co...
{ "index": 2991, "split": "train" }
Who are the unique followers of the user with the fewest followers, or of user ID 7?
twitter_1
select distinct t0.f2 from follows as t0, (select f1 as c1 from follows group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.f1 = t0.c1 or t0.f1 = 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": "twitter_1", "sql": "select distinct t0.f2 from follows as t0, (select f1 as c1 from follows group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.f1 = t0.c1 or t0.f1 = 7" }, "style": "rule" }
{ "index": 605, "split": "train" }
List the names, ages, and IDs of editors who worked on journals with themes containing "D" and also contributed to journals published in a year or period including "2".
journal_committee
select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.name as c2, t0.age as c1, t0.editor_id as c0 from editor as t0 join journal_committee as t1 on t0.editor_id = t1.editor_id join journal as t2 on t1.journal_id = t2.journal_id where t2.theme like '%D%' intersect select t0.name as c2, t0.age as c1, t0.editor_id as 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": "journal_committee", "sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.name as c2, t0.age as c1, t0.editor_id as c0 from editor as t0 join journal_committee as t1 on t0.editor_id = t1.editor_id join journal as t2 on t1.journal_id = t2.journal_id where t2.theme like '%...
{ "index": 437, "split": "train" }
Could you provide the latest revision date, publication date, catalog name, and catalog level number for the first 10 catalogs whose catalog level name includes "oduct," sorted by catalog level number?
product_catalog
select t0.date_of_latest_revision, t0.date_of_publication, t0.catalog_name, t1.catalog_level_number as c3 from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_level_name like '%oduct%' order by c3 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": "product_catalog", "sql": "select t0.date_of_latest_revision, t0.date_of_publication, t0.catalog_name, t1.catalog_level_number as c3 from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_level_name like '%oduct%' order by c3 asc nulls l...
{ "index": 785, "split": "train" }
Which are the three most recent employment records based on the highest company IDs, showing the People IDs and Company IDs?
company_employee
select people_id, company_id as c1 from employment order by c1 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_employee", "sql": "select people_id, company_id as c1 from employment order by c1 desc limit 3" }, "style": "rule" }
{ "index": 1785, "split": "train" }
Can you provide the phone number, name, and ID of each supplier whose address details begin with "195"?
department_store
select t0.supplier_phone, t0.supplier_name, t0.supplier_id, t1.supplier_id from suppliers as t0 join supplier_addresses as t1 on t0.supplier_id = t1.supplier_id join addresses as t2 on t1.address_id = t2.address_id where t2.address_details like '195%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.supplier_phone, t0.supplier_name, t0.supplier_id, t1.supplier_id from suppliers as t0 join supplier_addresses as t1 on t0.supplier_id = t1.supplier_id join addresses as t2 on t1.address_id = t2.address_id where t2.address_details like '195%'" ...
{ "index": 53, "split": "train" }
Is the customer ID 9 less than the highest customer ID among all customers who have placed orders?
customers_campaigns_ecommerce
select t2.c0 < t1.c1 from (select max(t1.customer_id) as c0 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 9 group by t0.customer_id) as t2, (select max(t0.c0) as c1 from (select max(t1.customer_id) as c0 from customers as t0 join customer_orders as t1 on t0.cu...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_campaigns_ecommerce", "sql": "select t2.c0 < t1.c1 from (select max(t1.customer_id) as c0 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 9 group by t0.customer_id) as t2, (select max(t0.c0) as c1 from (select ma...
{ "index": 3312, "split": "train" }
Can you tell me the `max_page_size` and `store_id` for the last five entries related to products with ID 4 or 6, sorted by the highest product ID?
store_product
select t0.max_page_size, t1.store_id from product as t0 join store_product as t1 on t0.product_id = t1.product_id where t1.product_id = 4 or t1.product_id = 6 order by t0.product_id desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select t0.max_page_size, t1.store_id from product as t0 join store_product as t1 on t0.product_id = t1.product_id where t1.product_id = 4 or t1.product_id = 6 order by t0.product_id desc limit 5" }, "style": "rule" }
{ "index": 927, "split": "train" }
Which apartment's ID and booking end date correspond to the guest gender that occurs the least frequently in the database, and among those, the apartment with the lowest ID?
apartment_rentals
select t0.apt_id as c1, t0.booking_end_date from apartment_bookings as t0 join guests as t1 on t0.guest_id = t1.guest_id, (select gender_code as c2 from guests group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.gender_code = t0.c2 order by c1 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select t0.apt_id as c1, t0.booking_end_date from apartment_bookings as t0 join guests as t1 on t0.guest_id = t1.guest_id, (select gender_code as c2 from guests group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.gender_code = t0.c2 ord...
{ "index": 2005, "split": "train" }
Which three customers have the highest average loan amounts of at least 3000, listed in order of their average loan size?
loan_1
select cust_id as c0 from loan group by c0 having avg(amount) >= 3000 order by avg(amount) 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": "loan_1", "sql": "select cust_id as c0 from loan group by c0 having avg(amount) >= 3000 order by avg(amount) asc nulls last limit 3" }, "style": "rule" }
{ "index": 892, "split": "train" }
Which three opening hours are associated with either parking or the attraction with the highest average location ID, including the highest location ID values, with results sorted by opening hours, placing any nulls last?
cre_Theme_park
select t0.opening_hours as c0, max(t0.location_id) from tourist_attractions as t0, (select name as c1 from tourist_attractions group by c1 order by avg(location_id) desc limit 1) as t0 where t0.name = 'parking' or t0.name = t0.c1 group by c0 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_Theme_park", "sql": "select t0.opening_hours as c0, max(t0.location_id) from tourist_attractions as t0, (select name as c1 from tourist_attractions group by c1 order by avg(location_id) desc limit 1) as t0 where t0.name = 'parking' or t0.name = t0.c1 group by c0 order by c0 a...
{ "index": 29, "split": "train" }
Which are the top three books (including their titles and authors or editors) from book clubs that are associated with the most frequently occurring movie linked to book clubs ending with "5," sorted alphabetically by the author or editor?
culture_company
select t0.book_title, t0.author_or_editor as c2 from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id, (select movie_id as c1 from culture_company where book_club_id like '%5' group by c1 order by count(*) desc limit 1) as t0 where t1.movie_id = t0.c1 order by c2 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "culture_company", "sql": "select t0.book_title, t0.author_or_editor as c2 from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id, (select movie_id as c1 from culture_company where book_club_id like '%5' group by c1 order by count(*) desc limit 1) as ...
{ "index": 1659, "split": "train" }
Among browsers ending with "Safari," how does the third most recent minimum compatible year compare?
browser_web
select t1.c5, t1.c2 as c0 from (select row_number() over (order by t0.c3 desc) as c5, t0.c1 as c2 from (select t0.id as c1, min(t1.compatible_since_year) as c3 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id where t0.name like '%Safari' group by c1) as t0) as t1 where c0 = 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": "browser_web", "sql": "select t1.c5, t1.c2 as c0 from (select row_number() over (order by t0.c3 desc) as c5, t0.c1 as c2 from (select t0.id as c1, min(t1.compatible_since_year) as c3 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id where t0.nam...
{ "index": 3465, "split": "train" }
How many days passed between the date when policy 301 was opened and the date it was closed?
insurance_fnol
select julianday(t1.c0) - julianday(t0.c1) from (select date_closed as c0 from customers_policies where policy_id = 301 and policy_id = 301) as t1, (select date_opened as c1 from customers_policies) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_fnol", "sql": "select julianday(t1.c0) - julianday(t0.c1) from (select date_closed as c0 from customers_policies where policy_id = 301 and policy_id = 301) as t1, (select date_opened as c1 from customers_policies) as t0" }, "style": "rule" }
{ "index": 3878, "split": "train" }
What are the dorm ID, capacity, and gender of dorms that have amenities with an ID greater than 922, specifically for the dorm with ID 100?
dorm_1
select distinct t0.dormid, t0.student_capacity, t0.gender from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where t1.amenid > 922 and t1.dormid = 100
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select distinct t0.dormid, t0.student_capacity, t0.gender from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where t1.amenid > 922 and t1.dormid = 100" }, "style": "rule" }
{ "index": 220, "split": "train" }
How much larger is the highest file ID of Farida's songs compared to Enrique's songs that have a resolution over 320?
music_1
select t1.c1 - t0.c1 from (select max(t1.f_id) as c1 from artist as t0 join song as t1 on t0.artist_name = t1.artist_name where t0.artist_name = 'Enrique' and t1.resolution > 320 group by t0.artist_name) as t1, (select t0.artist_name, max(t1.f_id) as c1 from artist as t0 join song as t1 on t0.artist_name = t1.artist_na...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t1.c1 - t0.c1 from (select max(t1.f_id) as c1 from artist as t0 join song as t1 on t0.artist_name = t1.artist_name where t0.artist_name = 'Enrique' and t1.resolution > 320 group by t0.artist_name) as t1, (select t0.artist_name, max(t1.f_id) as c1 from art...
{ "index": 3897, "split": "train" }
Which department numbers are either associated with faculty memberships where the department isn't listed in the Department table, or belong to courses with department numbers less than 600?
college_3
select anon_1.c0 from (select dno as c0 from member_of where (not c0 in (select c0 from department)) union select dno as c2 from course where c2 < 600) 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": "college_3", "sql": "select anon_1.c0 from (select dno as c0 from member_of where (not c0 in (select c0 from department)) union select dno as c2 from course where c2 < 600) as anon_1" }, "style": "rule" }
{ "index": 1266, "split": "train" }
Is the number of unique photos taken with camera lens 1 less than 4?
mountain_photos
select t0.c1 < 4 from (select count(distinct (t1.id)) as c1 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t0.id = 1 group by t0.id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "mountain_photos", "sql": "select t0.c1 < 4 from (select count(distinct (t1.id)) as c1 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t0.id = 1 group by t0.id) as t0" }, "style": "rule" }
{ "index": 3344, "split": "train" }
What are the names of the members and the total of their membership levels, grouped by each member's name?
shop_membership
select name as c1, sum(level) from member 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": "shop_membership", "sql": "select name as c1, sum(level) from member group by c1" }, "style": "rule" }
{ "index": 171, "split": "train" }
Which are the first five products (by product id) that were closed by staff member Ashley Medhurst? For each of these products, what is the product id, the product name, and the staff id of the person who authorized the closure?
tracking_software_problems
select t0.product_id as c0, t0.product_name, t1.closure_authorised_by_staff_id from product as t0 join problems as t1 on t0.product_id = t1.product_id join staff as t2 on t1.closure_authorised_by_staff_id = t2.staff_id where t2.staff_first_name = 'Ashley' and t2.staff_last_name = 'Medhurst' order by c0 asc nulls last l...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t0.product_id as c0, t0.product_name, t1.closure_authorised_by_staff_id from product as t0 join problems as t1 on t0.product_id = t1.product_id join staff as t2 on t1.closure_authorised_by_staff_id = t2.staff_id where t2.staff_first_nam...
{ "index": 2377, "split": "train" }
What is the percentage change in the sum of the highest apartment IDs associated with guests between their bookings ending on the morning of October 7, 2017, at 11:38 AM, and their bookings ending later that evening at 8:47 PM?
apartment_rentals
select (sum(t0.c2) / cast(sum(t1.c2) as real) - 1) * 100 from (select max(t1.apt_id) as c2 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where t1.booking_end_date = '2017-10-07 20:47:19' group by t0.guest_id) as t0, (select t0.guest_id, max(t1.apt_id) as c2 from guests as t0 join apartmen...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (sum(t0.c2) / cast(sum(t1.c2) as real) - 1) * 100 from (select max(t1.apt_id) as c2 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where t1.booking_end_date = '2017-10-07 20:47:19' group by t0.guest_id) as t0, (sele...
{ "index": 3000, "split": "train" }
What are the ratings and durations of songs that have file sizes exactly 4.10 MB or start with 3.78 MB?
music_1
select t0.rating, t1.duration from song as t0 join files as t1 on t0.f_id = t1.f_id where t1.file_size = '4.10 MB' or t1.file_size like '3.78%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t0.rating, t1.duration from song as t0 join files as t1 on t0.f_id = t1.f_id where t1.file_size = '4.10 MB' or t1.file_size like '3.78%'" }, "style": "rule" }
{ "index": 247, "split": "train" }
How many days elapsed between the race time and the race date?
formula_1
select julianday(t1.c0) - julianday(t0.c1) from (select time as c0 from races) as t1, (select date as c1 from races) 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": "formula_1", "sql": "select julianday(t1.c0) - julianday(t0.c1) from (select time as c0 from races) as t1, (select date as c1 from races) as t0" }, "style": "rule" }
{ "index": 3713, "split": "train" }
Which are the first 10 course IDs that have fewer than four different credits, taught by instructors with IDs less than 9379, with the results sorted alphabetically? For each, how many unique credit values are associated?
college_3
select cid as c1, count(distinct (credits)) from course where instructor < 9379 group by c1 having count(distinct (credits)) < 4 order by c1 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_3", "sql": "select cid as c1, count(distinct (credits)) from course where instructor < 9379 group by c1 having count(distinct (credits)) < 4 order by c1 asc nulls last limit 10" }, "style": "rule" }
{ "index": 624, "split": "train" }
What is the difference between the total number of compatible years for browser 1 and the lowest total compatible years among all browsers?
browser_web
select t2.c0 - t0.c2 from (select min(t1.c2) as c0 from (select sum(t1.compatible_since_year) as c2 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id group by t0.id) as t1) as t2, (select t0.id, sum(t1.compatible_since_year) as c2 from browser as t0 join accelerator_compatible_browse...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c0 - t0.c2 from (select min(t1.c2) as c0 from (select sum(t1.compatible_since_year) as c2 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id group by t0.id) as t1) as t2, (select t0.id, sum(t1.compatible_since_yea...
{ "index": 3182, "split": "train" }
Among stations with a latitude of at least 37.337391, what is the rank of the station that has the 61st lowest minimum number of bikes available?
bike_1
select t1.c1, t1.c0 as c4 from (select row_number() over (order by t0.c3 asc nulls last) as c1, t0.c2 as c0 from (select t0.id as c2, min(t1.bikes_available) as c3 from station as t0 join status as t1 on t0.id = t1.station_id where t0.lat >= 37.337391 group by c2) as t0) as t1 where c4 = 61
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select t1.c1, t1.c0 as c4 from (select row_number() over (order by t0.c3 asc nulls last) as c1, t0.c2 as c0 from (select t0.id as c2, min(t1.bikes_available) as c3 from station as t0 join status as t1 on t0.id = t1.station_id where t0.lat >= 37.337391 group by c2...
{ "index": 3464, "split": "train" }
What are the details and dates of the 10 most recent invoices with shipment dates earlier than April 1, 1991, sorted by invoice date in descending order?
tracking_orders
select t0.invoice_details, t0.invoice_date as c1 from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where t1.shipment_date < '1991-04-01 15:24:24' order by c1 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.invoice_details, t0.invoice_date as c1 from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where t1.shipment_date < '1991-04-01 15:24:24' order by c1 desc limit 10" }, "style": "rule" }
{ "index": 2831, "split": "train" }
Which station has the fewest different numbers of bikes available across all its status records?
bike_1
select station_id as c0 from status group by c0 order by count(distinct (bikes_available)) 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": "bike_1", "sql": "select station_id as c0 from status group by c0 order by count(distinct (bikes_available)) asc nulls last limit 1" }, "style": "rule" }
{ "index": 2827, "split": "train" }
What are the unique details of all sales transactions?
tracking_share_transactions
select distinct sales_details from sales
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct sales_details from sales" }, "style": "rule" }
{ "index": 938, "split": "train" }
If you add up all the camera lens IDs for photos taken with camera lens 7 and then subtract 40, how much is that difference?
mountain_photos
select t0.c1 - 40 from (select sum(t1.camera_lens_id) as c1 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t0.id = 7 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": "mountain_photos", "sql": "select t0.c1 - 40 from (select sum(t1.camera_lens_id) as c1 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t0.id = 7 group by t0.id) as t0" }, "style": "rule" }
{ "index": 3243, "split": "train" }
Can you provide the list of names that appear either as cities or as counties in the public safety data?
county_public_safety
select anon_1.c1 from (select name as c1 from city union select name from county_public_safety) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "county_public_safety", "sql": "select anon_1.c1 from (select name as c1 from city union select name from county_public_safety) as anon_1" }, "style": "rule" }
{ "index": 2876, "split": "train" }
Can you list the top three software platforms, carriers, device IDs, and stock quantities for devices sold in shops that opened in the earliest year among all shops or in 2007 or earlier, sorted by the largest stock quantities?
device
select t0.software_platform, t0.carrier, t1.device_id, t1.quantity as c4 from device as t0 join stock as t1 on t0.device_id = t1.device_id join shop as t2 on t1.shop_id = t2.shop_id, (select min(open_year) as c1 from shop) as t0 where t2.open_year <= t0.c1 or t2.open_year <= 2007 order by c4 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": "device", "sql": "select t0.software_platform, t0.carrier, t1.device_id, t1.quantity as c4 from device as t0 join stock as t1 on t0.device_id = t1.device_id join shop as t2 on t1.shop_id = t2.shop_id, (select min(open_year) as c1 from shop) as t0 where t2.open_year <= t0.c1 or t2....
{ "index": 1310, "split": "train" }
How many different membership cards do members aged 50 or older have at each address?
coffee_shop
select address as c1, count(distinct (membership_card)) from member where age >= 50 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": "coffee_shop", "sql": "select address as c1, count(distinct (membership_card)) from member where age >= 50 group by c1" }, "style": "rule" }
{ "index": 2671, "split": "train" }
What are the partition IDs and user IDs of tweets that either have the text "Today I have went shopping at Laffayette." or contain the most commonly shared tweet text based on the highest average user ID?
twitter_1
select t0.partitionid, t1.uid from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid, (select text as c2 from tweets group by c2 order by avg(uid) desc limit 1) as t0 where t1.text = 'Today I have went shopping at Laffayette.' or t1.text = 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": "twitter_1", "sql": "select t0.partitionid, t1.uid from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid, (select text as c2 from tweets group by c2 order by avg(uid) desc limit 1) as t0 where t1.text = 'Today I have went shopping at Laffayette.' or t1.text = t0.c2" }, ...
{ "index": 769, "split": "train" }
What are the top 5 SportsInfo records showing the number of games played and scholarship status, along with student IDs and hours spent playing specific games whose type starts with "Fris" or ends with "card game," sorted by the number of games played?
game_1
select t0.gamesplayed as c1, t0.onscholarship, t2.stuid, t2.hours_played from sportsinfo as t0 join student as t1 on t0.stuid = t1.stuid join plays_games as t2 on t1.stuid = t2.stuid join video_games as t3 on t2.gameid = t3.gameid where t3.gtype like 'Fris%' or t3.gtype like '%card game' order by c1 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_1", "sql": "select t0.gamesplayed as c1, t0.onscholarship, t2.stuid, t2.hours_played from sportsinfo as t0 join student as t1 on t0.stuid = t1.stuid join plays_games as t2 on t1.stuid = t2.stuid join video_games as t3 on t2.gameid = t3.gameid where t3.gtype like 'Fris%' or t...
{ "index": 1699, "split": "train" }
What is the difference between the average price of 3-star hotels and 113,509,913.48?
cre_Theme_park
select t0.c1 - 113509913.48 from (select avg(t1.price_range) as c1 from ref_hotel_star_ratings as t0 join hotels as t1 on t0.star_rating_code = t1.star_rating_code where t0.star_rating_code = 3 group by t0.star_rating_code) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Theme_park", "sql": "select t0.c1 - 113509913.48 from (select avg(t1.price_range) as c1 from ref_hotel_star_ratings as t0 join hotels as t1 on t0.star_rating_code = t1.star_rating_code where t0.star_rating_code = 3 group by t0.star_rating_code) as t0" }, "style": "rule" }
{ "index": 3834, "split": "train" }
How many distinct stations are included in routes operated by the trains?
station_weather
select count(distinct (station_id)) from route where train_id in (select id as c0 from train)
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select count(distinct (station_id)) from route where train_id in (select id as c0 from train)" }, "style": "rule" }
{ "index": 2170, "split": "train" }