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 investor, among those with transactions at or below 302,507.6996, has the highest minimum transaction amount? Please provide their details and investor ID.
tracking_share_transactions
select t0.investor_details, t0.investor_id as c0 from investors as t0 join transactions as t1 on t0.investor_id = t1.investor_id where t1.amount_of_transaction <= 302507.6996 group by c0 order by min(t1.amount_of_transaction) 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": "tracking_share_transactions", "sql": "select t0.investor_details, t0.investor_id as c0 from investors as t0 join transactions as t1 on t0.investor_id = t1.investor_id where t1.amount_of_transaction <= 302507.6996 group by c0 order by min(t1.amount_of_transaction) desc limit 1" ...
{ "index": 1941, "split": "train" }
Which members, along with their roles, have attended at least one performance, excluding the member with ID 2?
performance_attendance
select anon_1.c1, anon_1.c0 from (select t0.member_id as c1, t0.role as c0 from member as t0 join member_attendance as t1 on t0.member_id = t1.member_id where t1.member_id in (select c1 as c1 from member) except select t0.member_id as c1, t0.role as c0 from member as t0 join member_attendance as t1 on t0.member_id = t1...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "performance_attendance", "sql": "select anon_1.c1, anon_1.c0 from (select t0.member_id as c1, t0.role as c0 from member as t0 join member_attendance as t1 on t0.member_id = t1.member_id where t1.member_id in (select c1 as c1 from member) except select t0.member_id as c1, t0.role ...
{ "index": 1092, "split": "train" }
Can you tell me the names of the first five routes with route IDs 13350 or 35343, showing their source and destination airports, sorted alphabetically by the destination airport name?
flight_4
select src_apid, dst_apid from routes where rid = 13350 or rid = 35343 order by dst_ap asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select src_apid, dst_apid from routes where rid = 13350 or rid = 35343 order by dst_ap asc nulls last limit 5" }, "style": "rule" }
{ "index": 790, "split": "train" }
How many days passed from the date a claim was made to the date it was settled?
insurance_policies
select julianday(t1.c3) - julianday(t0.c0) from (select date_claim_settled as c3 from claims) as t1, (select date_claim_made as c0 from claims) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_policies", "sql": "select julianday(t1.c3) - julianday(t0.c0) from (select date_claim_settled as c3 from claims) as t1, (select date_claim_made as c0 from claims) as t0" }, "style": "rule" }
{ "index": 3985, "split": "train" }
Which customers have booked the most products? For each, provide their coupon ID, gender, first name, and the total number of products they have booked, listed from those with the highest bookings to the lowest.
products_for_hire
select t0.coupon_id, t0.gender_mf, t0.first_name, count(t2.booked_amount) as c0 from customers as t0 join bookings as t1 on t0.customer_id = t1.customer_id join products_booked as t2 on t1.booking_id = t2.booking_id group by t0.customer_id order by c0 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select t0.coupon_id, t0.gender_mf, t0.first_name, count(t2.booked_amount) as c0 from customers as t0 join bookings as t1 on t0.customer_id = t1.customer_id join products_booked as t2 on t1.booking_id = t2.booking_id group by t0.customer_id order by c0 ...
{ "index": 1550, "split": "train" }
Can you tell me the budgets and building locations of departments that include courses with 4 credits or less than 3 credits?
college_2
select t0.budget, t0.building from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.credits between 4 and 4 or t1.credits < 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_2", "sql": "select t0.budget, t0.building from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.credits between 4 and 4 or t1.credits < 3" }, "style": "rule" }
{ "index": 631, "split": "train" }
Can you tell me the first five building statuses, either from buildings with IDs not found in the buildings table or from the most frequently used building, sorted alphabetically by status?
company_office
select t0.status as c2 from buildings as t0 join office_locations as t1 on t0.id = t1.building_id, (select building_id as c0 from office_locations group by c0 order by count(*) desc limit 1) as t0 where (not t1.building_id in (select t0.id as c1 from buildings)) or t1.building_id = t0.c0 order by c2 asc nulls last limi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select t0.status as c2 from buildings as t0 join office_locations as t1 on t0.id = t1.building_id, (select building_id as c0 from office_locations group by c0 order by count(*) desc limit 1) as t0 where (not t1.building_id in (select t0.id as c1 from buil...
{ "index": 1477, "split": "train" }
Is the train with ID 10 assigned a train number lower than the average train number across all trains?
station_weather
select t2.c2 < t1.c3 from (select train_number as c2 from train where id = 10) as t2, (select avg(train_number) as c3 from train) 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.c2 < t1.c3 from (select train_number as c2 from train where id = 10) as t2, (select avg(train_number) as c3 from train) as t1" }, "style": "rule" }
{ "index": 3322, "split": "train" }
Which five vehicle and customer pairs are associated with lessons numbered 4 or 5, sorted by the vehicle details in alphabetical order?
driving_school
select t0.vehicle_id, t1.customer_id from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id where t1.lesson_id = 4 or t1.lesson_id = 5 order by t0.vehicle_details 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": "driving_school", "sql": "select t0.vehicle_id, t1.customer_id from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id where t1.lesson_id = 4 or t1.lesson_id = 5 order by t0.vehicle_details asc nulls last limit 5" }, "style": "rule" }
{ "index": 2045, "split": "train" }
What are the various Char Cell counts available for the different screen modes?
phone_1
select distinct char_cells from screen_mode
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "phone_1", "sql": "select distinct char_cells from screen_mode" }, "style": "rule" }
{ "index": 2600, "split": "train" }
Which are the five film IDs and their corresponding category IDs with the lowest category IDs?
sakila_1
select film_id, category_id as c0 from film_category 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": "sakila_1", "sql": "select film_id, category_id as c0 from film_category order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 748, "split": "train" }
Among counties with a population under 90,000, which county ID occurs the fewest times?
election
select t0.c2 as c1, count(distinct (t0.c2)) as c0 from (select county_id as c2 from county where population < 90000.0) as t0 group by c1 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "election", "sql": "select t0.c2 as c1, count(distinct (t0.c2)) as c0 from (select county_id as c2 from county where population < 90000.0) as t0 group by c1 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 3664, "split": "train" }
Which teachers with IDs between 5 and 10, who started detentions before February 19, 2018 at 11:44:52, have how many detention records, and what are their last names and teacher IDs?
behavior_monitoring
select t0.last_name, t0.teacher_id as c1, count(*) from teachers as t0 join detention as t1 on t0.teacher_id = t1.teacher_id where t1.datetime_detention_start < '2018-02-19 11:44:52' and t1.teacher_id between 5 and 10 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": "behavior_monitoring", "sql": "select t0.last_name, t0.teacher_id as c1, count(*) from teachers as t0 join detention as t1 on t0.teacher_id = t1.teacher_id where t1.datetime_detention_start < '2018-02-19 11:44:52' and t1.teacher_id between 5 and 10 group by c1" }, "style": "ru...
{ "index": 2090, "split": "train" }
Which three medicines have the fewest enzyme interactions, and how many interactions does each of these medicines have?
medicine_enzyme_interaction
select count(distinct (t0.medicine_id)), count(*) as c2 from medicine_enzyme_interaction as t0, (select medicine_id as c0 from medicine_enzyme_interaction group by c0 order by count(*) asc nulls last limit 1) as t0 where t0.medicine_id = t0.c0 order by c2 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select count(distinct (t0.medicine_id)), count(*) as c2 from medicine_enzyme_interaction as t0, (select medicine_id as c0 from medicine_enzyme_interaction group by c0 order by count(*) asc nulls last limit 1) as t0 where t0.medicine_id = t0.c...
{ "index": 2718, "split": "train" }
Which state, province, and county are associated with addresses that either have an employee assigned to them (with an address ID of 1 or higher) or do not have any corresponding address record?
customer_deliveries
select t0.state_province_county from addresses as t0 join employees as t1 on t0.address_id = t1.employee_address_id where t1.employee_address_id >= 1 or (not t1.employee_address_id in (select t0.address_id as c1 from addresses))
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_deliveries", "sql": "select t0.state_province_county from addresses as t0 join employees as t1 on t0.address_id = t1.employee_address_id where t1.employee_address_id >= 1 or (not t1.employee_address_id in (select t0.address_id as c1 from addresses))" }, "style": "rul...
{ "index": 61, "split": "train" }
How many products and orders are associated with products that have details containing "ve Cho," and how many unique order quantities are used in these orders?
customers_and_addresses
select count(t0.product_id), count(t0.order_id), count(distinct (t0.order_quantity)) from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_details like '%ve Cho%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(t0.product_id), count(t0.order_id), count(distinct (t0.order_quantity)) from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_details like '%ve Cho%'" }, "style": "rule" }
{ "index": 1216, "split": "train" }
How many days have passed between the 'Date From' and 'Date To' for address records with ID less than 3?
customers_and_products_contacts
select julianday(t1.c0) - julianday(t0.c2) from (select date_from as c0 from customer_address_history) as t1, (select date_to as c2 from customer_address_history where address_id < 3 and address_id < 3) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select julianday(t1.c0) - julianday(t0.c2) from (select date_from as c0 from customer_address_history) as t1, (select date_to as c2 from customer_address_history where address_id < 3 and address_id < 3) as t0" }, "style": "rule" }
{ "index": 3695, "split": "train" }
Which three product categories have the highest number of associated characteristics, and what are their units of measure, category codes, and descriptions?
products_gen_characteristics
select t0.unit_of_measure, t0.product_category_code as c0, t0.product_category_description, count(t2.characteristic_id) as c2 from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code join product_characteristics as t2 on t1.product_id = t2.product_id group by c0 order...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select t0.unit_of_measure, t0.product_category_code as c0, t0.product_category_description, count(t2.characteristic_id) as c2 from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code join p...
{ "index": 4, "split": "train" }
For the stores, what are their names and address IDs, along with the state, county, and city or town of the addresses where performers with address IDs of 207 or higher are located?
cre_Drama_Workshop_Groups
select t0.store_name, t0.address_id, t1.state_county, t1.city_town from stores as t0 join addresses as t1 on t0.address_id = t1.address_id join performers as t2 on t1.address_id = t2.address_id where t2.address_id >= 207
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_name, t0.address_id, t1.state_county, t1.city_town from stores as t0 join addresses as t1 on t0.address_id = t1.address_id join performers as t2 on t1.address_id = t2.address_id where t2.address_id >= 207" }, "style": "rule"...
{ "index": 936, "split": "train" }
What is the percentage change in the smallest total tourist ID sum among visitors between November 26, 1980, at 02:08 AM and September 3, 2007, at 04:30 AM?
cre_Theme_park
select (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select sum(t1.tourist_id) as c0 from visitors as t0 join visits as t1 on t0.tourist_id = t1.tourist_id where t1.visit_date = '2007-09-03 04:30:01' group by t0.tourist_id) as t0, (select t0.tourist_id, sum(t1.tourist_id) as c0 from visitors as t0 join visits...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select sum(t1.tourist_id) as c0 from visitors as t0 join visits as t1 on t0.tourist_id = t1.tourist_id where t1.visit_date = '2007-09-03 04:30:01' group by t0.tourist_id) as t0, (select t0.tou...
{ "index": 3017, "split": "train" }
Is the smallest customer ID for customer 15 greater than 8?
customers_and_invoices
select t0.c1 > 8 from (select min(t1.customer_id) as c1 from customers as t0 join accounts as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 15 group by t0.customer_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t0.c1 > 8 from (select min(t1.customer_id) as c1 from customers as t0 join accounts as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 15 group by t0.customer_id) as t0" }, "style": "rule" }
{ "index": 3291, "split": "train" }
What is the highest number of account details associated with accounts that have a statement ID of 57 or greater?
cre_Docs_and_Epenses
select count(account_details) as c0 from accounts where statement_id >= 57 order by c0 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Docs_and_Epenses", "sql": "select count(account_details) as c0 from accounts where statement_id >= 57 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 386, "split": "train" }
Does the total of card IDs for account 10 exceed 2?
customers_card_transactions
select t0.c1 > 2 from (select sum(t1.card_id) as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 10 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_card_transactions", "sql": "select t0.c1 > 2 from (select sum(t1.card_id) as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 10 group by t0.account_id) as t0" }, "style": "rule" }
{ "index": 3293, "split": "train" }
What is the number of days between the asset's disposed date and its acquired date for assets made by companies whose names contain two 'C's?
assets_maintenance
select julianday(t1.c0) - julianday(t0.c1) from (select asset_disposed_date as c0 from assets) as t1, (select asset_acquired_date as c1 from assets where asset_make like '%C%' and asset_make like '%C%') as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select julianday(t1.c0) - julianday(t0.c1) from (select asset_disposed_date as c0 from assets) as t1, (select asset_acquired_date as c1 from assets where asset_make like '%C%' and asset_make like '%C%') as t0" }, "style": "rule" }
{ "index": 3852, "split": "train" }
Looking at courses, what are the days they meet, their credit hours, and department numbers, along with the grade and student IDs of students enrolled in those courses who have a grade point less than 1.0?
college_3
select t0.days, t0.credits, t0.dno, t1.grade, t1.stuid from course as t0 join enrolled_in as t1 on t0.cid = t1.cid join gradeconversion as t2 on t1.grade = t2.lettergrade where t2.gradepoint < 1.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": "college_3", "sql": "select t0.days, t0.credits, t0.dno, t1.grade, t1.stuid from course as t0 join enrolled_in as t1 on t0.cid = t1.cid join gradeconversion as t2 on t1.grade = t2.lettergrade where t2.gradepoint < 1.0" }, "style": "rule" }
{ "index": 568, "split": "train" }
Which three markets have the lowest maximum number of shops, and what are their market IDs?
phone_market
select count(market_id) from market order by max(num_of_shops) 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": "phone_market", "sql": "select count(market_id) from market order by max(num_of_shops) asc nulls last limit 3" }, "style": "rule" }
{ "index": 2640, "split": "train" }
For each location where the annual entry and exit count is exactly 20.551, what are those locations and their minimum annual interchanges?
train_station
select location as c1, min(annual_interchanges) from station where annual_entry_exit = 20.551 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": "train_station", "sql": "select location as c1, min(annual_interchanges) from station where annual_entry_exit = 20.551 group by c1" }, "style": "rule" }
{ "index": 1436, "split": "train" }
Which owners and program names are shared between the list of all programs and those broadcast on channels whose names include the letter "T"?
program_share
select anon_1.c1, anon_1.c0 from (select owner as c1, name as c0 from program intersect select t0.owner as c1, t0.name as c0 from program as t0 join broadcast as t1 on t0.program_id = t1.program_id join channel as t2 on t1.channel_id = t2.channel_id where t2.name like '%T%') 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": "program_share", "sql": "select anon_1.c1, anon_1.c0 from (select owner as c1, name as c0 from program intersect select t0.owner as c1, t0.name as c0 from program as t0 join broadcast as t1 on t0.program_id = t1.program_id join channel as t2 on t1.channel_id = t2.channel_id where ...
{ "index": 1281, "split": "train" }
List the heights of all buildings where the company with ID 9 has an office.
company_office
select t0.height from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where t1.company_id = 9
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select t0.height from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where t1.company_id = 9" }, "style": "rule" }
{ "index": 2748, "split": "train" }
What are the valid to date, valid from date, and card type for the card linked to transactions with account IDs between 4 and 8 that has the most recent valid to date?
customers_card_transactions
select t0.date_valid_to as c0, t0.date_valid_from, t0.card_type_code from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.account_id between 4 and 8 order by c0 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select t0.date_valid_to as c0, t0.date_valid_from, t0.card_type_code from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.account_id between 4 and 8 order by c0 desc limit 1" }, "style": "rule" ...
{ "index": 692, "split": "train" }
For customer 6, how many different orders have they placed?
department_store
select t0.c1 from (select count(distinct (t1.order_id)) as c1 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 6 group by t0.customer_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select t0.c1 from (select count(distinct (t1.order_id)) as c1 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 6 group by t0.customer_id) as t0" }, "style": "rule" }
{ "index": 3374, "split": "train" }
Did customer 6 open their account after customer 7 did?
customers_and_invoices
select t1.c0 > t0.c0 from (select date_account_opened as c0 from accounts where account_id = 6) as t1, (select date_account_opened as c0 from accounts where account_id = 7) 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 t1.c0 > t0.c0 from (select date_account_opened as c0 from accounts where account_id = 6) as t1, (select date_account_opened as c0 from accounts where account_id = 7) as t0" }, "style": "rule" }
{ "index": 3076, "split": "train" }
What are the store IDs, district IDs, and store product IDs for the three stores with products that have pages per minute color between 10.0 and 28.0, when sorted by store ID, showing the last three?
store_product
select t0.store_id, t0.district_id, t2.store_id as c2 from store_district as t0 join store as t1 on t0.store_id = t1.store_id join store_product as t2 on t1.store_id = t2.store_id join product as t3 on t2.product_id = t3.product_id where t3.pages_per_minute_color between 10.0 and 28.0 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": "store_product", "sql": "select t0.store_id, t0.district_id, t2.store_id as c2 from store_district as t0 join store as t1 on t0.store_id = t1.store_id join store_product as t2 on t1.store_id = t2.store_id join product as t3 on t2.product_id = t3.product_id where t3.pages_per_minut...
{ "index": 1631, "split": "train" }
What is the source user ID 6's total trust score from users with target user IDs of 2 or higher?
epinions_1
select source_u_id as c0, sum(trust) from trust where target_u_id >= 2 and c0 = 6 group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "epinions_1", "sql": "select source_u_id as c0, sum(trust) from trust where target_u_id >= 2 and c0 = 6 group by c0" }, "style": "rule" }
{ "index": 1391, "split": "train" }
Which customers with bookings numbered between 1 and 14 are there? Please list their first names, gender, and customer IDs.
products_for_hire
select t0.first_name, t0.gender_mf from customers as t0 join payments as t1 on t0.customer_id = t1.customer_id where t1.booking_id between 1 and 14
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select t0.first_name, t0.gender_mf from customers as t0 join payments as t1 on t0.customer_id = t1.customer_id where t1.booking_id between 1 and 14" }, "style": "rule" }
{ "index": 458, "split": "train" }
How many elections took place in 1946?
election_representative
select count(*) from election where date = '1946'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_representative", "sql": "select count(*) from election where date = '1946'" }, "style": "rule" }
{ "index": 1212, "split": "train" }
Which clubs have both members with stuid less than or equal to 1008 and members with stuid greater than or equal to 1001? For these clubs, what are their locations and descriptions?
club_1
select anon_1.c1, anon_1.c0 from (select t0.clublocation as c1, t0.clubdesc as c0 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid where t1.stuid <= 1008 intersect select t0.clublocation as c1, t0.clubdesc as c0 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid where t1.stuid >= 1001)...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "club_1", "sql": "select anon_1.c1, anon_1.c0 from (select t0.clublocation as c1, t0.clubdesc as c0 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid where t1.stuid <= 1008 intersect select t0.clublocation as c1, t0.clubdesc as c0 from club as t0 join member_of_cl...
{ "index": 164, "split": "train" }
What is the total amount paid, along with the date they became customers and their customer IDs, for customers born before November 7, 1996, or exactly on August 30, 1996?
driving_school
select sum(t0.amount_payment), t1.date_became_customer, t1.customer_id as c1 from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_of_birth < '1996-11-07 05:30:55' or t1.date_of_birth = '1996-08-30 06:17: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": "driving_school", "sql": "select sum(t0.amount_payment), t1.date_became_customer, t1.customer_id as c1 from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_of_birth < '1996-11-07 05:30:55' or t1.date_of_birth = '1996-08-30 06:17:50' gr...
{ "index": 234, "split": "train" }
What is the total number of unique tweets posted by Tyler Swift?
twitter_1
select count(distinct (t0.text)) as c0 from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid where t1.name = 'Tyler Swift' order by c0 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "twitter_1", "sql": "select count(distinct (t0.text)) as c0 from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid where t1.name = 'Tyler Swift' order by c0 desc" }, "style": "rule" }
{ "index": 625, "split": "train" }
Did the song "My Love" come out after the song "Just Beat It"?
music_1
select t1.c2 > t0.c2 from (select releasedate as c2 from song where song_name = 'My love') as t1, (select releasedate as c2 from song where song_name = 'Just beat it') as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t1.c2 > t0.c2 from (select releasedate as c2 from song where song_name = 'My love') as t1, (select releasedate as c2 from song where song_name = 'Just beat it') as t0" }, "style": "rule" }
{ "index": 3090, "split": "train" }
Which subjects have IDs of 2 or higher, and what are their names and IDs? Additionally, what is the average subject ID among these subjects?
e_learning
select t0.subject_name, t0.subject_id as c1, avg(t1.subject_id) from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.subject_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": "e_learning", "sql": "select t0.subject_name, t0.subject_id as c1, avg(t1.subject_id) from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.subject_id >= 2 group by c1" }, "style": "rule" }
{ "index": 1058, "split": "train" }
How many phones use the screen mode labeled as '2' in the database?
phone_1
select count(*) from phone where screen_mode = '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": "phone_1", "sql": "select count(*) from phone where screen_mode = '2'" }, "style": "rule" }
{ "index": 2468, "split": "train" }
What is the average dribbling score and the player ID for each player who weighs more than 203 and has a player ID less than 303089?
soccer_1
select avg(t0.dribbling), t1.id as c0 from player_attributes as t0 join player as t1 on t0.player_api_id = t1.player_api_id where t1.weight > 203 and t1.player_api_id < 303089 group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select avg(t0.dribbling), t1.id as c0 from player_attributes as t0 join player as t1 on t0.player_api_id = t1.player_api_id where t1.weight > 203 and t1.player_api_id < 303089 group by c0" }, "style": "rule" }
{ "index": 2102, "split": "train" }
Which players participated in tryouts at colleges with enrollment between 19,000 and 22,000, and what are their high school scores, years of college experience, and the college names?
soccer_2
select t0.ycard, t0.hs, t0.pname, t1.cname from player as t0 join tryout as t1 on t0.pid = t1.pid join college as t2 on t1.cname = t2.cname where t2.enr between 19000 and 22000
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_2", "sql": "select t0.ycard, t0.hs, t0.pname, t1.cname from player as t0 join tryout as t1 on t0.pid = t1.pid join college as t2 on t1.cname = t2.cname where t2.enr between 19000 and 22000" }, "style": "rule" }
{ "index": 232, "split": "train" }
How many different swimmers have records, and what is the lowest record ID among them?
swimming
select count(distinct (swimmer_id)), min(id) from record
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "swimming", "sql": "select count(distinct (swimmer_id)), min(id) from record" }, "style": "rule" }
{ "index": 652, "split": "train" }
Who are the top three actors with ages under 18 when listed in reverse alphabetical order, and what is the total of their ages along with their highest musical ID?
musical
select name as c1, sum(age), max(musical_id) from actor where age < 18 group by c1 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": "musical", "sql": "select name as c1, sum(age), max(musical_id) from actor where age < 18 group by c1 order by c1 desc limit 3" }, "style": "rule" }
{ "index": 1392, "split": "train" }
Which video games and their IDs are in the database but are not played by students whose city code ends with "Z"?
game_1
select anon_1.c0, anon_1.c1 from (select gname as c0, gameid as c1 from video_games except select t0.gname as c0, t0.gameid as c1 from video_games as t0 join plays_games as t1 on t0.gameid = t1.gameid join student as t2 on t1.stuid = t2.stuid where t2.city_code like '%Z') as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_1", "sql": "select anon_1.c0, anon_1.c1 from (select gname as c0, gameid as c1 from video_games except select t0.gname as c0, t0.gameid as c1 from video_games as t0 join plays_games as t1 on t0.gameid = t1.gameid join student as t2 on t1.stuid = t2.stuid where t2.city_code l...
{ "index": 2240, "split": "train" }
When were the songs with resolution at least 512 and the highest rating released?
music_1
select t0.releasedate, t0.rating as c3 from song as t0, (select max(rating) as c1 from song where resolution >= 512) as t1 where c3 = t1.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 t0.releasedate, t0.rating as c3 from song as t0, (select max(rating) as c1 from song where resolution >= 512) as t1 where c3 = t1.c1" }, "style": "rule" }
{ "index": 3866, "split": "train" }
What are the album ID, album title, track ID, and track name for the first track (sorted alphabetically by name) that has media type 3?
chinook_1
select t0.albumid, t0.title, t1.albumid, t1.name as c2 from album as t0 join track as t1 on t0.albumid = t1.albumid join mediatype as t2 on t1.mediatypeid = t2.mediatypeid where t2.mediatypeid = 3 order by c2 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "chinook_1", "sql": "select t0.albumid, t0.title, t1.albumid, t1.name as c2 from album as t0 join track as t1 on t0.albumid = t1.albumid join mediatype as t2 on t1.mediatypeid = t2.mediatypeid where t2.mediatypeid = 3 order by c2 asc nulls last limit 1" }, "style": "rule" }
{ "index": 1336, "split": "train" }
What are the top five organization type descriptions for organizations that either have the most common organization details or have details equal to 'eius', ordered alphabetically by organization type description?
tracking_grants_for_research
select t0.organisation_type_description as c0 from organisation_types as t0 join organisations as t1 on t0.organisation_type = t1.organisation_type, (select organisation_details as c1 from organisations group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.organisation_details = t0.c1 or t1.organisation_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.organisation_type_description as c0 from organisation_types as t0 join organisations as t1 on t0.organisation_type = t1.organisation_type, (select organisation_details as c1 from organisations group by c1 order by count(*) asc null...
{ "index": 1410, "split": "train" }
What are the characteristic IDs, characteristic type codes, and other characteristic details, along with the product IDs, for the top three product-characteristic pairs associated with products that have a typical buying price starting with "1200870" or containing a period, sorted by product ID in descending order?
products_gen_characteristics
select t0.characteristic_id, t0.characteristic_type_code, t0.other_characteristic_details, t1.characteristic_id, t1.product_id as c0 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id join products as t2 on t1.product_id = t2.product_id where t2.typical_buying_p...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select t0.characteristic_id, t0.characteristic_type_code, t0.other_characteristic_details, t1.characteristic_id, t1.product_id as c0 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id...
{ "index": 1663, "split": "train" }
What are the names, phone numbers, and IDs of suppliers who supply products with IDs 3 or 5, along with the highest total value of their purchases for these products?
department_store
select t0.supplier_name, t0.supplier_phone, t0.supplier_id as c2, max(t1.total_value_purchased) from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id where t1.product_id = 3 or t1.product_id = 5 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": "department_store", "sql": "select t0.supplier_name, t0.supplier_phone, t0.supplier_id as c2, max(t1.total_value_purchased) from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id where t1.product_id = 3 or t1.product_id = 5 group by c2" }, "style"...
{ "index": 1895, "split": "train" }
Which are the top five registration IDs of students who are enrolled in the most courses with IDs greater than 4 or less than or equal to 1, and how many unique such courses has each of these students enrolled in?
e_learning
select registration_id as c0, count(distinct (course_id)) as c1 from student_course_enrolment where course_id > 4 or course_id <= 1 group by 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": "e_learning", "sql": "select registration_id as c0, count(distinct (course_id)) as c1 from student_course_enrolment where course_id > 4 or course_id <= 1 group by c0 order by c1 desc limit 5" }, "style": "rule" }
{ "index": 2054, "split": "train" }
emphasizes that, too.
customers_and_addresses
select t0.order_details as c3, t0.order_id, t0.order_date, t1.customer_name from customer_orders as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.payment_method like '%Cheque' order by c3 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t0.order_details as c3, t0.order_id, t0.order_date, t1.customer_name from customer_orders as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.payment_method like '%Cheque' order by c3 desc limit 1" }, "style": "rule"...
{ "index": 1676, "split": "train" }
Which customers' cards are linked to accounts whose names start with "2," and what are their customer IDs, card IDs, and card type codes?
customers_card_transactions
select t0.customer_id, t0.card_id, t0.card_type_code from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id join accounts as t2 on t1.account_id = t2.account_id where t2.account_name like '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": "customers_card_transactions", "sql": "select t0.customer_id, t0.card_id, t0.card_type_code from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id join accounts as t2 on t1.account_id = t2.account_id where t2.account_name like '2%'" }, "style":...
{ "index": 415, "split": "train" }
What are the details of the three vehicles with lesson ID 2 and customer IDs below 9, including their lesson times, when sorted by vehicle ID?
driving_school
select t0.vehicle_id as c0, t0.vehicle_details, t1.lesson_time from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id where t1.lesson_id = 2 and t1.customer_id < 9 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": "driving_school", "sql": "select t0.vehicle_id as c0, t0.vehicle_details, t1.lesson_time from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id where t1.lesson_id = 2 and t1.customer_id < 9 order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 2112, "split": "train" }
What are the customer IDs and checking account balances of the five customers with the highest customer IDs, whose checking balances are associated with savings accounts that have balances greater than or equal to the average savings balance for customer ID 5, considering only savings balances less than 999,999,999?
small_bank_1
select t0.custid as c0, t0.balance from checking as t0 join accounts as t1 on t0.custid = t1.custid join savings as t2 on t1.custid = t2.custid, (select avg(balance) as c1 from savings where balance < 999999999.0 and custid = 5) as t0 where t2.balance >= t0.c1 order by c0 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select t0.custid as c0, t0.balance from checking as t0 join accounts as t1 on t0.custid = t1.custid join savings as t2 on t1.custid = t2.custid, (select avg(balance) as c1 from savings where balance < 999999999.0 and custid = 5) as t0 where t2.balance >= t0...
{ "index": 1601, "split": "train" }
What is the medicine ID, enzyme ID, and type of interaction for the most recent 'iv' related interaction involving medicine number 8?
medicine_enzyme_interaction
select medicine_id as c0, enzyme_id, interaction_type as c2 from medicine_enzyme_interaction where c0 = 8 and c2 like '%iv%' order by c2 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select medicine_id as c0, enzyme_id, interaction_type as c2 from medicine_enzyme_interaction where c0 = 8 and c2 like '%iv%' order by c2 desc limit 1" }, "style": "rule" }
{ "index": 2196, "split": "train" }
What are the phone numbers, IDs, and addresses of customers, along with their order IDs, for all customer orders that include products with names ending in "board"?
department_store
select t0.customer_phone, t0.customer_id, t0.customer_address, t1.order_id, t1.customer_id from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id join products as t3 on t2.product_id = t3.product_id where t3.product_name like '%board'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.customer_phone, t0.customer_id, t0.customer_address, t1.order_id, t1.customer_id from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id join products as t3 on t2.p...
{ "index": 799, "split": "train" }
For each year, what are the number of distinct games played, the highest attendance at home games, and the team names for teams whose `so` value is at least the smallest `so` among all teams or exactly the average `so`?
baseball_1
select count(distinct (t0.games)), max(t0.attendance), t1.name, t1.year as c5 from home_game as t0 join team as t1 on t0.team_id = t1.team_id, (select min(so) as c3 from team) as t1, (select avg(so) as c4 from team) as t0 where t1.so >= t1.c3 or t1.so = t0.c4 group by c5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(distinct (t0.games)), max(t0.attendance), t1.name, t1.year as c5 from home_game as t0 join team as t1 on t0.team_id = t1.team_id, (select min(so) as c3 from team) as t1, (select avg(so) as c4 from team) as t0 where t1.so >= t1.c3 or t1.so = t0.c4...
{ "index": 517, "split": "train" }
Can you list the bottom three subjects by the number of unique related subjects linked to courses with IDs 14 or 8? For each of these subjects, include the subject name, subject ID, and the count of distinct related subject IDs, sorted from the lowest to the highest count.
e_learning
select t0.subject_name, t0.subject_id as c1, count(distinct (t1.subject_id)) as c0 from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.course_id = 14 or t1.course_id = 8 group by c1 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": "e_learning", "sql": "select t0.subject_name, t0.subject_id as c1, count(distinct (t1.subject_id)) as c0 from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.course_id = 14 or t1.course_id = 8 group by c1 order by c0 asc nulls last limit 3" }, "styl...
{ "index": 2924, "split": "train" }
What are the phone numbers and email addresses of the first three staff members who handled complaints with a type code ending in "oduct Unusable," sorted by their phone numbers from lowest to highest?
customer_complaints
select t0.phone_number as c0, t0.email_address from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id where t1.complaint_type_code like '%oduct Unusable' 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": "customer_complaints", "sql": "select t0.phone_number as c0, t0.email_address from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id where t1.complaint_type_code like '%oduct Unusable' order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 713, "split": "train" }
Could you tell me the number of different genders represented, the total number of dorms, the average capacity of those dorms, and how many unique dorms the student with ID 1033 has lived in?
dorm_1
select count(distinct (t0.gender)), count(t0.dorm_name), avg(t0.student_capacity), count(distinct (t1.dormid)) from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid where t1.stuid = 1033
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(distinct (t0.gender)), count(t0.dorm_name), avg(t0.student_capacity), count(distinct (t1.dormid)) from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid where t1.stuid = 1033" }, "style": "rule" }
{ "index": 2500, "split": "train" }
What is the highest amenity ID available in each dorm that is designated for males or has a gender restriction containing "X"?
dorm_1
select max(t0.amenid), t1.dormid as c1 from has_amenity as t0 join dorm as t1 on t0.dormid = t1.dormid where t1.gender like '%M' or t1.gender like '%X%' 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": "dorm_1", "sql": "select max(t0.amenid), t1.dormid as c1 from has_amenity as t0 join dorm as t1 on t0.dormid = t1.dormid where t1.gender like '%M' or t1.gender like '%X%' group by c1" }, "style": "rule" }
{ "index": 2411, "split": "train" }
Which grape varieties are available, and what is the highest price for wines made from each grape?
wine_1
select grape as c1, max(price) from wine 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": "wine_1", "sql": "select grape as c1, max(price) from wine group by c1" }, "style": "rule" }
{ "index": 1670, "split": "train" }
What are all the different product IDs involved in events?
solvency_ii
select distinct product_id from products_in_events
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "solvency_ii", "sql": "select distinct product_id from products_in_events" }, "style": "rule" }
{ "index": 429, "split": "train" }
When was the highest payment made using a payment method that includes the letter "a"?
insurance_policies
select t0.date_payment_made, t0.amount_payment as c2 from payments as t0, (select max(amount_payment) as c1 from payments where payment_method_code like '%a%') as t1 where c2 = t1.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": "insurance_policies", "sql": "select t0.date_payment_made, t0.amount_payment as c2 from payments as t0, (select max(amount_payment) as c1 from payments where payment_method_code like '%a%') as t1 where c2 = t1.c1" }, "style": "rule" }
{ "index": 3784, "split": "train" }
Can you tell me the details, resident IDs, and service IDs from the residents_services data, including those linked to organizations that are associated with items in the Things table?
local_govt_and_lot
select anon_1.c2, anon_1.c3, anon_1.c0 from (select other_details as c2, resident_id as c3, service_id as c0 from residents_services union select t0.other_details as c2, t0.resident_id as c3, t0.service_id as c0 from residents_services as t0 join services as t1 on t0.service_id = t1.service_id join organizations as t2 ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select anon_1.c2, anon_1.c3, anon_1.c0 from (select other_details as c2, resident_id as c3, service_id as c0 from residents_services union select t0.other_details as c2, t0.resident_id as c3, t0.service_id as c0 from residents_services as t0 join serv...
{ "index": 2719, "split": "train" }
Which locations and the number of days wrestlers have held their titles for those who were eliminated by someone containing "Benja" but were not part of teams starting with "Team Orto"?
wrestler
select anon_1.c1, anon_1.c0 from (select t0.location as c1, t0.days_held as c0 from wrestler as t0 join elimination as t1 on t0.wrestler_id = t1.wrestler_id where t1.eliminated_by like '%Benja%' except select t0.location as c1, t0.days_held as c0 from wrestler as t0 join elimination as t1 on t0.wrestler_id = t1.wrestle...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "wrestler", "sql": "select anon_1.c1, anon_1.c0 from (select t0.location as c1, t0.days_held as c0 from wrestler as t0 join elimination as t1 on t0.wrestler_id = t1.wrestler_id where t1.eliminated_by like '%Benja%' except select t0.location as c1, t0.days_held as c0 from wrestler ...
{ "index": 2459, "split": "train" }
What are the customer and address IDs from the customer addresses, and the customer ID and name of customers who use either "Handheld" or "Email" as their contact channel?
customers_and_addresses
select t0.customer_id, t0.address_id, t1.customer_id, t1.customer_name from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_contact_channels as t2 on t1.customer_id = t2.customer_id where t2.channel_code = 'Handheld' or t2.channel_code = 'Email'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t0.customer_id, t0.address_id, t1.customer_id, t1.customer_name from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_contact_channels as t2 on t1.customer_id = t2.customer_id where t2.channel_...
{ "index": 273, "split": "train" }
Can you list the top five members' names and roles along with their performance and member IDs for performances hosted by the Ottawa Senators, ordered alphabetically by their names?
performance_attendance
select t0.name as c2, t0.role, t1.performance_id, t1.member_id from member as t0 join member_attendance as t1 on t0.member_id = t1.member_id join performance as t2 on t1.performance_id = t2.performance_id where t2.host = 'Ottawa Senators' order by c2 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "performance_attendance", "sql": "select t0.name as c2, t0.role, t1.performance_id, t1.member_id from member as t0 join member_attendance as t1 on t0.member_id = t1.member_id join performance as t2 on t1.performance_id = t2.performance_id where t2.host = 'Ottawa Senators' order by...
{ "index": 88, "split": "train" }
Where does the course with ID 808 rank among courses with more than 3 credits when listed from the highest credits to the lowest?
college_2
select t1.c1, t1.c2 as c0 from (select row_number() over (order by credits desc) as c1, course_id as c2 from course where credits > 3) as t1 where c0 = 808
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_2", "sql": "select t1.c1, t1.c2 as c0 from (select row_number() over (order by credits desc) as c1, course_id as c2 from course where credits > 3) as t1 where c0 = 808" }, "style": "rule" }
{ "index": 3995, "split": "train" }
What are the ten zip postcodes linked to staff members who either have the most common middle name or have a middle name starting with "Mad"? List these zip codes in order from A to Z.
driving_school
select t0.zip_postcode as c1 from addresses as t0 join staff as t1 on t0.address_id = t1.staff_address_id, (select middle_name as c0 from staff group by c0 order by count(*) desc limit 1) as t0 where t1.middle_name = t0.c0 or t1.middle_name like 'Mad%' 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": "driving_school", "sql": "select t0.zip_postcode as c1 from addresses as t0 join staff as t1 on t0.address_id = t1.staff_address_id, (select middle_name as c0 from staff group by c0 order by count(*) desc limit 1) as t0 where t1.middle_name = t0.c0 or t1.middle_name like 'Mad%' or...
{ "index": 1661, "split": "train" }
Show the customer ID, address ID, and start date for address history entries that belong to customers who have ordered products with "gucci" in their name.
customers_and_products_contacts
select anon_1.c2, anon_1.c1, anon_1.c0 from (select customer_id as c2, address_id as c1, date_from as c0 from customer_address_history intersect select t0.customer_id as c2, t0.address_id as c1, t0.date_from as c0 from customer_address_history as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select customer_id as c2, address_id as c1, date_from as c0 from customer_address_history intersect select t0.customer_id as c2, t0.address_id as c1, t0.date_from as c0 from customer_address_hi...
{ "index": 2076, "split": "train" }
When was the course with the highest course ID completed?
e_learning
select t0.date_of_completion, t0.course_id as c1 from student_course_enrolment as t0, (select max(course_id) as c3 from student_course_enrolment) as t1 where c1 = t1.c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.date_of_completion, t0.course_id as c1 from student_course_enrolment as t0, (select max(course_id) as c3 from student_course_enrolment) as t1 where c1 = t1.c3" }, "style": "rule" }
{ "index": 3767, "split": "train" }
Can you tell me the phone numbers and IDs of the buildings that have apartments with exactly 3 rooms?
apartment_rentals
select distinct t0.building_phone, t0.building_id from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.room_count = 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select distinct t0.building_phone, t0.building_id from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.room_count = 3" }, "style": "rule" }
{ "index": 223, "split": "train" }
Can you tell me the IDs, descriptions, and names of restaurant types that are associated with restaurants having an ID less than 2?
restaurant_1
select t0.restypeid, t0.restypedescription, t0.restypename from restaurant_type as t0 join type_of_restaurant as t1 on t0.restypeid = t1.restypeid where t1.resid < 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 t0.restypeid, t0.restypedescription, t0.restypename from restaurant_type as t0 join type_of_restaurant as t1 on t0.restypeid = t1.restypeid where t1.resid < 2" }, "style": "rule" }
{ "index": 1900, "split": "train" }
What are the top 10 genres with at least one song rated starting with "7," showing their average resolution, rating, and genre name, sorted by the highest average resolution?
music_1
select avg(t0.resolution) as c0, t1.rating as c2, t1.g_name as c1 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where c2 like '7%' group by c1 having count(*) >= 1 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": "music_1", "sql": "select avg(t0.resolution) as c0, t1.rating as c2, t1.g_name as c1 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where c2 like '7%' group by c1 having count(*) >= 1 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 2319, "split": "train" }
Can you list the director, film ID, and title for all films, including those that are in markets with exactly 209 cities?
film_rank
select anon_1.c0, anon_1.c1, anon_1.c2 from (select director as c0, film_id as c1, title as c2 from film union select t0.director as c0, t0.film_id as c1, t0.title as c2 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id join market as t2 on t1.market_id = t2.market_id where t2.number_cities =...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "film_rank", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select director as c0, film_id as c1, title as c2 from film union select t0.director as c0, t0.film_id as c1, t0.title as c2 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id join market a...
{ "index": 2637, "split": "train" }
What are the first five nationalities of swimmers, ordered alphabetically, where the average 100-meter time for swimmers in each nationality is exactly 57.31 seconds?
swimming
select avg(meter_100) from swimmer group by nationality having avg(meter_100) between 57.31 and 57.31 order by nationality 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": "swimming", "sql": "select avg(meter_100) from swimmer group by nationality having avg(meter_100) between 57.31 and 57.31 order by nationality asc nulls last limit 5" }, "style": "rule" }
{ "index": 352, "split": "train" }
Show the product type code and product ID for each product, along with the most recent order ID for products with IDs of 9 or higher.
customers_and_products_contacts
select t0.product_type_code, t0.product_id as c1, max(t1.order_id) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id >= 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": "customers_and_products_contacts", "sql": "select t0.product_type_code, t0.product_id as c1, max(t1.order_id) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id >= 9 group by c1" }, "style": "rule" }
{ "index": 2179, "split": "train" }
What is the number of days between the publication date of catalog ID 2 and its latest revision date?
product_catalog
select julianday(t1.c2) - julianday(t0.c0) from (select date_of_publication as c2 from catalogs where catalog_id = 2 and catalog_id = 2) as t1, (select date_of_latest_revision as c0 from catalogs) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select julianday(t1.c2) - julianday(t0.c0) from (select date_of_publication as c2 from catalogs where catalog_id = 2 and catalog_id = 2) as t1, (select date_of_latest_revision as c0 from catalogs) as t0" }, "style": "rule" }
{ "index": 3929, "split": "train" }
What are the colors and IDs of the products involved in invoice-listed orders, specifically those with the most frequently ordered quantity?
customers_and_invoices
select t0.product_color, t0.product_id, t1.product_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id, (select product_quantity as c0 from order_items group by c0 order by count(*) desc limit 1) as t0 where t1.order_id in (select invoices.order_id as c2 from invoices) and t1.product_quantity...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_color, t0.product_id, t1.product_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id, (select product_quantity as c0 from order_items group by c0 order by count(*) desc limit 1) as t0 where t1.order_id ...
{ "index": 1942, "split": "train" }
How much is the product ID of product 4 greater than the smallest average product ID among products with names containing "nic"?
customer_deliveries
select t2.c2 - t0.c1 from (select min(t1.c1) as c2 from (select avg(t1.product_id) as c1 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t0.product_name like '%nic%' group by t0.product_id) as t1) as t2, (select t0.product_id, avg(t1.product_id) as c1 from products as t0 joi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_deliveries", "sql": "select t2.c2 - t0.c1 from (select min(t1.c1) as c2 from (select avg(t1.product_id) as c1 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t0.product_name like '%nic%' group by t0.product_id) as t1) as t2, (...
{ "index": 3186, "split": "train" }
Find the age, host ID, and name of each host, along with the ID of the party they participated in, for parties whose themes include the letter "o". Sort the results in descending order by the host's age.
party_host
select t0.age as c3, t0.host_id, t0.name, t1.party_id from host as t0 join party_host as t1 on t0.host_id = t1.host_id join party as t2 on t1.party_id = t2.party_id where t2.party_theme like '%o%' order by c3 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "party_host", "sql": "select t0.age as c3, t0.host_id, t0.name, t1.party_id from host as t0 join party_host as t1 on t0.host_id = t1.host_id join party as t2 on t1.party_id = t2.party_id where t2.party_theme like '%o%' order by c3 desc" }, "style": "rule" }
{ "index": 2620, "split": "train" }
Which are the top three male jobs where the oldest person is 35 years old, sorted by the highest maximum age?
network_2
select job as c0 from person where gender = 'male' group by c0 having max(age) = 35 order by max(age) desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select job as c0 from person where gender = 'male' group by c0 having max(age) = 35 order by max(age) desc limit 3" }, "style": "rule" }
{ "index": 719, "split": "train" }
What are the names and the average age of the pilot(s) with pilot ID 1?
aircraft
select name as c0, avg(age) from pilot where pilot_id = 1 group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "aircraft", "sql": "select name as c0, avg(age) from pilot where pilot_id = 1 group by c0" }, "style": "rule" }
{ "index": 887, "split": "train" }
What are the claimed amounts, settled amounts, claim IDs, dates the claims were settled, and dates the claims were made for the settlement records related to the customer named "Dayana Robe"?
insurance_policies
select anon_1.c3, anon_1.c4, anon_1.c0, anon_1.c1, anon_1.c2 from (select amount_claimed as c3, amount_settled as c4, claim_id as c0, date_claim_settled as c1, date_claim_made as c2 from settlements intersect select t0.amount_claimed as c3, t0.amount_settled as c4, t0.claim_id as c0, t0.date_claim_settled as c1, t0.dat...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_policies", "sql": "select anon_1.c3, anon_1.c4, anon_1.c0, anon_1.c1, anon_1.c2 from (select amount_claimed as c3, amount_settled as c4, claim_id as c0, date_claim_settled as c1, date_claim_made as c2 from settlements intersect select t0.amount_claimed as c3, t0.amount_...
{ "index": 695, "split": "train" }
Which aircraft and their IDs have won matches both at EuroSpeedway Lausitz and at the most frequently held match location?
aircraft
select anon_1.c2, anon_1.c0 from (select t0.aircraft as c2, t0.aircraft_id as c0 from aircraft as t0 join match as t1 on t0.aircraft_id = t1.winning_aircraft where t1.location = 'EuroSpeedway Lausitz' intersect select t0.aircraft as c2, t0.aircraft_id as c0 from aircraft as t0 join match as t1 on t0.aircraft_id = t1.wi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "aircraft", "sql": "select anon_1.c2, anon_1.c0 from (select t0.aircraft as c2, t0.aircraft_id as c0 from aircraft as t0 join match as t1 on t0.aircraft_id = t1.winning_aircraft where t1.location = 'EuroSpeedway Lausitz' intersect select t0.aircraft as c2, t0.aircraft_id as c0 fro...
{ "index": 2461, "split": "train" }
Could you tell me the names and classes of all captains and ships, including those that are either captains or ships?
ship_1
select anon_1.c0, anon_1.c2 from (select name as c0, class as c2 from captain union select name, class from ship) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "ship_1", "sql": "select anon_1.c0, anon_1.c2 from (select name as c0, class as c2 from captain union select name, class from ship) as anon_1" }, "style": "rule" }
{ "index": 32, "split": "train" }
What are the last names of the first ten staff members who authorized the closure of problems related to product 2, where these problems were reported by staff members with IDs of 4 or higher? List the names in alphabetical order, placing any with null last names at the end.
tracking_software_problems
select t0.staff_last_name as c0 from staff as t0 join problems as t1 on t0.staff_id = t1.closure_authorised_by_staff_id where t1.reported_by_staff_id >= 4 and t1.product_id = 2 order by c0 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t0.staff_last_name as c0 from staff as t0 join problems as t1 on t0.staff_id = t1.closure_authorised_by_staff_id where t1.reported_by_staff_id >= 4 and t1.product_id = 2 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 1729, "split": "train" }
What are the unique combinations of member IDs, membership card types, and ages among the members?
coffee_shop
select distinct member_id, membership_card, age from member
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct member_id, membership_card, age from member" }, "style": "rule" }
{ "index": 740, "split": "train" }
Which event IDs and service IDs are associated with participants whose details start with "Prof. Mi"?
local_govt_in_alabama
select t0.event_id, t0.service_id from events as t0 join participants_in_events as t1 on t0.event_id = t1.event_id join participants as t2 on t1.participant_id = t2.participant_id where t2.participant_details like 'Prof. Mi%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_in_alabama", "sql": "select t0.event_id, t0.service_id from events as t0 join participants_in_events as t1 on t0.event_id = t1.event_id join participants as t2 on t1.participant_id = t2.participant_id where t2.participant_details like 'Prof. Mi%'" }, "style": "rule...
{ "index": 1756, "split": "train" }
Which stations have had more than five instances where the number of bikes available was 12 or fewer, and what are their names, installation dates, and IDs?
bike_1
select t0.name, t0.installation_date, t0.id as c0 from station as t0 join status as t1 on t0.id = t1.station_id where t1.station_id in (select c0 as c0 from station) and t1.bikes_available <= 12 group by c0 having count(*) > 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select t0.name, t0.installation_date, t0.id as c0 from station as t0 join status as t1 on t0.id = t1.station_id where t1.station_id in (select c0 as c0 from station) and t1.bikes_available <= 12 group by c0 having count(*) > 5" }, "style": "rule" }
{ "index": 249, "split": "train" }
Can you tell me how many courses (by title), what the average credits are, and how many unique prerequisites there are for the course that has the most prerequisites?
college_2
select count(t0.title), avg(t0.credits), count(distinct (t1.course_id)) from course as t0 join prereq as t1 on t0.course_id = t1.prereq_id, (select course_id as c2 from prereq group by c2 order by count(*) desc limit 1) as t0 where t1.course_id = t0.c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_2", "sql": "select count(t0.title), avg(t0.credits), count(distinct (t1.course_id)) from course as t0 join prereq as t1 on t0.course_id = t1.prereq_id, (select course_id as c2 from prereq group by c2 order by count(*) desc limit 1) as t0 where t1.course_id = t0.c2" }, ...
{ "index": 1613, "split": "train" }
What are the three highest total sums of Member In Charge IDs for events named "Election Meeting," where the total exceeds 4, considering only Member In Charge IDs that exist in the Member table, grouped by event name, and sorted in reverse alphabetical order of the event names?
party_people
select sum(member_in_charge_id) from party_events where member_in_charge_id in (select member_id as c1 from member) and event_name = 'Election Meeting' group by event_name having sum(member_in_charge_id) > 4 order by event_name desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "party_people", "sql": "select sum(member_in_charge_id) from party_events where member_in_charge_id in (select member_id as c1 from member) and event_name = 'Election Meeting' group by event_name having sum(member_in_charge_id) > 4 order by event_name desc limit 3" }, "style":...
{ "index": 2371, "split": "train" }
Can you tell me the total of course IDs and the personal name of the course author for those authors who have at least two unique students enrolled in their courses? Please list the top 10 authors sorted by the highest total course IDs.
e_learning
select sum(t0.course_id) as c0, t2.personal_name from student_course_enrolment as t0 join courses as t1 on t0.course_id = t1.course_id join course_authors_and_tutors as t2 on t1.author_id = t2.author_id group by t2.author_id having count(distinct (t0.student_id)) >= 2 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": "e_learning", "sql": "select sum(t0.course_id) as c0, t2.personal_name from student_course_enrolment as t0 join courses as t1 on t0.course_id = t1.course_id join course_authors_and_tutors as t2 on t1.author_id = t2.author_id group by t2.author_id having count(distinct (t0.student_...
{ "index": 668, "split": "train" }
Which are the top 10 machine and technician details—specifically, quality rank, machine ID, machine series, and technician ID—for technicians named 'Charlie Hollocher' or matching the name of the technician with ID 5.0 who is the youngest among those with that ID, ordered by technician ID from highest to lowest?
machine_repair
select t0.quality_rank, t0.machine_id, t0.machine_series, t1.technician_id as c3 from machine as t0 join repair_assignment as t1 on t0.machine_id = t1.machine_id join technician as t2 on t1.technician_id = t2.technician_id, (select name as c2 from technician where technician_id = 5.0 group by c2 order by min(age) asc n...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "machine_repair", "sql": "select t0.quality_rank, t0.machine_id, t0.machine_series, t1.technician_id as c3 from machine as t0 join repair_assignment as t1 on t0.machine_id = t1.machine_id join technician as t2 on t1.technician_id = t2.technician_id, (select name as c2 from technic...
{ "index": 952, "split": "train" }
What is the color code, color description, and typical buying price for the first matching product — either the most frequently occurring product description or one that ends with "inus" — sorted by color code in alphabetical order?
products_gen_characteristics
select t0.color_code as c1, t0.color_description, t1.typical_buying_price from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code, (select product_description as c2 from products group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.product_description = t0.c2 or t1.product_description...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.color_code as c1, t0.color_description, t1.typical_buying_price from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code, (select product_description as c2 from products group by c2 order by count(*) asc nulls las...
{ "index": 2645, "split": "train" }
How many people are there in the database?
network_2
select count(*) from person
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select count(*) from person" }, "style": "rule" }
{ "index": 2843, "split": "train" }