question
stringlengths
1
606
db_id
stringclasses
139 values
external_knowledge
stringclasses
1 value
sql
stringlengths
19
1.35k
data_source
stringclasses
1 value
prompt
listlengths
2
2
ability
stringclasses
1 value
reward_model
dict
extra_info
dict
What is the smallest classroom number for each teacher's last name?
student_1
select lastname as c1, min(classroom) from teachers 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": "student_1", "sql": "select lastname as c1, min(classroom) from teachers group by c1" }, "style": "rule" }
{ "index": 397, "split": "train" }
What is the grade point value associated with the letter grade C-?
college_3
select gradepoint from gradeconversion where lettergrade = 'C-'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_3", "sql": "select gradepoint from gradeconversion where lettergrade = 'C-'" }, "style": "rule" }
{ "index": 3362, "split": "train" }
Can you list the feature details and their IDs for all features in the database, as well as those specifically associated with the shop that has ID 8429?
cre_Theme_park
select anon_1.c0, anon_1.c1 from (select feature_details as c0, feature_id as c1 from features union select t0.feature_details as c0, t0.feature_id as c1 from features as t0 join tourist_attraction_features as t1 on t0.feature_id = t1.feature_id join tourist_attractions as t2 on t1.tourist_attraction_id = t2.tourist_at...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c1 from (select feature_details as c0, feature_id as c1 from features union select t0.feature_details as c0, t0.feature_id as c1 from features as t0 join tourist_attraction_features as t1 on t0.feature_id = t1.feature_id join tour...
{ "index": 1208, "split": "train" }
What are the visit record IDs, student IDs, and restaurant IDs for visits to restaurants of type with restypeid equal to 1?
restaurant_1
select t0.resid, t0.stuid, t1.resid from visits_restaurant as t0 join restaurant as t1 on t0.resid = t1.resid join type_of_restaurant as t2 on t1.resid = t2.resid join restaurant_type as t3 on t2.restypeid = t3.restypeid where t3.restypeid = 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": "restaurant_1", "sql": "select t0.resid, t0.stuid, t1.resid from visits_restaurant as t0 join restaurant as t1 on t0.resid = t1.resid join type_of_restaurant as t2 on t1.resid = t2.resid join restaurant_type as t3 on t2.restypeid = t3.restypeid where t3.restypeid = 1" }, "styl...
{ "index": 2651, "split": "train" }
Which products have complaints from customers with IDs between 118 and 120 that are marked as closed or similar in status?
customer_complaints
select t0.product_name from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.customer_id between 118 and 120 and t1.complaint_status_code like 'Clos%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_complaints", "sql": "select t0.product_name from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.customer_id between 118 and 120 and t1.complaint_status_code like 'Clos%'" }, "style": "rule" }
{ "index": 2178, "split": "train" }
Is the percentage change in the number of unique purchase transactions between December 30, 1997, and August 13, 1977, for investors with IDs 6 or higher greater than the largest percentage change observed among all other transaction types for that same period and investor group?
tracking_share_transactions
select t5.c1 > t2.c3 from (select abs((t3.c2 / cast(t4.c2 as real) - 1) * 100) as c1 from (select count(distinct (t1.transaction_id)) as c2 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'PUR' and t1.date_of_transaction = ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select t5.c1 > t2.c3 from (select abs((t3.c2 / cast(t4.c2 as real) - 1) * 100) as c1 from (select count(distinct (t1.transaction_id)) as c2 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_...
{ "index": 3451, "split": "train" }
Which manufacturer and product code combinations are for products that are not made by manufacturers whose names start with "I"?
manufactory_1
select anon_1.c1, anon_1.c0 from (select manufacturer as c1, code as c0 from products except select t0.manufacturer as c1, t0.code as c0 from products as t0 join manufacturers as t1 on t0.manufacturer = t1.code where t1.name like 'I%') 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": "manufactory_1", "sql": "select anon_1.c1, anon_1.c0 from (select manufacturer as c1, code as c0 from products except select t0.manufacturer as c1, t0.code as c0 from products as t0 join manufacturers as t1 on t0.manufacturer = t1.code where t1.name like 'I%') as anon_1" }, "s...
{ "index": 902, "split": "train" }
Can you tell me the RAM size in MiB, model name, ROM size in MiB, company name, and chip model for phones that either have a screen resolution of exactly 160 by 256 pixels or have a screen mode with the most frequently used pixels among those with used memory of at least 16 KB and a type starting with "Graph"? Also, pl...
phone_1
select t0.ram_mib as c5, t0.model_name, t0.rom_mib, t1.company_name, t1.chip_model from chip_model as t0 join phone as t1 on t0.model_name = t1.chip_model join screen_mode as t2 on t1.screen_mode = t2.graphics_mode, (select pixels as c4 from screen_mode where used_kb >= 16.0 and type like 'Graph%' group by c4 order by ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "phone_1", "sql": "select t0.ram_mib as c5, t0.model_name, t0.rom_mib, t1.company_name, t1.chip_model from chip_model as t0 join phone as t1 on t0.model_name = t1.chip_model join screen_mode as t2 on t1.screen_mode = t2.graphics_mode, (select pixels as c4 from screen_mode where us...
{ "index": 1399, "split": "train" }
Check if the target user ID trusted by user 2 has an ID greater than 2.?
epinions_1
select target_u_id > 2 from trust where source_u_id = 2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "epinions_1", "sql": "select target_u_id > 2 from trust where source_u_id = 2" }, "style": "rule" }
{ "index": 3297, "split": "train" }
Which are the top 10 injury accident records with the largest number of matches involved, ordered from the highest to lowest, and what is the total count of accident records and matches across all injuries?
game_injury
select count(number_of_matches), count(*) as c1 from injury_accident order by c1 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_injury", "sql": "select count(number_of_matches), count(*) as c1 from injury_accident order by c1 desc limit 10" }, "style": "rule" }
{ "index": 1927, "split": "train" }
What is the percent change in the highest investor ID for transaction types ending with "ase" between October 8, 1985, and December 2, 1990?
tracking_share_transactions
select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select max(t1.investor_id) as c0 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.date_of_transaction = '1990-12-02 09:03:38' and t0.transaction_type_description like '%ase' group by t0...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select max(t1.investor_id) as c0 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.date_of_transaction = '19...
{ "index": 3058, "split": "train" }
Can you identify the calendar dates and day numbers when there are documents with a type code containing "V" that are stored on those dates, but excluding dates where documents with type codes starting with "PR" are stored?
cre_Doc_Tracking_DB
select anon_1.c1, anon_1.c0 from (select t0.calendar_date as c1, t0.day_number as c0 from ref_calendar as t0 join all_documents as t1 on t0.calendar_date = t1.date_stored where t1.document_type_code like '%V%' except select t0.calendar_date as c1, t0.day_number as c0 from ref_calendar as t0 join all_documents as t1 on ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Tracking_DB", "sql": "select anon_1.c1, anon_1.c0 from (select t0.calendar_date as c1, t0.day_number as c0 from ref_calendar as t0 join all_documents as t1 on t0.calendar_date = t1.date_stored where t1.document_type_code like '%V%' except select t0.calendar_date as c1, t0...
{ "index": 1918, "split": "train" }
What are the codes, hours, and names of projects that are assigned to the most common project, excluding those assigned to project 'AeH1'?
scientist_1
select anon_1.c0, anon_1.c3, anon_1.c2 from (select t0.code as c0, t0.hours as c3, t0.name as c2 from projects as t0 join assignedto as t1 on t0.code = t1.project, (select project as c1 from assignedto group by c1 order by count(*) desc limit 1) as t1 where t1.project = t1.c1 except select t0.code as c0, t0.hours as c3...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "scientist_1", "sql": "select anon_1.c0, anon_1.c3, anon_1.c2 from (select t0.code as c0, t0.hours as c3, t0.name as c2 from projects as t0 join assignedto as t1 on t0.code = t1.project, (select project as c1 from assignedto group by c1 order by count(*) desc limit 1) as t1 where ...
{ "index": 2545, "split": "train" }
Can you tell me the 10 most recent city and person name pairs, along with the friendship year, for friends whose names contain "Bo"?
network_2
select t0.city, t0.name, t1.year as c1 from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like '%Bo%' 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": "network_2", "sql": "select t0.city, t0.name, t1.year as c1 from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like '%Bo%' order by c1 asc nulls last limit 10" }, "style": "rule" }
{ "index": 421, "split": "train" }
Which clubs, with an ID of 2 or higher, also have a member whose role includes "President"? Please provide the club descriptions, names, and locations.
club_1
select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.clubdesc as c0, t0.clubname as c2, t0.clublocation as c1 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid where t1.clubid >= 2 intersect select t0.clubdesc as c0, t0.clubname as c2, t0.clublocation as c1 from club as t0 join member_of_club as t1 o...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "club_1", "sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.clubdesc as c0, t0.clubname as c2, t0.clublocation as c1 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid where t1.clubid >= 2 intersect select t0.clubdesc as c0, t0.clubname as c2, t0.clubl...
{ "index": 1824, "split": "train" }
Among the positions where the total of associated club IDs sums to 4, which position has the highest total sum of club IDs?
club_1
select position as c0 from member_of_club group by c0 having sum(clubid) = 4 order by sum(clubid) 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": "club_1", "sql": "select position as c0 from member_of_club group by c0 having sum(clubid) = 4 order by sum(clubid) desc limit 1" }, "style": "rule" }
{ "index": 1668, "split": "train" }
Among invoices billed in a state starting with "MA," which state has the fewest invoices? For that billing state, on or before July 24, 2009, what is the total and customer ID of the invoice with the lowest total?
store_1
select t0.total as c0, t0.customer_id from invoices as t0, (select billing_state as c2 from invoices where c2 like 'MA%' group by c2 order by count(*) asc nulls last limit 1) as t0 where t0.billing_state = t0.c2 and t0.invoice_date <= '2009-07-24 00:00:00' 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": "store_1", "sql": "select t0.total as c0, t0.customer_id from invoices as t0, (select billing_state as c2 from invoices where c2 like 'MA%' group by c2 order by count(*) asc nulls last limit 1) as t0 where t0.billing_state = t0.c2 and t0.invoice_date <= '2009-07-24 00:00:00' order...
{ "index": 2156, "split": "train" }
How many days have passed between a customer's date of birth and the date they became a customer, for those with last names starting with "Terr"?
driving_school
select julianday(t1.c1) - julianday(t0.c0) from (select date_became_customer as c1 from customers where last_name like 'Terr%' and last_name like 'Terr%') as t1, (select date_of_birth as c0 from customers) 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": "driving_school", "sql": "select julianday(t1.c1) - julianday(t0.c0) from (select date_became_customer as c1 from customers where last_name like 'Terr%' and last_name like 'Terr%') as t1, (select date_of_birth as c0 from customers) as t0" }, "style": "rule" }
{ "index": 3841, "split": "train" }
What are the bottom 10 hardware colours, used kilobytes, and types for phones with chip models launched before or during 2005, or between 2002 and 2005, sorted by hardware colours?
phone_1
select t0.hardware_colours as c1, t0.used_kb, t0.type from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode join chip_model as t2 on t1.chip_model = t2.model_name where t2.launch_year <= 2005.0 or t2.launch_year between 2002.0 and 2005.0 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": "phone_1", "sql": "select t0.hardware_colours as c1, t0.used_kb, t0.type from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode join chip_model as t2 on t1.chip_model = t2.model_name where t2.launch_year <= 2005.0 or t2.launch_year between 2002.0 and 2005.0 o...
{ "index": 1123, "split": "train" }
Which fault logs, involving engineers with skills having IDs between 1 and 3, include the date and time of the fault, the asset involved, the contact staff ID, and the fault log entry ID?
assets_maintenance
select t0.fault_log_entry_datetime, t0.asset_id, t1.contact_staff_id, t1.fault_log_entry_id from fault_log as t0 join engineer_visits as t1 on t0.fault_log_entry_id = t1.fault_log_entry_id join maintenance_engineers as t2 on t1.engineer_id = t2.engineer_id join engineer_skills as t3 on t2.engineer_id = t3.engineer_id w...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t0.fault_log_entry_datetime, t0.asset_id, t1.contact_staff_id, t1.fault_log_entry_id from fault_log as t0 join engineer_visits as t1 on t0.fault_log_entry_id = t1.fault_log_entry_id join maintenance_engineers as t2 on t1.engineer_id = t2.engine...
{ "index": 1320, "split": "train" }
List up to five of the earliest dates when ministers whose names end with "la (MP)" took office, only including those where the smallest region ID associated with them is less than 5, and show the earliest region ID for each.
party_people
select took_office as c0, min(region_id) from party where minister like '%la (MP)' group by c0 having min(region_id) < 5 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": "party_people", "sql": "select took_office as c0, min(region_id) from party where minister like '%la (MP)' group by c0 having min(region_id) < 5 order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 283, "split": "train" }
Which five departments have the most entries, along with the count of their unique manager start dates, ordered from the highest to lowest?
company_1
select dname as c1, count(distinct (mgr_start_date)) from department group by c1 order by count(*) 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": "company_1", "sql": "select dname as c1, count(distinct (mgr_start_date)) from department group by c1 order by count(*) desc limit 5" }, "style": "rule" }
{ "index": 172, "split": "train" }
Find the names of the three ships built after 1998 or in or before 1997, sorted alphabetically by name, with any ships without a name appearing at the end.
ship_1
select name as c0 from ship where built_year > 1998.0 or built_year <= 1997.0 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": "ship_1", "sql": "select name as c0 from ship where built_year > 1998.0 or built_year <= 1997.0 order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 165, "split": "train" }
What is the percentage change in the number of unique tweet IDs for user 5 at 2:30 AM on March 12, 2018?
twitter_1
select (t0.c1 / cast(t0.c1 as real) - 1) * 100 from (select count(distinct (t1.id)) as c1 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 5 and t1.createdate = '2018-03-12 02:30:30' group by t0.uid) 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": "twitter_1", "sql": "select (t0.c1 / cast(t0.c1 as real) - 1) * 100 from (select count(distinct (t1.id)) as c1 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 5 and t1.createdate = '2018-03-12 02:30:30' group by t0.uid) as t0" }, "style": "rule" }
{ "index": 3430, "split": "train" }
For each country where artists are from, how many unique artists and genders are there, sorted by the total number of genders?
music_1
select country as c1, count(distinct (artist_name)), count(gender) as c2 from artist group by c1 order by c2 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select country as c1, count(distinct (artist_name)), count(gender) as c2 from artist group by c1 order by c2 asc nulls last" }, "style": "rule" }
{ "index": 2618, "split": "train" }
What is the percentage change in the minimum student ID associated with behavior incidents that ended on February 25, 2018, compared to those that ended on March 6, 2018?
behavior_monitoring
select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select min(t1.student_id) as c0 from students as t0 join behavior_incident as t1 on t0.student_id = t1.student_id where t1.date_incident_end = '2018-02-25 05:38:58' group by t0.student_id) as t0, (select t0.student_id, min(t1.student_id) as c0 from students...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select min(t1.student_id) as c0 from students as t0 join behavior_incident as t1 on t0.student_id = t1.student_id where t1.date_incident_end = '2018-02-25 05:38:58' group by t0.student_id...
{ "index": 3005, "split": "train" }
What are the IDs of the last ten markets when listing all market IDs in ascending order?
phone_market
select market_id as c0 from market 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": "phone_market", "sql": "select market_id as c0 from market order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 2269, "split": "train" }
?
customer_complaints
select t0.email_address, t0.customer_id as c1, min(t1.staff_id) from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.date_complaint_raised <= '2007-10-14 21:50:43' or t1.date_complaint_raised between '1973-02-10 22:55:56' and '1977-08-06 00:31:19' 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": "customer_complaints", "sql": "select t0.email_address, t0.customer_id as c1, min(t1.staff_id) from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.date_complaint_raised <= '2007-10-14 21:50:43' or t1.date_complaint_raised between '1973-02-10 22:5...
{ "index": 344, "split": "train" }
What are the ten apartments with numbers ending in ". 794" that have the highest `View_Unit_Status` IDs? Please provide both the maximum `View_Unit_Status` apt ID and the apartment's ID, sorted from the highest to the lowest.
apartment_rentals
select max(t0.apt_id) as c1, t1.apt_id as c0 from view_unit_status as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.apt_number like '%. 794' group by c0 order by c1 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select max(t0.apt_id) as c1, t1.apt_id as c0 from view_unit_status as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.apt_number like '%. 794' group by c0 order by c1 desc limit 10" }, "style": "rule" }
{ "index": 408, "split": "train" }
What is the date of the order placed by the customer with the highest customer ID among those whose order status ends with "mpleted"?
department_store
select t0.order_date, t0.customer_id as c0 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where order_status_code like '%mpleted') as t1 where c0 = 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": "department_store", "sql": "select t0.order_date, t0.customer_id as c0 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where order_status_code like '%mpleted') as t1 where c0 = t1.c3" }, "style": "rule" }
{ "index": 3888, "split": "train" }
What is the latest completion date for the student who has the highest student ID among those with registration ID 13?
e_learning
select t0.date_of_completion, t0.student_id as c2 from student_course_enrolment as t0, (select max(student_id) as c1 from student_course_enrolment where registration_id = 13) 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": "e_learning", "sql": "select t0.date_of_completion, t0.student_id as c2 from student_course_enrolment as t0, (select max(student_id) as c1 from student_course_enrolment where registration_id = 13) as t1 where c2 = t1.c1" }, "style": "rule" }
{ "index": 3769, "split": "train" }
How many days are between the race times at circuits with IDs less than or equal to 58 and the dates of all races?
formula_1
select julianday(t1.c0) - julianday(t0.c1) from (select time as c0 from races where circuitid <= 58 and circuitid <= 58) as t1, (select date as c1 from races) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "formula_1", "sql": "select julianday(t1.c0) - julianday(t0.c1) from (select time as c0 from races where circuitid <= 58 and circuitid <= 58) as t1, (select date as c1 from races) as t0" }, "style": "rule" }
{ "index": 3808, "split": "train" }
What are the IDs of the top three sales transactions when sorting by their sales details from highest to lowest?
tracking_share_transactions
select sales_transaction_id from sales order by sales_details 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": "tracking_share_transactions", "sql": "select sales_transaction_id from sales order by sales_details desc limit 3" }, "style": "rule" }
{ "index": 313, "split": "train" }
Did Employee 2's hire date come after Employee 5's hire date?
store_1
select t1.c1 > t0.c1 from (select hire_date as c1 from employees where id = 2) as t1, (select hire_date as c1 from employees where id = 5) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t1.c1 > t0.c1 from (select hire_date as c1 from employees where id = 2) as t1, (select hire_date as c1 from employees where id = 5) as t0" }, "style": "rule" }
{ "index": 3100, "split": "train" }
Which invoice with the invoice date of "2018-03-20 00:21:41" has the highest order ID?
customers_and_invoices
select t0.invoice_date, t0.order_id as c1 from invoices as t0, (select max(order_id) as c3 from invoices where invoice_date = '2018-03-20 00:21:41') 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": "customers_and_invoices", "sql": "select t0.invoice_date, t0.order_id as c1 from invoices as t0, (select max(order_id) as c3 from invoices where invoice_date = '2018-03-20 00:21:41') as t1 where c1 = t1.c3" }, "style": "rule" }
{ "index": 3756, "split": "train" }
Can you tell me the names and creation dates of the top three departments along with their head IDs and whether their leaders are temporarily or acting, specifically focusing on heads born in states that contain the letter "i," and sorted so that departments with non-acting heads appear first?
department_management
select t0.name, t0.creation, t1.head_id, t1.temporary_acting as c0 from department as t0 join management as t1 on t0.department_id = t1.department_id join head as t2 on t1.head_id = t2.head_id where t2.born_state like '%i%' 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": "department_management", "sql": "select t0.name, t0.creation, t1.head_id, t1.temporary_acting as c0 from department as t0 join management as t1 on t0.department_id = t1.department_id join head as t2 on t1.head_id = t2.head_id where t2.born_state like '%i%' order by c0 asc nulls la...
{ "index": 330, "split": "train" }
Which cinemas have four showings per day but do not have schedules on dates that include the letter "y", and what are their capacities, IDs, and locations?
cinema
select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.capacity as c0, t0.cinema_id as c1, t0.location as c2 from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id where t1.show_times_per_day = 4 except select t0.capacity as c0, t0.cinema_id as c1, t0.location as c2 from cinema as t0 join schedule as t1 o...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cinema", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.capacity as c0, t0.cinema_id as c1, t0.location as c2 from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id where t1.show_times_per_day = 4 except select t0.capacity as c0, t0.cinema_id as c1, ...
{ "index": 1546, "split": "train" }
What is the percentage change in the total sum of customer IDs for customer 116 at the specific time '1987-07-11 14:40:30', compared to the maximum total sum at that time?
customer_complaints
select (max(t0.c2) / cast(max(t0.c2) as real) - 1) * 100 from (select sum(t1.customer_id) as c2 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.date_complaint_raised = '1987-07-11 14:40:30' and t0.customer_id = 116 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": "customer_complaints", "sql": "select (max(t0.c2) / cast(max(t0.c2) as real) - 1) * 100 from (select sum(t1.customer_id) as c2 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.date_complaint_raised = '1987-07-11 14:40:30' and t0.customer_id = ...
{ "index": 3018, "split": "train" }
What are the ten highest property IDs recorded in the Customer Event Notes?
local_govt_and_lot
select max(property_id) as c0 from customer_event_notes 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": "local_govt_and_lot", "sql": "select max(property_id) as c0 from customer_event_notes order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 404, "split": "train" }
Which are the five most recent visits that occurred after January 8, 1996, and what are the corresponding visit dates and tourist IDs?
cre_Theme_park
select visit_date as c0, tourist_id from visits where c0 > '1996-01-08 13:23:41' 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": "cre_Theme_park", "sql": "select visit_date as c0, tourist_id from visits where c0 > '1996-01-08 13:23:41' order by c0 desc limit 5" }, "style": "rule" }
{ "index": 1306, "split": "train" }
What are the counts of grades for students with each first name? Show the top 10 first names with the most grades, ordered alphabetically by first name.
student_1
select count(grade) from list group by firstname order by firstname 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": "student_1", "sql": "select count(grade) from list group by firstname order by firstname asc nulls last limit 10" }, "style": "rule" }
{ "index": 2071, "split": "train" }
What are the venue, competition, and date details, along with the match ID, for matches hosted in cities with a regional population of 4,501,700 that are specifically in Jiaxing (Zhejiang)?
city_record
select t0.venue, t0.competition, t0.date, t1.match_id from match as t0 join hosting_city as t1 on t0.match_id = t1.match_id join city as t2 on t1.host_city = t2.city_id where t2.regional_population = 4501700 and t2.city = 'Jiaxing ( Zhejiang )'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "city_record", "sql": "select t0.venue, t0.competition, t0.date, t1.match_id from match as t0 join hosting_city as t1 on t0.match_id = t1.match_id join city as t2 on t1.host_city = t2.city_id where t2.regional_population = 4501700 and t2.city = 'Jiaxing ( Zhejiang )'" }, "styl...
{ "index": 2375, "split": "train" }
How does the 'blues' genre rank in terms of its lowest song rating among genres with songs at or above 320 resolution, when genres are ordered from highest to lowest minimum rating?
music_1
select t1.c5, t1.c2 as c0 from (select row_number() over (order by t0.c1 desc) as c5, t0.c3 as c2 from (select t0.g_name as c3, min(t1.rating) as c1 from genre as t0 join song as t1 on t0.g_name = t1.genre_is where t1.resolution >= 320 group by c3) as t0) as t1 where c0 = 'blues'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c5, t1.c2 as c0 from (select row_number() over (order by t0.c1 desc) as c5, t0.c3 as c2 from (select t0.g_name as c3, min(t1.rating) as c1 from genre as t0 join song as t1 on t0.g_name = t1.genre_is where t1.resolution >= 320 group by c3) as t0) as t1 ...
{ "index": 3493, "split": "train" }
Which dorm with an amenid of 900 or 903 has the higher amenid, and what are the total sum of amenids in Has_amenity and the amenid in Dorm_amenity for that dorm?
dorm_1
select sum(t0.amenid), t1.amenid as c1 from has_amenity as t0 join dorm_amenity as t1 on t0.amenid = t1.amenid where c1 = 900 or c1 = 903 group by c1 order by c1 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select sum(t0.amenid), t1.amenid as c1 from has_amenity as t0 join dorm_amenity as t1 on t0.amenid = t1.amenid where c1 = 900 or c1 = 903 group by c1 order by c1 desc limit 1" }, "style": "rule" }
{ "index": 1922, "split": "train" }
What are the product price, product type code, and order ID for orders placed by customers with customer numbers starting with "44"?
customers_and_products_contacts
select t0.product_price, t0.product_type_code, t1.order_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id join customer_orders as t2 on t1.order_id = t2.order_id join customers as t3 on t2.customer_id = t3.customer_id where t3.customer_number like '44%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_price, t0.product_type_code, t1.order_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id join customer_orders as t2 on t1.order_id = t2.order_id join customers as t3 on t2.customer_id = t3.cus...
{ "index": 2014, "split": "train" }
When did the train with the highest train number run?
station_weather
select t0.time, t0.train_number as c1 from train as t0, (select max(train_number) as c0 from train) as t1 where c1 = t1.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select t0.time, t0.train_number as c1 from train as t0, (select max(train_number) as c0 from train) as t1 where c1 = t1.c0" }, "style": "rule" }
{ "index": 3795, "split": "train" }
What are the ten apartments with the smallest number of facilities?
apartment_rentals
select count(distinct (apt_id)) as c0 from apartment_facilities 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": "apartment_rentals", "sql": "select count(distinct (apt_id)) as c0 from apartment_facilities order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 2289, "split": "train" }
For each maintenance contract, what is the company that provided it, when did it start and end, and what is the total number of parts involved in assets covered by that contract?
assets_maintenance
select t0.maintenance_contract_company_id, t0.contract_end_date, t0.contract_start_date, sum(t2.part_id) from maintenance_contracts as t0 join assets as t1 on t0.maintenance_contract_id = t1.maintenance_contract_id join asset_parts as t2 on t1.asset_id = t2.asset_id group by t0.maintenance_contract_id
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t0.maintenance_contract_company_id, t0.contract_end_date, t0.contract_start_date, sum(t2.part_id) from maintenance_contracts as t0 join assets as t1 on t0.maintenance_contract_id = t1.maintenance_contract_id join asset_parts as t2 on t1.asset_i...
{ "index": 2147, "split": "train" }
Is the number of unique documents with structure code 8 and a document type starting with "C" greater than the number of documents with structure code 6?
document_management
select t1.c1 > t0.c1 from (select count(distinct (t1.document_code)) as c1 from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code where t0.document_structure_code = 6 group by t0.document_structure_code) as t1, (select t0.document_structure_code, count(distinct (t...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "document_management", "sql": "select t1.c1 > t0.c1 from (select count(distinct (t1.document_code)) as c1 from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code where t0.document_structure_code = 6 group by t0.document_struct...
{ "index": 3544, "split": "train" }
How many days passed between the order date and the actual delivery date for orders delivered between February 16, 1996, and March 27, 2004?
cre_Drama_Workshop_Groups
select julianday(t1.c3) - julianday(t0.c1) from (select order_date as c3 from customer_orders where actual_delivery_date between '1996-02-16 04:20:17' and '2004-03-27 23:30:12' and actual_delivery_date between '1996-02-16 04:20:17' and '2004-03-27 23:30:12') as t1, (select actual_delivery_date as c1 from customer_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": "cre_Drama_Workshop_Groups", "sql": "select julianday(t1.c3) - julianday(t0.c1) from (select order_date as c3 from customer_orders where actual_delivery_date between '1996-02-16 04:20:17' and '2004-03-27 23:30:12' and actual_delivery_date between '1996-02-16 04:20:17' and '2004-03...
{ "index": 3687, "split": "train" }
Which actors appeared in the film with ID 785, and what are their actor IDs, first names, and last names?
sakila_1
select t0.actor_id, t0.first_name, t0.last_name, t1.film_id as c0 from actor as t0 join film_actor as t1 on t0.actor_id = t1.actor_id where c0 = 785
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "sakila_1", "sql": "select t0.actor_id, t0.first_name, t0.last_name, t1.film_id as c0 from actor as t0 join film_actor as t1 on t0.actor_id = t1.actor_id where c0 = 785" }, "style": "rule" }
{ "index": 1149, "split": "train" }
Who are the persons whose friends' names include "Ali," and what are their ages and names, sorted by the most recent average year of their friendships?
network_2
select t0.age, t0.name as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like '%Ali%' group by c0 order by avg(t1.year) 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": "network_2", "sql": "select t0.age, t0.name as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like '%Ali%' group by c0 order by avg(t1.year) desc" }, "style": "rule" }
{ "index": 2237, "split": "train" }
What are the names and types of artworks, excluding those that are nominated at festivals in the most frequently occurring festival location?
entertainment_awards
select anon_1.c1, anon_1.c2 from (select name as c1, type as c2 from artwork except select t0.name as c1, t0.type as c2 from artwork as t0 join nomination as t1 on t0.artwork_id = t1.artwork_id join festival_detail as t2 on t1.festival_id = t2.festival_id, (select location as c0 from festival_detail group by c0 order b...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "entertainment_awards", "sql": "select anon_1.c1, anon_1.c2 from (select name as c1, type as c2 from artwork except select t0.name as c1, t0.type as c2 from artwork as t0 join nomination as t1 on t0.artwork_id = t1.artwork_id join festival_detail as t2 on t1.festival_id = t2.festi...
{ "index": 1263, "split": "train" }
For each workshop, how many different rejection results were recorded, and how many submissions were rejected?
workshop_paper
select workshop_id as c1, count(distinct (result)), count(*) from acceptance where result like '%Reject%' 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": "workshop_paper", "sql": "select workshop_id as c1, count(distinct (result)), count(*) from acceptance where result like '%Reject%' group by c1" }, "style": "rule" }
{ "index": 52, "split": "train" }
What are the first five genres and their ratings that have songs stored in MP3 files, displayed in alphabetical order by genre name?
music_1
select t0.g_name as c1, t0.rating from genre as t0 join song as t1 on t0.g_name = t1.genre_is join files as t2 on t1.f_id = t2.f_id where t2.formats = 'mp3' order by c1 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t0.g_name as c1, t0.rating from genre as t0 join song as t1 on t0.g_name = t1.genre_is join files as t2 on t1.f_id = t2.f_id where t2.formats = 'mp3' order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2272, "split": "train" }
Who are the last three students alphabetically by their first names, and what are their advisors and majors?
voter_2
select advisor, major from student order by fname 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": "voter_2", "sql": "select advisor, major from student order by fname desc limit 3" }, "style": "rule" }
{ "index": 426, "split": "train" }
Which host(s) in the farm competitions have the highest host city ID?
farm
select hosts from farm_competition order by host_city_id asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "farm", "sql": "select hosts from farm_competition order by host_city_id asc nulls last limit 1" }, "style": "rule" }
{ "index": 1103, "split": "train" }
Can you tell me the block floor, block code, and nurse names for all on-call nurses? Include both the nurses listed directly and those whose names contain the letter "s".
hospital_1
select anon_1.c2, anon_1.c1, anon_1.c0 from (select blockfloor as c2, blockcode as c1, nurse as c0 from on_call union select t0.blockfloor as c2, t0.blockcode as c1, t0.nurse as c0 from on_call as t0 join nurse as t1 on t0.nurse = t1.employeeid where t1.name like '%s%') 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": "hospital_1", "sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select blockfloor as c2, blockcode as c1, nurse as c0 from on_call union select t0.blockfloor as c2, t0.blockcode as c1, t0.nurse as c0 from on_call as t0 join nurse as t1 on t0.nurse = t1.employeeid where t1.name ...
{ "index": 2275, "split": "train" }
What is the rank of the country with ID 21518 when countries are ordered from the one with the most leagues to the least?
soccer_1
select t1.c1, t1.c3 as c2 from (select row_number() over (order by t0.c5 desc) as c1, t0.c0 as c3 from (select t0.id as c0, count(distinct (t1.id)) as c5 from country as t0 join league as t1 on t0.id = t1.country_id group by c0) as t0) as t1 where c2 = 21518
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select t1.c1, t1.c3 as c2 from (select row_number() over (order by t0.c5 desc) as c1, t0.c0 as c3 from (select t0.id as c0, count(distinct (t1.id)) as c5 from country as t0 join league as t1 on t0.id = t1.country_id group by c0) as t0) as t1 where c2 = 21518" ...
{ "index": 3502, "split": "train" }
What are the January and October temperatures, along with the regional population, for the cities that are hosted the fewest times?
city_record
select t0.jan, t0.oct, t1.regional_population from temperature as t0 join city as t1 on t0.city_id = t1.city_id join hosting_city as t2 on t1.city_id = t2.host_city, (select host_city as c3 from hosting_city group by c3 order by count(*) asc nulls last limit 1) as t0 where t2.host_city = t0.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": "city_record", "sql": "select t0.jan, t0.oct, t1.regional_population from temperature as t0 join city as t1 on t0.city_id = t1.city_id join hosting_city as t2 on t1.city_id = t2.host_city, (select host_city as c3 from hosting_city group by c3 order by count(*) asc nulls last limit...
{ "index": 2360, "split": "train" }
What are the names and IDs of subjects, along with the average of their course subject IDs, for all subjects that have courses authored by individuals with author IDs of 15 or less?
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.author_id <= 15 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.author_id <= 15 group by c1" }, "style": "rule" }
{ "index": 2407, "split": "train" }
What are the cell mobile number, last name, person ID, and address ID of the person who has an address ID of 92?
student_assessment
select t0.cell_mobile_number, t0.last_name, t0.person_id, t1.address_id as c0 from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id where c0 = 92
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select t0.cell_mobile_number, t0.last_name, t0.person_id, t1.address_id as c0 from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id where c0 = 92" }, "style": "rule" }
{ "index": 1909, "split": "train" }
When did the policy for the customer with the highest customer ID among those with policy ID 626 start?
insurance_and_eClaims
select t0.start_date, t0.customer_id as c2 from policies as t0, (select max(customer_id) as c0 from policies where policy_id = 626) as t1 where c2 = t1.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_and_eClaims", "sql": "select t0.start_date, t0.customer_id as c2 from policies as t0, (select max(customer_id) as c0 from policies where policy_id = 626) as t1 where c2 = t1.c0" }, "style": "rule" }
{ "index": 3782, "split": "train" }
Did order 5 occur after order 3?
department_store
select t1.c0 > t0.c0 from (select order_date as c0 from customer_orders where order_id = 5) as t1, (select order_date as c0 from customer_orders where order_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": "department_store", "sql": "select t1.c0 > t0.c0 from (select order_date as c0 from customer_orders where order_id = 5) as t1, (select order_date as c0 from customer_orders where order_id = 3) as t0" }, "style": "rule" }
{ "index": 3082, "split": "train" }
Did train 1 depart later than train 2?
station_weather
select t1.c0 > t0.c0 from (select time as c0 from train where id = 1) as t1, (select time as c0 from train where id = 2) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select t1.c0 > t0.c0 from (select time as c0 from train where id = 1) as t1, (select time as c0 from train where id = 2) as t0" }, "style": "rule" }
{ "index": 3097, "split": "train" }
Did tweet ID 9 get posted earlier than tweet ID 6?
twitter_1
select t1.c1 < t0.c1 from (select createdate as c1 from tweets where id = 9) as t1, (select createdate as c1 from tweets where id = 6) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "twitter_1", "sql": "select t1.c1 < t0.c1 from (select createdate as c1 from tweets where id = 9) as t1, (select createdate as c1 from tweets where id = 6) as t0" }, "style": "rule" }
{ "index": 3965, "split": "train" }
What is the count of unique savings balances for the customer with custid 2, and what is their customer ID?
small_bank_1
select count(distinct (t0.balance)), t1.custid as c1 from savings as t0 join accounts as t1 on t0.custid = t1.custid where c1 = 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": "small_bank_1", "sql": "select count(distinct (t0.balance)), t1.custid as c1 from savings as t0 join accounts as t1 on t0.custid = t1.custid where c1 = 2 group by c1" }, "style": "rule" }
{ "index": 2980, "split": "train" }
How many years apart are the times when browser 1 became compatible with accelerator 3 (on or before 2007) and when it first became compatible with accelerator 1?
browser_web
select t1.c2 - t0.c2 from (select compatible_since_year as c2 from accelerator_compatible_browser where accelerator_id = 1 and browser_id = 1) as t1, (select compatible_since_year as c2 from accelerator_compatible_browser where accelerator_id = 3 and browser_id = 1 and c2 <= 2007) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "browser_web", "sql": "select t1.c2 - t0.c2 from (select compatible_since_year as c2 from accelerator_compatible_browser where accelerator_id = 1 and browser_id = 1) as t1, (select compatible_since_year as c2 from accelerator_compatible_browser where accelerator_id = 3 and browser...
{ "index": 3887, "split": "train" }
How many days are there between a staff member's date of birth and the date they joined the staff team?
driving_school
select julianday(t1.c0) - julianday(t0.c3) from (select date_joined_staff as c0 from staff) as t1, (select date_of_birth as c3 from staff) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select julianday(t1.c0) - julianday(t0.c3) from (select date_joined_staff as c0 from staff) as t1, (select date_of_birth as c3 from staff) as t0" }, "style": "rule" }
{ "index": 3957, "split": "train" }
What are the order dates and actual delivery dates of orders that include products with names ending in "photo" and with a price greater than 157,216?
cre_Drama_Workshop_Groups
select t0.order_date, t0.actual_delivery_date from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id join products as t2 on t1.product_id = t2.product_id where t2.product_name like '%photo' and t2.product_price > 157216
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.order_date, t0.actual_delivery_date from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id join products as t2 on t1.product_id = t2.product_id where t2.product_name like '%photo' and t2.product_price > 157216"...
{ "index": 1444, "split": "train" }
Can you list up to 10 playlists with the name and ID, along with track ID 858, where the playlist ID is 8, sorted by playlist name from Z to A?
store_1
select t0.name as c1, t0.id, t1.track_id as c0 from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id where t1.playlist_id = 8 and c0 = 858 order by c1 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t0.name as c1, t0.id, t1.track_id as c0 from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id where t1.playlist_id = 8 and c0 = 858 order by c1 desc limit 10" }, "style": "rule" }
{ "index": 1560, "split": "train" }
What is the OMIM number for the enzyme with ID 1?
medicine_enzyme_interaction
select omim from enzyme where id = 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select omim from enzyme where id = 1" }, "style": "rule" }
{ "index": 3386, "split": "train" }
Which cities, along with their installation dates and dock counts, have stations where the number of bikes available has ever been between 11 and 15?
bike_1
select t0.city, t0.installation_date, t0.dock_count, t1.station_id from station as t0 join status as t1 on t0.id = t1.station_id where t1.bikes_available between 11 and 15
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select t0.city, t0.installation_date, t0.dock_count, t1.station_id from station as t0 join status as t1 on t0.id = t1.station_id where t1.bikes_available between 11 and 15" }, "style": "rule" }
{ "index": 2675, "split": "train" }
Which staff members, including their gender and ID, recorded fault logs on or after March 11, 2018, at 2:00 PM?
assets_maintenance
select t0.gender from staff as t0 join fault_log as t1 on t0.staff_id = t1.recorded_by_staff_id where t1.fault_log_entry_datetime >= '2018-03-11 14:00:39'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t0.gender from staff as t0 join fault_log as t1 on t0.staff_id = t1.recorded_by_staff_id where t1.fault_log_entry_datetime >= '2018-03-11 14:00:39'" }, "style": "rule" }
{ "index": 2001, "split": "train" }
For players, what are their batting side, birth country, and player ID, along with the college ID of their college affiliations where the college name either ends with 'y' or is the most common college name?
baseball_1
select t0.bats, t0.birth_country, t0.player_id, t1.college_id from player as t0 join player_college as t1 on t0.player_id = t1.player_id join college as t2 on t1.college_id = t2.college_id, (select name_full as c0 from college group by c0 order by count(*) desc limit 1) as t0 where t2.name_full like '%y' or t2.name_ful...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "baseball_1", "sql": "select t0.bats, t0.birth_country, t0.player_id, t1.college_id from player as t0 join player_college as t1 on t0.player_id = t1.player_id join college as t2 on t1.college_id = t2.college_id, (select name_full as c0 from college group by c0 order by count(*) de...
{ "index": 780, "split": "train" }
For each product quantity, what are the ten quantity values with the fewest associated products, sorted by the number of product IDs?
customers_and_invoices
select product_quantity as c0, count(product_id) as c1 from order_items group by c0 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": "customers_and_invoices", "sql": "select product_quantity as c0, count(product_id) as c1 from order_items group by c0 order by c1 asc nulls last limit 10" }, "style": "rule" }
{ "index": 993, "split": "train" }
For each order, what is the date it was placed, the customer ID, the order ID, and how many items are in the order, considering only orders that have the most common order item status among orders with IDs between 5 and 6 or between 9 and 11, or have an order item status that starts with "Fini"?
tracking_orders
select t0.date_order_placed, t0.customer_id, t0.order_id as c0, count(*) from orders as t0 join order_items as t1 on t0.order_id = t1.order_id, (select order_item_status as c1 from order_items where order_id between 5 and 6 or order_id between 9 and 11 group by c1 order by count(*) desc limit 1) as t0 where t1.order_it...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.date_order_placed, t0.customer_id, t0.order_id as c0, count(*) from orders as t0 join order_items as t1 on t0.order_id = t1.order_id, (select order_item_status as c1 from order_items where order_id between 5 and 6 or order_id between 9 and 11 g...
{ "index": 940, "split": "train" }
Which activities include faculty members with IDs up to either the total number of faculty participating or 9922, and for each such activity, what is its name, ID, and the highest faculty ID involved?
activity_1
select t0.activity_name, t0.actid as c2, max(t1.facid) from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid, (select count(facid) as c1 from faculty_participates_in) as t0 where t1.facid <= t0.c1 or t1.facid <= 9922 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": "activity_1", "sql": "select t0.activity_name, t0.actid as c2, max(t1.facid) from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid, (select count(facid) as c1 from faculty_participates_in) as t0 where t1.facid <= t0.c1 or t1.facid <= 9922 group by c2" }, ...
{ "index": 1441, "split": "train" }
How much difference is there between 776 and 1546 based on the total `actid` values for activity 776?
activity_1
select t0.c1 - 1546 from (select sum(t1.actid) as c1 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t0.actid = 776 group by t0.actid) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "activity_1", "sql": "select t0.c1 - 1546 from (select sum(t1.actid) as c1 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t0.actid = 776 group by t0.actid) as t0" }, "style": "rule" }
{ "index": 3207, "split": "train" }
Which customers, along with the date they became customers and their payment methods, have ordered products that either share the most common product details for product ID 3 or have product details ending with "ate"?
customers_and_addresses
select t0.date_became_customer, t0.payment_method, t0.customer_name 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, (select product_details as c1 from products where product_id = ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t0.date_became_customer, t0.payment_method, t0.customer_name 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.p...
{ "index": 1693, "split": "train" }
What are the credits, hours, student IDs, and course IDs for the first three enrollments where the students' grade points are either between 0.7 and 3.3 or less than the total number of gradepoints available, sorted by course ID in alphabetical order?
college_3
select t0.credits, t0.hours, t1.stuid, t1.cid as c3 from course as t0 join enrolled_in as t1 on t0.cid = t1.cid join gradeconversion as t2 on t1.grade = t2.lettergrade, (select count(gradepoint) as c2 from gradeconversion) as t0 where t2.gradepoint between 0.7 and 3.3 or t2.gradepoint < t0.c2 order by c3 asc nulls last...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_3", "sql": "select t0.credits, t0.hours, t1.stuid, t1.cid as c3 from course as t0 join enrolled_in as t1 on t0.cid = t1.cid join gradeconversion as t2 on t1.grade = t2.lettergrade, (select count(gradepoint) as c2 from gradeconversion) as t0 where t2.gradepoint between 0.7...
{ "index": 806, "split": "train" }
Can you provide me with the last names, first names, and classrooms of everyone in the school, including both students and teachers?
student_1
select anon_1.c5, anon_1.c0, anon_1.c1 from (select lastname as c5, firstname as c0, classroom as c1 from list union select lastname, firstname, classroom from teachers) 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": "student_1", "sql": "select anon_1.c5, anon_1.c0, anon_1.c1 from (select lastname as c5, firstname as c0, classroom as c1 from list union select lastname, firstname, classroom from teachers) as anon_1" }, "style": "rule" }
{ "index": 2287, "split": "train" }
What is the lowest altitude recorded for flights operated by companies with IDs between 1 and 3 at the airport with ID 9?
flight_company
select t0.c2 from (select min(t1.altitude) as c2 from airport as t0 join flight as t1 on t0.id = t1.airport_id where t0.id = 9 and t1.company_id between 1 and 3 group by t0.id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_company", "sql": "select t0.c2 from (select min(t1.altitude) as c2 from airport as t0 join flight as t1 on t0.id = t1.airport_id where t0.id = 9 and t1.company_id between 1 and 3 group by t0.id) as t0" }, "style": "rule" }
{ "index": 3382, "split": "train" }
Is the average access count of documents with structure code 9—and whose names end with "ing English"—greater than the overall average access count of all "ing English" documents across different structures?
document_management
select t2.c0 > t1.c1 from (select avg(t1.access_count) as c0 from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code where t0.document_structure_code = 9 group by t0.document_structure_code) as t2, (select avg(t0.c0) as c1 from (select avg(t1.access_count) as c0 fr...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "document_management", "sql": "select t2.c0 > t1.c1 from (select avg(t1.access_count) as c0 from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code where t0.document_structure_code = 9 group by t0.document_structure_code) as t...
{ "index": 3271, "split": "train" }
Which address IDs and person IDs are associated with address ID 99 or with address IDs that don't exist in the addresses records? Please list them ordered by address ID.
student_assessment
select t0.address_id as c1, t1.person_id from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where t1.address_id between 99 and 99 or (not t1.address_id in (select c1 as c1 from addresses)) order by c1 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select t0.address_id as c1, t1.person_id from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where t1.address_id between 99 and 99 or (not t1.address_id in (select c1 as c1 from addresses)) order by c1 asc nulls last" }...
{ "index": 2922, "split": "train" }
Which customer cards have refund transactions but are not associated with accounts having ID less than 11?
customers_card_transactions
select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.card_id as c0, t0.card_type_code as c2, t0.card_number as c1 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.transaction_type like 'Refund%' except select t0.card_id as c0, t0.card_type_code as c2, t0.card_number as ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.card_id as c0, t0.card_type_code as c2, t0.card_number as c1 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.transaction_type like 'Refund...
{ "index": 869, "split": "train" }
What is the difference between the lowest order item product ID associated with product 5 and that associated with product 9?
customers_and_invoices
select t1.c0 - t0.c0 from (select min(t1.product_id) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t0.product_id = 9 group by t0.product_id) as t1, (select t0.product_id, min(t1.product_id) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t1.c0 - t0.c0 from (select min(t1.product_id) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t0.product_id = 9 group by t0.product_id) as t1, (select t0.product_id, min(t1.product_id) as c0 from prod...
{ "index": 3597, "split": "train" }
When did the customer address history record the most recent (highest) Address ID?
customers_and_products_contacts
select t0.date_from, t0.address_id as c1 from customer_address_history as t0, (select max(address_id) as c2 from customer_address_history) as t1 where c1 = t1.c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select t0.date_from, t0.address_id as c1 from customer_address_history as t0, (select max(address_id) as c2 from customer_address_history) as t1 where c1 = t1.c2" }, "style": "rule" }
{ "index": 3760, "split": "train" }
What is the difference in the OMIM values between the enzymes with IDs 3 and 7?
medicine_enzyme_interaction
select t1.c2 - t0.c2 from (select omim as c2 from enzyme where id = 3) as t1, (select omim as c2 from enzyme where 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": "medicine_enzyme_interaction", "sql": "select t1.c2 - t0.c2 from (select omim as c2 from enzyme where id = 3) as t1, (select omim as c2 from enzyme where id = 7) as t0" }, "style": "rule" }
{ "index": 3613, "split": "train" }
Can you list the top 5 characteristics—specifically, their IDs, data types, and type codes—along with the associated product IDs and characteristic IDs for products that have a color description of "black"? The list should be sorted by characteristic ID in descending order.
products_gen_characteristics
select t0.characteristic_id as c3, t0.characteristic_data_type, t0.characteristic_type_code, t1.product_id, t1.characteristic_id 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 join ref_colors as t3 on t2.c...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select t0.characteristic_id as c3, t0.characteristic_data_type, t0.characteristic_type_code, t1.product_id, t1.characteristic_id from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id joi...
{ "index": 17, "split": "train" }
For the paper with ID 206, who are the first three authors listed, including their first names, last names, their author IDs, and their institution IDs? Show the details ordered by institution ID, placing any missing institution IDs at the end.
icfp_1
select t0.fname, t0.authid, t0.lname, t1.authid, t1.instid as c0 from authors as t0 join authorship as t1 on t0.authid = t1.authid join papers as t2 on t1.paperid = t2.paperid where t2.paperid = 206 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": "icfp_1", "sql": "select t0.fname, t0.authid, t0.lname, t1.authid, t1.instid as c0 from authors as t0 join authorship as t1 on t0.authid = t1.authid join papers as t2 on t1.paperid = t2.paperid where t2.paperid = 206 order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 87, "split": "train" }
What are the affiliations, locations, and founding years of universities that have participated in basketball matches with school ID 4 but not with school ID 1?
university_basketball
select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.affiliation as c0, t0.location as c2, t0.founded as c1 from university as t0 join basketball_match as t1 on t0.school_id = t1.school_id where t1.school_id = 4 except select t0.affiliation as c0, t0.location as c2, t0.founded as c1 from university as t0 join basketb...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "university_basketball", "sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.affiliation as c0, t0.location as c2, t0.founded as c1 from university as t0 join basketball_match as t1 on t0.school_id = t1.school_id where t1.school_id = 4 except select t0.affiliation as c0...
{ "index": 1342, "split": "train" }
Did customer 19, who moved in on September 27, 2016, experience a greater percentage change in their average customer ID compared to the minimum percentage change observed across all customers with move-in events on that same date, where the property ID is less than 108?
local_govt_and_lot
select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c4 from (select avg(t1.customer_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2016-09-27 12:00:00' and t1.property_id < 108 group by t0.customer_id) as t2, (select ab...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c4 from (select avg(t1.customer_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2016-09-27 12:00:00...
{ "index": 3962, "split": "train" }
How many years has each journalist with at least 12 years of experience worked, considering only those whose total number of work records is nine or fewer? List these counts ordered by the journalist's ID.
news_report
select count(years_working) from journalist where years_working >= 12 group by journalist_id having count(years_working) <= 9 order by journalist_id asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "news_report", "sql": "select count(years_working) from journalist where years_working >= 12 group by journalist_id having count(years_working) <= 9 order by journalist_id asc nulls last" }, "style": "rule" }
{ "index": 1782, "split": "train" }
Which block's code and floor number are associated with patient SSN 100000001 in the highest hospital floor they have appointments on?
hospital_1
select t0.blockcode, t0.blockfloor as c0 from block as t0 join on_call as t1 on t0.blockfloor = t1.blockfloor join nurse as t2 on t1.nurse = t2.employeeid join appointment as t3 on t2.employeeid = t3.prepnurse join patient as t4 on t3.patient = t4.ssn where t4.ssn = 100000001 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": "hospital_1", "sql": "select t0.blockcode, t0.blockfloor as c0 from block as t0 join on_call as t1 on t0.blockfloor = t1.blockfloor join nurse as t2 on t1.nurse = t2.employeeid join appointment as t3 on t2.employeeid = t3.prepnurse join patient as t4 on t3.patient = t4.ssn where t...
{ "index": 507, "split": "train" }
What are the top 10 countries by nationality, along with the number of unique ship tonnages they have, among those with 3,496 or fewer distinct tonnages, listed in reverse alphabetical order?
ship_mission
select nationality as c1, count(distinct (tonnage)) from ship group by c1 having count(distinct (tonnage)) <= 3496 order by c1 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "ship_mission", "sql": "select nationality as c1, count(distinct (tonnage)) from ship group by c1 having count(distinct (tonnage)) <= 3496 order by c1 desc limit 10" }, "style": "rule" }
{ "index": 928, "split": "train" }
Among students with major 520, which last names have the fewest unique advisors, considering only those with 7134 or fewer distinct advisors?
allergy_1
select lname as c0 from student where major = 520 group by c0 having count(distinct (advisor)) <= 7134 order by count(distinct (advisor)) asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "allergy_1", "sql": "select lname as c0 from student where major = 520 group by c0 having count(distinct (advisor)) <= 7134 order by count(distinct (advisor)) asc nulls last limit 1" }, "style": "rule" }
{ "index": 1873, "split": "train" }
How many products are named clothes?
tracking_orders
select count(*) from products where product_name = 'clothes'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select count(*) from products where product_name = 'clothes'" }, "style": "rule" }
{ "index": 926, "split": "train" }
Among the open dates with a total open year sum under 2014, which open date has the lowest total open years?
device
select open_date as c0, sum(open_year) as c1 from shop group by c0 having sum(open_year) < 2014 order by c1 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "device", "sql": "select open_date as c0, sum(open_year) as c1 from shop group by c0 having sum(open_year) < 2014 order by c1 asc nulls last limit 1" }, "style": "rule" }
{ "index": 1789, "split": "train" }
What are the top five color descriptions, sorted in reverse alphabetical order, for products in categories that start with "Spic" or end with "Herbs"?
products_gen_characteristics
select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.product_category_code like 'Spic%' or t1.product_category_code like '%Herbs' 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": "products_gen_characteristics", "sql": "select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.product_category_code like 'Spic%' or t1.product_category_code like '%Herbs' order by c0 desc limit 5" }, "style": "rul...
{ "index": 1594, "split": "train" }