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 are the catalog ID, level name, level number, and the total of next entry IDs for each catalog structure related to the catalog entry with ID 4?
product_catalog
select t0.catalog_id, t0.catalog_level_name, t0.catalog_level_number as c1, sum(t1.next_entry_id) from catalog_structure as t0 join catalog_contents as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_entry_id = 4 group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select t0.catalog_id, t0.catalog_level_name, t0.catalog_level_number as c1, sum(t1.next_entry_id) from catalog_structure as t0 join catalog_contents as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_entry_id = 4 group by c1" }...
{ "index": 1541, "split": "train" }
How much more or fewer credits does course 392 have compared to course 158?
college_2
select t1.c1 - t0.c1 from (select credits as c1 from course where course_id = 392) as t1, (select credits as c1 from course where course_id = 158) 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": "college_2", "sql": "select t1.c1 - t0.c1 from (select credits as c1 from course where course_id = 392) as t1, (select credits as c1 from course where course_id = 158) as t0" }, "style": "rule" }
{ "index": 3588, "split": "train" }
What are the top 10 companies with the highest market value, where the employee with ID 4 is named starting with "Da"?
company_employee
select t0.company_id, t0.market_value_in_billion as c1 from company as t0 join employment as t1 on t0.company_id = t1.company_id join people as t2 on t1.people_id = t2.people_id where t2.name like 'Da%' and t2.people_id = 4 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": "company_employee", "sql": "select t0.company_id, t0.market_value_in_billion as c1 from company as t0 join employment as t1 on t0.company_id = t1.company_id join people as t2 on t1.people_id = t2.people_id where t2.name like 'Da%' and t2.people_id = 4 order by c1 desc limit 10" ...
{ "index": 1360, "split": "train" }
What is the age difference between Bob and the youngest person whose gender includes the letter "e"?
network_2
select t2.c2 - t0.c3 from (select min(age) as c2 from person where gender like '%e%') as t2, (select age as c3 from person where name = 'Bob') 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": "network_2", "sql": "select t2.c2 - t0.c3 from (select min(age) as c2 from person where gender like '%e%') as t2, (select age as c3 from person where name = 'Bob') as t0" }, "style": "rule" }
{ "index": 3894, "split": "train" }
For each payment method ending with "ebit," what is the total amount paid and how many different payment method codes are used?
driving_school
select payment_method_code as c0, sum(amount_payment), count(distinct (payment_method_code)) from customer_payments where c0 like '%ebit' group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select payment_method_code as c0, sum(amount_payment), count(distinct (payment_method_code)) from customer_payments where c0 like '%ebit' group by c0" }, "style": "rule" }
{ "index": 1119, "split": "train" }
Can you list the types and IDs of all organizations in the database?
tracking_grants_for_research
select organisation_type, organisation_id from organisations
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select organisation_type, organisation_id from organisations" }, "style": "rule" }
{ "index": 1148, "split": "train" }
Is the product ID for order item 8 less than the product ID for order item 14?
tracking_orders
select t1.c1 < t0.c1 from (select product_id as c1 from order_items where order_item_id = 8) as t1, (select product_id as c1 from order_items where order_item_id = 14) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t1.c1 < t0.c1 from (select product_id as c1 from order_items where order_item_id = 8) as t1, (select product_id as c1 from order_items where order_item_id = 14) as t0" }, "style": "rule" }
{ "index": 3579, "split": "train" }
What is the catalog ID minus one for entries at level 8 in the catalog structure?
product_catalog
select catalog_id - 1 from catalog_structure where catalog_level_number = 8
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select catalog_id - 1 from catalog_structure where catalog_level_number = 8" }, "style": "rule" }
{ "index": 3246, "split": "train" }
Which county has the fewest records in the public safety data? Please specify the county id and how many times it appears.?
county_public_safety
select county_id as c0, count(distinct (county_id)) as c1 from county_public_safety group by c0 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": "county_public_safety", "sql": "select county_id as c0, count(distinct (county_id)) as c1 from county_public_safety group by c0 order by c1 asc nulls last limit 1" }, "style": "rule" }
{ "index": 3662, "split": "train" }
What are the names and IDs of all media types, along with the smallest invoice number associated with each?
store_1
select t0.name, t0.id as c2, min(t2.invoice_id) from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id join invoice_lines as t2 on t1.id = t2.track_id 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": "store_1", "sql": "select t0.name, t0.id as c2, min(t2.invoice_id) from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id join invoice_lines as t2 on t1.id = t2.track_id group by c2" }, "style": "rule" }
{ "index": 147, "split": "train" }
What are the director, release year, and movie ID, along with the reviewer ID and rating date, for the most recent rating given by the reviewer with the least common name?
movie_1
select t0.director, t0.year, t0.mid, t1.rid, t1.ratingdate as c2 from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid, (select name as c0 from reviewer group by c0 order by count(*) asc nulls last limit 1) as t0 where t2.name = t0.c0 order by c2 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "movie_1", "sql": "select t0.director, t0.year, t0.mid, t1.rid, t1.ratingdate as c2 from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid, (select name as c0 from reviewer group by c0 order by count(*) asc nulls last limit 1) as t0 where t2.n...
{ "index": 1261, "split": "train" }
What are the course codes, class sections, and classroom locations, along with the student numbers and class codes for students whose last names contain the letter "r" or who are named Walter Oblonski?
college_1
select t0.crs_code, t0.class_section, t0.class_room, t1.stu_num, t1.class_code from class as t0 join enroll as t1 on t0.class_code = t1.class_code join student as t2 on t1.stu_num = t2.stu_num where t2.stu_lname like '%r%' or t2.stu_fname = 'Walter' and t2.stu_lname = 'Oblonski'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_1", "sql": "select t0.crs_code, t0.class_section, t0.class_room, t1.stu_num, t1.class_code from class as t0 join enroll as t1 on t0.class_code = t1.class_code join student as t2 on t1.stu_num = t2.stu_num where t2.stu_lname like '%r%' or t2.stu_fname = 'Walter' and t2.stu...
{ "index": 92, "split": "train" }
List the unique names and IDs of all editors.
journal_committee
select distinct name, editor_id from editor
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "journal_committee", "sql": "select distinct name, editor_id from editor" }, "style": "rule" }
{ "index": 2049, "split": "train" }
What is the date of the most recent problem log entry?
tracking_software_problems
select log_entry_date as c0 from problem_log 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": "tracking_software_problems", "sql": "select log_entry_date as c0 from problem_log order by c0 desc limit 1" }, "style": "rule" }
{ "index": 1704, "split": "train" }
Which are the address IDs less than 14 that are associated with customer addresses, sorted by city in reverse alphabetical order?
customers_and_addresses
select t0.address_id as c0 from customer_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id where c0 < 14 order by t1.city 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": "customers_and_addresses", "sql": "select t0.address_id as c0 from customer_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id where c0 < 14 order by t1.city desc limit 10" }, "style": "rule" }
{ "index": 1366, "split": "train" }
Among the organisation types whose descriptions end with "sor," which type has the fewest distinct organisations associated with it?
tracking_grants_for_research
select t0.c2 as c3, count(distinct (t0.c1)) as c0 from (select organisation_type_description as c2, organisation_type as c1 from organisation_types where c2 like '%sor') as t0 group by c3 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t0.c2 as c3, count(distinct (t0.c1)) as c0 from (select organisation_type_description as c2, organisation_type as c1 from organisation_types where c2 like '%sor') as t0 group by c3 order by c0 asc nulls last limit 1" }, "style": "...
{ "index": 3670, "split": "train" }
For product code 6, what are the three product codes with a number of associated manufacturers between 1 and 5, sorted from the fewest to the most manufacturers?
manufactory_1
select code as c0 from products where c0 = 6 group by c0 having count(manufacturer) between 1 and 5 order by count(manufacturer) 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": "manufactory_1", "sql": "select code as c0 from products where c0 = 6 group by c0 having count(manufacturer) between 1 and 5 order by count(manufacturer) asc nulls last limit 3" }, "style": "rule" }
{ "index": 880, "split": "train" }
Can you tell me the names of companies and their profits in billions that are associated with station company 3, but aren't connected to station company 10?
gas_company
select anon_1.c0, anon_1.c1 from (select t0.company as c0, t0.profits_billion as c1 from company as t0 join station_company as t1 on t0.company_id = t1.company_id where t1.company_id = 3 except select t0.company as c0, t0.profits_billion as c1 from company as t0 join station_company as t1 on t0.company_id = t1.company_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "gas_company", "sql": "select anon_1.c0, anon_1.c1 from (select t0.company as c0, t0.profits_billion as c1 from company as t0 join station_company as t1 on t0.company_id = t1.company_id where t1.company_id = 3 except select t0.company as c0, t0.profits_billion as c1 from company a...
{ "index": 2956, "split": "train" }
What is the percentage change in the organization associated with service 47 between May 27, 2016, and May 31, 2017?
local_govt_and_lot
select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select t0.organization_id as c1 from services as t0 join organizations as t1 on t0.organization_id = t1.organization_id join things as t2 on t1.organization_id = t2.organization_id join timed_status_of_things as t3 on t2.thing_id = t3.thing_id where t0.service_id = 4...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select t0.organization_id as c1 from services as t0 join organizations as t1 on t0.organization_id = t1.organization_id join things as t2 on t1.organization_id = t2.organization_id join timed_status...
{ "index": 3422, "split": "train" }
How many days have passed between the date when customer 13's address was first recorded and the date it was last updated in their address history?
customers_and_products_contacts
select julianday(t1.c0) - julianday(t0.c2) from (select date_from as c0 from customer_address_history where customer_id = 13 and customer_id = 13) as t1, (select date_to as c2 from customer_address_history) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select julianday(t1.c0) - julianday(t0.c2) from (select date_from as c0 from customer_address_history where customer_id = 13 and customer_id = 13) as t1, (select date_to as c2 from customer_address_history) as t0" }, "style": "rule" }
{ "index": 3928, "split": "train" }
How many unique assets are associated with each asset part, and are they listed from those with the most assets to the fewest?
assets_maintenance
select count(distinct (asset_id)) as c0 from asset_parts order by c0 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select count(distinct (asset_id)) as c0 from asset_parts order by c0 desc" }, "style": "rule" }
{ "index": 2751, "split": "train" }
Which products included in order 2 have been ordered four times or fewer? Please show their details, their product IDs, and the total number of unique products in that order.
customers_and_addresses
select t0.product_details, t0.product_id as c2, count(distinct (t1.product_id)) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_id = 2 group by c2 having count(*) <= 4
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t0.product_details, t0.product_id as c2, count(distinct (t1.product_id)) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_id = 2 group by c2 having count(*) <= 4" }, "style": "rule" }
{ "index": 2198, "split": "train" }
Which address in Kentucky, with fewer than three associated customers, has the highest total sum of its address IDs? Please include the total sum, the county or state/province information, and the address ID in your answer.
customers_and_addresses
select sum(t0.address_id) as c1, t1.state_province_county as c0, t1.address_id as c2 from customer_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id where c0 = 'Kentucky' group by c2 having count(*) < 3 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": "customers_and_addresses", "sql": "select sum(t0.address_id) as c1, t1.state_province_county as c0, t1.address_id as c2 from customer_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id where c0 = 'Kentucky' group by c2 having count(*) < 3 order by c1 desc limit ...
{ "index": 109, "split": "train" }
Which are the first three districts and their corresponding parties when the election districts are ordered from earliest to latest, placing any districts with missing values at the end?
election
select district as c0, party from election 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": "election", "sql": "select district as c0, party from election order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 1203, "split": "train" }
How many days have passed between the Date To and Date From for the customer with ID 12?
customers_and_products_contacts
select julianday(t1.c2) - julianday(t0.c0) from (select date_to as c2 from customer_address_history where customer_id = 12 and customer_id = 12) as t1, (select date_from as c0 from customer_address_history) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select julianday(t1.c2) - julianday(t0.c0) from (select date_to as c2 from customer_address_history where customer_id = 12 and customer_id = 12) as t1, (select date_from as c0 from customer_address_history) as t0" }, "style": "rule" }
{ "index": 3813, "split": "train" }
What is the most recent year that employees started working at their companies?
company_employee
select max(year_working) from employment
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_employee", "sql": "select max(year_working) from employment" }, "style": "rule" }
{ "index": 1857, "split": "train" }
Show the start and end dates for customer address histories where the customer’s payment method ends with "it" or is set to "Direct Debit".
customers_and_products_contacts
select t0.date_from, t0.date_to from customer_address_history as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.payment_method_code like '%it' or t1.payment_method_code = 'Direct Debit'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.date_to from customer_address_history as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.payment_method_code like '%it' or t1.payment_method_code = 'Direct Debit'" }, "style": "rule" }
{ "index": 335, "split": "train" }
What are the descriptions and codes of the functional areas associated with the document having code 961 or any document code that includes "34"?
document_management
select t0.functional_area_description, t1.functional_area_code from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t1.document_code = 961 or t1.document_code like '%34%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "document_management", "sql": "select t0.functional_area_description, t1.functional_area_code from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t1.document_code = 961 or t1.document_code like '%34%'" }, ...
{ "index": 2355, "split": "train" }
Can you show me up to 10 problem descriptions along with their product names where the product name contains either "a" or "og," sorted alphabetically by the problem description?
tracking_software_problems
select t0.problem_description as c0, t1.product_name as c1 from problems as t0 join product as t1 on t0.product_id = t1.product_id where c1 like '%a%' or c1 like '%og%' order by c0 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t0.problem_description as c0, t1.product_name as c1 from problems as t0 join product as t1 on t0.product_id = t1.product_id where c1 like '%a%' or c1 like '%og%' order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 874, "split": "train" }
Can you tell me the source airport IDs for routes where the airline's name doesn't match any airport name, the airline is based in a country ending with "u," and the results are sorted from highest to lowest airport ID?
flight_4
select t0.src_apid as c1 from routes as t0 join airlines as t1 on t0.alid = t1.alid where (not t1.name in (select airports.name as c0 from airports)) and t1.country like '%u' order by c1 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t0.src_apid as c1 from routes as t0 join airlines as t1 on t0.alid = t1.alid where (not t1.name in (select airports.name as c0 from airports)) and t1.country like '%u' order by c1 desc" }, "style": "rule" }
{ "index": 1211, "split": "train" }
Which airport with an ID of 2 or less has at least one flight, and what is the first IATA code, city, and ID when sorted alphabetically by IATA code?
flight_company
select t0.iata as c1, t0.city, t0.id as c2 from airport as t0 join flight as t1 on t0.id = t1.airport_id where t1.airport_id <= 2 group by c2 having count(*) >= 1 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": "flight_company", "sql": "select t0.iata as c1, t0.city, t0.id as c2 from airport as t0 join flight as t1 on t0.id = t1.airport_id where t1.airport_id <= 2 group by c2 having count(*) >= 1 order by c1 asc nulls last limit 1" }, "style": "rule" }
{ "index": 2390, "split": "train" }
What are the names and IDs of the five genres with the shortest average track length for tracks priced at $1.99 or less, ordered from Z to A by genre name?
store_1
select t0.name as c1, t0.id as c0, avg(t1.milliseconds) from genres as t0 join tracks as t1 on t0.id = t1.genre_id where t1.unit_price <= 1.99 group by c0 order by c1 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t0.name as c1, t0.id as c0, avg(t1.milliseconds) from genres as t0 join tracks as t1 on t0.id = t1.genre_id where t1.unit_price <= 1.99 group by c0 order by c1 desc limit 5" }, "style": "rule" }
{ "index": 2125, "split": "train" }
What are the names and genders of the first 10 artists, including their song titles and ratings, for songs whose genres have ratings beginning with "8", ordered by the artists' names in alphabetical order?
music_1
select t0.artist_name as c1, t0.gender, t1.artist_name, t1.rating from artist as t0 join song as t1 on t0.artist_name = t1.artist_name join genre as t2 on t1.genre_is = t2.g_name where t2.rating like '8%' 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": "music_1", "sql": "select t0.artist_name as c1, t0.gender, t1.artist_name, t1.rating from artist as t0 join song as t1 on t0.artist_name = t1.artist_name join genre as t2 on t1.genre_is = t2.g_name where t2.rating like '8%' order by c1 asc nulls last limit 10" }, "style": "rul...
{ "index": 1408, "split": "train" }
Can you provide the names and owners of all channels and programs?
program_share
select anon_1.c0, anon_1.c2 from (select name as c0, owner as c2 from channel union select name, owner from program) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "program_share", "sql": "select anon_1.c0, anon_1.c2 from (select name as c0, owner as c2 from channel union select name, owner from program) as anon_1" }, "style": "rule" }
{ "index": 1971, "split": "train" }
Which airport names and countries are shared by both airports and airlines in the database?
flight_4
select anon_1.c1, anon_1.c3 from (select name as c1, country as c3 from airports intersect select name, country from airlines) 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": "flight_4", "sql": "select anon_1.c1, anon_1.c3 from (select name as c1, country as c3 from airports intersect select name, country from airlines) as anon_1" }, "style": "rule" }
{ "index": 1307, "split": "train" }
Find the tweet text, creation date, and the email addresses of users who have between 890 and 6,662,425 followers and whose email ends with "@richest.com".
twitter_1
select t0.text, t0.createdate, t1.email as c0 from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid where t1.followers between 890 and 6662425 and c0 like '%@richest.com'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.text, t0.createdate, t1.email as c0 from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid where t1.followers between 890 and 6662425 and c0 like '%@richest.com'" }, "style": "rule" }
{ "index": 2559, "split": "train" }
What are the elevations of the airports involved in routes to destination airports 'I' or 'WH', showing the ten highest elevation airports with the most recent year or date?
flight_4
select t0.elevation from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.dst_ap = 'I' or t1.dst_ap = 'WH' order by t0.y 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": "flight_4", "sql": "select t0.elevation from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.dst_ap = 'I' or t1.dst_ap = 'WH' order by t0.y desc limit 10" }, "style": "rule" }
{ "index": 1455, "split": "train" }
Which are the five restaurant type IDs with the greatest number of descriptions?
restaurant_1
select restypeid as c0, count(restypedescription) from restaurant_type group by c0 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": "restaurant_1", "sql": "select restypeid as c0, count(restypedescription) from restaurant_type group by c0 order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2249, "split": "train" }
Could you tell me the top three genre identifiers (genre_is) linked to the file with ID 5, sorted by country name in alphabetical order, with any entries missing a country listed last?
music_1
select t0.genre_is from song as t0 join files as t1 on t0.f_id = t1.f_id where t1.f_id = 5 order by t0.country 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": "music_1", "sql": "select t0.genre_is from song as t0 join files as t1 on t0.f_id = t1.f_id where t1.f_id = 5 order by t0.country asc nulls last limit 3" }, "style": "rule" }
{ "index": 1322, "split": "train" }
During the week from November 8 to November 14, 2008, how many course registrations and total registrations are there for each course, and which are the 10 courses with the fewest registrations?
student_assessment
select count(course_id), count(*) as c0 from student_course_registrations where registration_date between '2008-11-08 10:35:13' and '2008-11-14 10:35:13' 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": "student_assessment", "sql": "select count(course_id), count(*) as c0 from student_course_registrations where registration_date between '2008-11-08 10:35:13' and '2008-11-14 10:35:13' order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 2265, "split": "train" }
Which match took place at a venue with October temperatures either at the highest recorded value or at or below 28.9°C, and can you provide the venue, competition, match ID, as well as the GDP and regional population of the host city? If multiple matches qualify, list the one that appears first alphabetically by venue.
city_record
select t0.venue as c2, t0.competition, t0.match_id, t2.gdp, t2.regional_population 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 join temperature as t3 on t2.city_id = t3.city_id, (select max(oct) as c3 from temperature) as t0 where t3.oct = t0.c3 or ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 as c2, t0.competition, t0.match_id, t2.gdp, t2.regional_population 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 join temperature as t3 on t2.city_id = t3.city_id, (select m...
{ "index": 1760, "split": "train" }
How much did the number of employees hired on May 3, 2003, change as a percentage compared to those hired on October 17, 2003?
store_1
select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select count(distinct (id)) as c0 from employees where hire_date = '2003-05-03 00:00:00' group by id) as t0, (select count(distinct (id)) as c0 from employees where hire_date = '2003-10-17 00:00:00' group by id) as t1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select count(distinct (id)) as c0 from employees where hire_date = '2003-05-03 00:00:00' group by id) as t0, (select count(distinct (id)) as c0 from employees where hire_date = '2003-10-17 00:00:00' ...
{ "index": 3052, "split": "train" }
Can you tell me the ranking position of album(s) whose maximum media type ID is 249, when albums with tracks longer than 235,311 milliseconds are sorted in order of their highest media type ID?
store_1
select t1.c2, t1.c5 as c3 from (select row_number() over (order by t0.c0 asc nulls last) as c2, t0.c1 as c5 from (select t0.id as c1, max(t1.media_type_id) as c0 from albums as t0 join tracks as t1 on t0.id = t1.album_id where t1.milliseconds > 235311 group by c1) as t0) as t1 where c3 = 249
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t1.c2, t1.c5 as c3 from (select row_number() over (order by t0.c0 asc nulls last) as c2, t0.c1 as c5 from (select t0.id as c1, max(t1.media_type_id) as c0 from albums as t0 join tracks as t1 on t0.id = t1.album_id where t1.milliseconds > 235311 group by c...
{ "index": 3504, "split": "train" }
What are the details (Year, Theme, Exhibition ID, Artist ID, Ticket Price) of exhibitions that feature artists who joined the gallery on or before 1998 and are now aged 47 or older?
theme_gallery
select anon_1.c1, anon_1.c2, anon_1.c3, anon_1.c0, anon_1.c4 from (select t0.year as c1, t0.theme as c2, t0.exhibition_id as c3, t0.artist_id as c0, t0.ticket_price as c4 from exhibition as t0 join artist as t1 on t0.artist_id = t1.artist_id where t1.year_join <= 1998 intersect select t0.year as c1, t0.theme as c2, 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": "theme_gallery", "sql": "select anon_1.c1, anon_1.c2, anon_1.c3, anon_1.c0, anon_1.c4 from (select t0.year as c1, t0.theme as c2, t0.exhibition_id as c3, t0.artist_id as c0, t0.ticket_price as c4 from exhibition as t0 join artist as t1 on t0.artist_id = t1.artist_id where t1.year_...
{ "index": 2413, "split": "train" }
Find the Route ID for the delivery route named "Grady, King and Price.
customer_deliveries
select route_id from delivery_routes where route_name = 'Grady, King and Price'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_deliveries", "sql": "select route_id from delivery_routes where route_name = 'Grady, King and Price'" }, "style": "rule" }
{ "index": 1409, "split": "train" }
Can you list the route IDs and names for all delivery routes with route IDs of 10 or less?
customer_deliveries
select t0.route_id, t0.route_name from delivery_routes as t0 join delivery_route_locations as t1 on t0.route_id = t1.route_id where t1.route_id <= 10 or t1.route_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": "customer_deliveries", "sql": "select t0.route_id, t0.route_name from delivery_routes as t0 join delivery_route_locations as t1 on t0.route_id = t1.route_id where t1.route_id <= 10 or t1.route_id <= 2" }, "style": "rule" }
{ "index": 1478, "split": "train" }
Does the percentage difference in the customer ID for customer 16 who moved in on March 27, 2015, exceed the minimal percentage change observed among all customers who moved in on that date?
local_govt_and_lot
select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c2 from (select min(t1.customer_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t2, (select abs((min(t0.c0) / cast(min(...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c2 from (select min(t1.customer_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00...
{ "index": 3441, "split": "train" }
Find the total number of behavior incidents (represented by the sum of student IDs) for each student whose first name starts with "R".
behavior_monitoring
select sum(t0.student_id), t1.student_id as c0 from behavior_incident as t0 join students as t1 on t0.student_id = t1.student_id where t1.first_name like 'R%' group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select sum(t0.student_id), t1.student_id as c0 from behavior_incident as t0 join students as t1 on t0.student_id = t1.student_id where t1.first_name like 'R%' group by c0" }, "style": "rule" }
{ "index": 865, "split": "train" }
What are the names, IDs, scheduled times, and train numbers of trains that pass through stations where the weekly high temperature is less than 50 degrees?
station_weather
select anon_1.c2, anon_1.c1, anon_1.c0, anon_1.c3 from (select name as c2, id as c1, time as c0, train_number as c3 from train intersect select t0.name as c2, t0.id as c1, t0.time as c0, t0.train_number as c3 from train as t0 join route as t1 on t0.id = t1.train_id join station as t2 on t1.station_id = t2.id join weekl...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c2, anon_1.c1, anon_1.c0, anon_1.c3 from (select name as c2, id as c1, time as c0, train_number as c3 from train intersect select t0.name as c2, t0.id as c1, t0.time as c0, t0.train_number as c3 from train as t0 join route as t1 on t0.id = ...
{ "index": 1736, "split": "train" }
Is the percentage difference of customer 31's average customer ID on September 27, 2016, at noon, greater than the overall variation across all customers on that same date?
local_govt_and_lot
select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c3 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 = 31 and t1.date_moved_in = '2016-09-27 12:00:00' group by t0.customer_id) as t2, (select abs((count(t0.c0) / cast(co...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c3 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 = 31 and t1.date_moved_in = '2016-09-27 12:00:00...
{ "index": 3446, "split": "train" }
What are the age, job, and name of persons who have fewer than 5 friends, along with the average year of those friendships that took place on or before the overall average friendship year?
network_2
select t0.age, t0.job, t0.name as c2, avg(t1.year) as c1 from person as t0 join personfriend as t1 on t0.name = t1.friend, (select avg(year) as c1 from personfriend) as t0 where t1.year <= t0.c1 group by c2 having count(*) < 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select t0.age, t0.job, t0.name as c2, avg(t1.year) as c1 from person as t0 join personfriend as t1 on t0.name = t1.friend, (select avg(year) as c1 from personfriend) as t0 where t1.year <= t0.c1 group by c2 having count(*) < 5" }, "style": "rule" }
{ "index": 1692, "split": "train" }
Is the log entry date for problem log 3 more recent than the log entry date for problem log 11?
tracking_software_problems
select t1.c2 > t0.c2 from (select log_entry_date as c2 from problem_log where problem_log_id = 3) as t1, (select log_entry_date as c2 from problem_log where problem_log_id = 11) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t1.c2 > t0.c2 from (select log_entry_date as c2 from problem_log where problem_log_id = 3) as t1, (select log_entry_date as c2 from problem_log where problem_log_id = 11) as t0" }, "style": "rule" }
{ "index": 3110, "split": "train" }
Is the average unit price of tracks on album 136 less than the combined total of average track prices for all albums that have tracks priced between 99 cents and 1.99 dollars?
store_1
select t2.c0 < t1.c3 from (select avg(t1.unit_price) as c0 from albums as t0 join tracks as t1 on t0.id = t1.album_id where t0.id = 136 group by t0.id) as t2, (select sum(t0.c0) as c3 from (select avg(t1.unit_price) as c0 from albums as t0 join tracks as t1 on t0.id = t1.album_id where t1.unit_price between 0.99 and 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 t2.c0 < t1.c3 from (select avg(t1.unit_price) as c0 from albums as t0 join tracks as t1 on t0.id = t1.album_id where t0.id = 136 group by t0.id) as t2, (select sum(t0.c0) as c3 from (select avg(t1.unit_price) as c0 from albums as t0 join tracks as t1 on t...
{ "index": 3323, "split": "train" }
What are the station IDs and their smallest longitudes for stations with names containing "et" where the minimum longitude is at least -122.403452, ordered from highest to lowest ID?
bike_1
select id as c0, min(long) from station where name like '%et%' group by c0 having min(long) >= -122.403452 order by c0 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select id as c0, min(long) from station where name like '%et%' group by c0 having min(long) >= -122.403452 order by c0 desc" }, "style": "rule" }
{ "index": 2612, "split": "train" }
Find the cinema ID, name, and location, along with the film ID and scheduled cinema ID for films whose titles end with "Case of the Bermuda Triangle," sorted by cinema ID in descending order.
cinema
select t0.cinema_id, t0.name, t0.location, t1.film_id, t1.cinema_id as c2 from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id join film as t2 on t1.film_id = t2.film_id where t2.title like '% Case of the Bermuda Triangle' order by c2 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": "cinema", "sql": "select t0.cinema_id, t0.name, t0.location, t1.film_id, t1.cinema_id as c2 from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id join film as t2 on t1.film_id = t2.film_id where t2.title like '% Case of the Bermuda Triangle' order by c2 desc" }, ...
{ "index": 1980, "split": "train" }
Which trust relationship involves a user who has reviewed items with a rating of 7 or higher, and among these, what is the trust score, source user ID, target user ID, as well as the user’s user ID and name? Show the first such user ordered alphabetically by their name.
epinions_1
select t0.trust, t0.source_u_id, t0.target_u_id, t1.u_id, t1.name as c1 from trust as t0 join useracct as t1 on t0.source_u_id = t1.u_id join review as t2 on t1.u_id = t2.u_id where t2.rating >= 7 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": "epinions_1", "sql": "select t0.trust, t0.source_u_id, t0.target_u_id, t1.u_id, t1.name as c1 from trust as t0 join useracct as t1 on t0.source_u_id = t1.u_id join review as t2 on t1.u_id = t2.u_id where t2.rating >= 7 order by c1 asc nulls last limit 1" }, "style": "rule" }
{ "index": 1187, "split": "train" }
How much larger is the smallest lot ID linked to lot 11 compared to the smallest lot ID linked to lot 3?
tracking_share_transactions
select t1.c0 - t0.c0 from (select min(t1.lot_id) as c0 from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id where t0.lot_id = 3 group by t0.lot_id) as t1, (select t0.lot_id, min(t1.lot_id) as c0 from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id where t0.lot_id = 11 group by t0.lot_i...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select t1.c0 - t0.c0 from (select min(t1.lot_id) as c0 from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id where t0.lot_id = 3 group by t0.lot_id) as t1, (select t0.lot_id, min(t1.lot_id) as c0 from lots as t0 join transacti...
{ "index": 3630, "split": "train" }
List the document IDs and receipt dates for documents that have a draft with ID 13 but haven't been mailed before May 16, 1986.
cre_Doc_Control_Systems
select anon_1.c0, anon_1.c1 from (select t0.document_id as c0, t0.receipt_date as c1 from documents as t0 join document_drafts as t1 on t0.document_id = t1.document_id where t1.document_id = 13 except select t0.document_id as c0, t0.receipt_date as c1 from documents as t0 join documents_mailed as t1 on t0.document_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": "cre_Doc_Control_Systems", "sql": "select anon_1.c0, anon_1.c1 from (select t0.document_id as c0, t0.receipt_date as c1 from documents as t0 join document_drafts as t1 on t0.document_id = t1.document_id where t1.document_id = 13 except select t0.document_id as c0, t0.receipt_date ...
{ "index": 441, "split": "train" }
Can you tell me the IDs and names of regions affected by storms that caused damages of more than 1.49 million USD or exactly 10.75 million USD, along with the IDs of the affected regions?
storm_record
select t0.region_id, t0.region_name, t1.region_id from region as t0 join affected_region as t1 on t0.region_id = t1.region_id join storm as t2 on t1.storm_id = t2.storm_id where t2.damage_millions_usd > 1.49 or t2.damage_millions_usd = 10.75
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "storm_record", "sql": "select t0.region_id, t0.region_name, t1.region_id from region as t0 join affected_region as t1 on t0.region_id = t1.region_id join storm as t2 on t1.storm_id = t2.storm_id where t2.damage_millions_usd > 1.49 or t2.damage_millions_usd = 10.75" }, "style"...
{ "index": 1437, "split": "train" }
Can you list the Event IDs, attendance numbers, and event names for events that have news reports with work types containing the letter "c," but exclude those where journalist ID 4 contributed?
news_report
select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.event_id as c0, t0.event_attendance as c2, t0.name as c1 from event as t0 join news_report as t1 on t0.event_id = t1.event_id where t1.work_type like '%c%' except select t0.event_id as c0, t0.event_attendance as c2, t0.name as c1 from event as t0 join news_report a...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "news_report", "sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.event_id as c0, t0.event_attendance as c2, t0.name as c1 from event as t0 join news_report as t1 on t0.event_id = t1.event_id where t1.work_type like '%c%' except select t0.event_id as c0, t0.event_atten...
{ "index": 1330, "split": "train" }
The question can be slightly adjusted based on the intended interpretation, but this captures the core details in a natural way.)?
roller_coaster
select country_id as c1, min(area), max(population) as c0 from country where c1 = 1 group by c1 order by c0 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "roller_coaster", "sql": "select country_id as c1, min(area), max(population) as c0 from country where c1 = 1 group by c1 order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 2756, "split": "train" }
Which departments and their buildings have instructors earning more than $59,706.49?
college_2
select t0.dept_name, t0.building from department as t0 join instructor as t1 on t0.dept_name = t1.dept_name where t1.salary > 59706.49
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_2", "sql": "select t0.dept_name, t0.building from department as t0 join instructor as t1 on t0.dept_name = t1.dept_name where t1.salary > 59706.49" }, "style": "rule" }
{ "index": 655, "split": "train" }
How many events are recorded in the Participants in Events table, ordered from those with the most participants to the fewest?
local_govt_in_alabama
select count(event_id) as c0 from participants_in_events order by c0 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_in_alabama", "sql": "select count(event_id) as c0 from participants_in_events order by c0 asc nulls last" }, "style": "rule" }
{ "index": 768, "split": "train" }
How many days are there between the date of birth and the date this customer with ID 9 became a customer?
driving_school
select julianday(t1.c0) - julianday(t0.c3) from (select date_of_birth as c0 from customers) as t1, (select date_became_customer as c3 from customers where customer_id = 9 and customer_id = 9) 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_of_birth as c0 from customers) as t1, (select date_became_customer as c3 from customers where customer_id = 9 and customer_id = 9) as t0" }, "style": "rule" }
{ "index": 3707, "split": "train" }
What are the number of bikes available and the station IDs for stations located at latitudes above 37.789625?
bike_1
select t0.bikes_available, t0.station_id from status as t0 join station as t1 on t0.station_id = t1.id where t1.lat > 37.789625
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.bikes_available, t0.station_id from status as t0 join station as t1 on t0.station_id = t1.id where t1.lat > 37.789625" }, "style": "rule" }
{ "index": 2824, "split": "train" }
What are the lowest and highest average order IDs across all products based on their associated orders?
customers_and_products_contacts
select min(t0.c0), max(t0.c0) from (select avg(t1.order_id) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id group by t0.product_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select min(t0.c0), max(t0.c0) from (select avg(t1.order_id) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id group by t0.product_id) as t0" }, "style": "rule" }
{ "index": 3639, "split": "train" }
Which stations have fewer bikes available than the highest number of bikes at any station, and what are their dock counts and cities? Also, can you list them starting from the stations with the most bikes available?
bike_1
select t0.dock_count, t0.city from station as t0 join status as t1 on t0.id = t1.station_id, (select max(bikes_available) as c2 from status) as t0 where t1.bikes_available < t0.c2 order by t1.bikes_available 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": "bike_1", "sql": "select t0.dock_count, t0.city from station as t0 join status as t1 on t0.id = t1.station_id, (select max(bikes_available) as c2 from status) as t0 where t1.bikes_available < t0.c2 order by t1.bikes_available desc" }, "style": "rule" }
{ "index": 1172, "split": "train" }
How many unique order items are linked to the product with ID 1, and what are the details and ID of that product?
customers_and_addresses
select count(distinct (t0.product_id)), t1.product_details, t1.product_id as c2 from order_items as t0 join products as t1 on t0.product_id = t1.product_id where c2 = 1 or c2 = 1 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": "customers_and_addresses", "sql": "select count(distinct (t0.product_id)), t1.product_details, t1.product_id as c2 from order_items as t0 join products as t1 on t0.product_id = t1.product_id where c2 = 1 or c2 = 1 group by c2" }, "style": "rule" }
{ "index": 371, "split": "train" }
Which courses have registrations that took place between October 4th, 2008 in the late morning and November 5th, 2008 at the same time, and what are their course IDs?
student_assessment
select t0.course_id, t1.course_id from courses as t0 join student_course_registrations as t1 on t0.course_id = t1.course_id where t1.registration_date between '2008-10-04 10:35:13' and '2008-11-05 10:35:13'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select t0.course_id, t1.course_id from courses as t0 join student_course_registrations as t1 on t0.course_id = t1.course_id where t1.registration_date between '2008-10-04 10:35:13' and '2008-11-05 10:35:13'" }, "style": "rule" }
{ "index": 1843, "split": "train" }
What is the numerical difference between the company ID of engineer 11 and company 15?
assets_maintenance
select company_id - 15 from maintenance_engineers where engineer_id = 11
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select company_id - 15 from maintenance_engineers where engineer_id = 11" }, "style": "rule" }
{ "index": 3210, "split": "train" }
Identify the top 10 course authors and tutors, filtered by those whose family names end with "r" or are exactly "Armstrong," and report their number of distinct courses, total number of subjects, and their author IDs, sorted by author ID from highest to lowest.
e_learning
select count(distinct (t0.author_id)), sum(t0.subject_id), t1.author_id as c1 from courses as t0 join course_authors_and_tutors as t1 on t0.author_id = t1.author_id where t1.family_name like '%r' or t1.family_name = 'Armstrong' group by c1 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": "e_learning", "sql": "select count(distinct (t0.author_id)), sum(t0.subject_id), t1.author_id as c1 from courses as t0 join course_authors_and_tutors as t1 on t0.author_id = t1.author_id where t1.family_name like '%r' or t1.family_name = 'Armstrong' group by c1 order by c1 desc li...
{ "index": 966, "split": "train" }
What is the average dorm ID for student 1017's stays in dorms with IDs up to 140, considering the highest such average among those options?
dorm_1
select avg(dormid) as c0 from lives_in where stuid = 1017 and dormid <= 140 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": "dorm_1", "sql": "select avg(dormid) as c0 from lives_in where stuid = 1017 and dormid <= 140 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 839, "split": "train" }
What are the average song rating and average resolution for songs belonging to the genres 'tagore' or 'folk', and what is the genre name for each group?
music_1
select avg(t0.rating), avg(t0.resolution), t1.g_name as c2 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where c2 = 'tagore' or c2 = 'folk' 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": "music_1", "sql": "select avg(t0.rating), avg(t0.resolution), t1.g_name as c2 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where c2 = 'tagore' or c2 = 'folk' group by c2" }, "style": "rule" }
{ "index": 2677, "split": "train" }
Does the percent change in customer 5's minimum customer ID on March 27, 2015, for properties with ID 107 or higher, exceed the average percent change of the minimum customer IDs for all customers who moved in on that date?
local_govt_and_lot
select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c3 from (select min(t1.customer_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 5 and t1.date_moved_in = '2015-03-27 12:00:00' and t1.property_id >= 107 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.c3 from (select min(t1.customer_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 5 and t1.date_moved_in = '2015-03-27 12:00:00'...
{ "index": 3444, "split": "train" }
In which years and for which artists did exhibitions overlap with the least frequently occurring artist associated with artist ID 2?
theme_gallery
select anon_1.c2, anon_1.c1 from (select year as c2, artist_id as c1 from exhibition intersect select t0.year as c2, t0.artist_id as c1 from exhibition as t0 join artist as t1 on t0.artist_id = t1.artist_id, (select artist_id as c0 from artist where c0 = 2 group by c0 order by count(*) asc nulls last limit 1) as t0 whe...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "theme_gallery", "sql": "select anon_1.c2, anon_1.c1 from (select year as c2, artist_id as c1 from exhibition intersect select t0.year as c2, t0.artist_id as c1 from exhibition as t0 join artist as t1 on t0.artist_id = t1.artist_id, (select artist_id as c0 from artist where c0 = 2...
{ "index": 1091, "split": "train" }
Can you find the title and ID of the album that has tracks in genre 1, composed by Mike Bordin, Billy Gould, and Mike Patton, and has the lowest artist ID among such albums?
store_1
select t0.title, t0.id from albums as t0 join tracks as t1 on t0.id = t1.album_id where t1.genre_id = 1 and t1.composer = 'Mike Bordin, Billy Gould, Mike Patton' order by t0.artist_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": "store_1", "sql": "select t0.title, t0.id from albums as t0 join tracks as t1 on t0.id = t1.album_id where t1.genre_id = 1 and t1.composer = 'Mike Bordin, Billy Gould, Mike Patton' order by t0.artist_id asc nulls last limit 1" }, "style": "rule" }
{ "index": 1349, "split": "train" }
Is the author ID of the course with ID 1 greater than the smallest author ID among courses whose names end with "ench"?
e_learning
select t2.c3 > t1.c1 from (select author_id as c3 from courses where course_id = 1) as t2, (select min(author_id) as c1 from courses where course_name like '%ench') as t1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t2.c3 > t1.c1 from (select author_id as c3 from courses where course_id = 1) as t2, (select min(author_id) as c1 from courses where course_name like '%ench') as t1" }, "style": "rule" }
{ "index": 3274, "split": "train" }
What is the ID and amount of the financial transaction with the smallest transaction amount?
customers_and_invoices
select transaction_id, transaction_amount as c1 from financial_transactions 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": "customers_and_invoices", "sql": "select transaction_id, transaction_amount as c1 from financial_transactions order by c1 asc nulls last limit 1" }, "style": "rule" }
{ "index": 338, "split": "train" }
What are the total sums of the Catalog Contents Additional Attributes' catalog level number and attribute ID for catalog entries at the top level (level 1)?
product_catalog
select sum(t0.catalog_level_number), sum(t0.attribute_id) from catalog_contents_additional_attributes as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_level_number = 1 group by t1.catalog_level_number order by t1.catalog_level_number 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": "product_catalog", "sql": "select sum(t0.catalog_level_number), sum(t0.attribute_id) from catalog_contents_additional_attributes as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_level_number = 1 group by t1.catalog_level_numb...
{ "index": 79, "split": "train" }
For each product with an ID greater than 6, what are the product names and product IDs that have reported five or fewer problems?
tracking_software_problems
select t0.product_name, t0.product_id as c1 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t1.product_id > 6 group by c1 having count(*) <= 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t0.product_name, t0.product_id as c1 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t1.product_id > 6 group by c1 having count(*) <= 5" }, "style": "rule" }
{ "index": 2783, "split": "train" }
Which building, founded after 1881, has the highest number of associated institutions, and what are its name, height in feet, and building ID?
protein_institute
select t0.name, t0.height_feet, t0.building_id as c1 from building as t0 join institution as t1 on t0.building_id = t1.building_id where t1.founded > 1881.0 group by c1 order by count(*) 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": "protein_institute", "sql": "select t0.name, t0.height_feet, t0.building_id as c1 from building as t0 join institution as t1 on t0.building_id = t1.building_id where t1.founded > 1881.0 group by c1 order by count(*) desc limit 1" }, "style": "rule" }
{ "index": 342, "split": "train" }
What are the different location codes recorded for the timed locations of things?
local_govt_and_lot
select distinct location_code from timed_locations_of_things
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct location_code from timed_locations_of_things" }, "style": "rule" }
{ "index": 867, "split": "train" }
What are the first five registration IDs of student tests taken on or before the evening of March 25, 2018, ordered by registration ID?
e_learning
select registration_id as c0 from student_tests_taken where date_test_taken = '2018-03-25 16:59:22' or date_test_taken <= '2018-03-25 03:27:16' 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": "e_learning", "sql": "select registration_id as c0 from student_tests_taken where date_test_taken = '2018-03-25 16:59:22' or date_test_taken <= '2018-03-25 03:27:16' order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 1925, "split": "train" }
Which functional areas are not associated with any documents that have a structure code ending in "6"?
document_management
select anon_1.c0, anon_1.c1 from (select functional_area_description as c0, functional_area_code as c1 from functional_areas except select t0.functional_area_description as c0, t0.functional_area_code as c1 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c1 from (select functional_area_description as c0, functional_area_code as c1 from functional_areas except select t0.functional_area_description as c0, t0.functional_area_code as c1 from functional_areas as t0 join document_f...
{ "index": 1794, "split": "train" }
> For documents that have a location end date exactly on June 15, 1976, at 03:40:06, but do not have an end date between March 10, 1997, and June 8, 2008, what are their stored dates and names?
cre_Doc_Tracking_DB
select anon_1.c1, anon_1.c0 from (select t0.date_stored as c1, t0.document_name as c0 from all_documents as t0 join document_locations as t1 on t0.document_id = t1.document_id where t1.date_in_locaton_to = '1976-06-15 03:40:06' except select t0.date_stored as c1, t0.document_name as c0 from all_documents as t0 join doc...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.date_stored as c1, t0.document_name as c0 from all_documents as t0 join document_locations as t1 on t0.document_id = t1.document_id where t1.date_in_locaton_to = '1976-06-15 03:40:06' except select t0.date_...
{ "index": 1025, "split": "train" }
How many customer cards have a validity end date of March 11, 2018, at 1:12 AM?
customers_card_transactions
select count(*) from customers_cards where date_valid_to = '2018-03-11 01:12:33'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select count(*) from customers_cards where date_valid_to = '2018-03-11 01:12:33'" }, "style": "rule" }
{ "index": 1871, "split": "train" }
Which skills are associated with fault parts that have a fault status containing the letter "t" or ending with "ng"? List the skill description, skill ID, and the asset IDs linked to those fault parts.
assets_maintenance
select t0.skill_description, t0.skill_id, t4.asset_id from skills as t0 join engineer_skills as t1 on t0.skill_id = t1.skill_id join maintenance_engineers as t2 on t1.engineer_id = t2.engineer_id join engineer_visits as t3 on t2.engineer_id = t3.engineer_id join fault_log as t4 on t3.fault_log_entry_id = t4.fault_log_e...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.skill_description, t0.skill_id, t4.asset_id from skills as t0 join engineer_skills as t1 on t0.skill_id = t1.skill_id join maintenance_engineers as t2 on t1.engineer_id = t2.engineer_id join engineer_visits as t3 on t2.engineer_id = t3.engin...
{ "index": 2952, "split": "train" }
Can you tell me the top three parties' lieutenant governors, election years, and comptrollers for county number 2, sorted by the highest comptroller values?
election
select t0.lieutenant_governor, t0.year, t0.comptroller as c2 from party as t0 join election as t1 on t0.party_id = t1.party join county as t2 on t1.district = t2.county_id where t2.county_id = 2 order by c2 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "election", "sql": "select t0.lieutenant_governor, t0.year, t0.comptroller as c2 from party as t0 join election as t1 on t0.party_id = t1.party join county as t2 on t1.district = t2.county_id where t2.county_id = 2 order by c2 desc limit 3" }, "style": "rule" }
{ "index": 1919, "split": "train" }
What are the staff IDs and dates of birth for staff members who live at addresses that belong to customers who became customers before November 16, 2015?
driving_school
select t0.staff_id, t0.date_of_birth from staff as t0 join addresses as t1 on t0.staff_address_id = t1.address_id join customers as t2 on t1.address_id = t2.customer_address_id where t2.date_became_customer < '2015-11-16 22:52:14'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select t0.staff_id, t0.date_of_birth from staff as t0 join addresses as t1 on t0.staff_address_id = t1.address_id join customers as t2 on t1.address_id = t2.customer_address_id where t2.date_became_customer < '2015-11-16 22:52:14'" }, "style": "rule" ...
{ "index": 2807, "split": "train" }
What is the percentage change in the highest number of students who completed their courses between March 1 and March 10, 2018, based on the number of students who took tests on the two specific dates in late March 2018?
e_learning
select (max(t0.c2) / cast(max(t1.c2) as real) - 1) * 100 from (select count(distinct (t1.registration_id)) as c2 from student_course_enrolment as t0 join student_tests_taken as t1 on t0.registration_id = t1.registration_id where t1.date_test_taken = '2018-03-25 03:27:16' and t0.date_of_completion between '2018-03-01 00...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (max(t0.c2) / cast(max(t1.c2) as real) - 1) * 100 from (select count(distinct (t1.registration_id)) as c2 from student_course_enrolment as t0 join student_tests_taken as t1 on t0.registration_id = t1.registration_id where t1.date_test_taken = '2018-03-...
{ "index": 3032, "split": "train" }
What is the lowest Track ID in playlist number 10?
store_1
select track_id as c0 from playlist_tracks where playlist_id = 10 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 track_id as c0 from playlist_tracks where playlist_id = 10 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 1987, "split": "train" }
Can you provide the last names, first names, and classrooms of students who are listed in the student list but are not listed among the 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 except 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 except select lastname, firstname, classroom from teachers) as anon_1" }, "style": "rule" }
{ "index": 2400, "split": "train" }
What are the names and IDs of each genre, and how many tracks with media types 2 and 3 are in each genre?
store_1
select t0.name, t0.id as c0, count(t1.unit_price) from genres as t0 join tracks as t1 on t0.id = t1.genre_id where t1.media_type_id between 2 and 3 group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t0.name, t0.id as c0, count(t1.unit_price) from genres as t0 join tracks as t1 on t0.id = t1.genre_id where t1.media_type_id between 2 and 3 group by c0" }, "style": "rule" }
{ "index": 1361, "split": "train" }
What are the maximum salary, job title, and hire date of the employee in departments with managers ID greater than or equal to 103, who was hired most recently?
hr_1
select t0.max_salary, t0.job_title, t1.hire_date as c0 from jobs as t0 join employees as t1 on t0.job_id = t1.job_id join departments as t2 on t1.department_id = t2.department_id where t2.manager_id >= 103 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": "hr_1", "sql": "select t0.max_salary, t0.job_title, t1.hire_date as c0 from jobs as t0 join employees as t1 on t0.job_id = t1.job_id join departments as t2 on t1.department_id = t2.department_id where t2.manager_id >= 103 order by c0 asc nulls last limit 1" }, "style": "rule" ...
{ "index": 559, "split": "train" }
What are the highest invoice line track IDs for the most recent albums with IDs 331 or higher? List the top 5 maximum track IDs for each such album, sorted by album ID from newest to oldest.
store_1
select max(t0.track_id) from invoice_lines as t0 join tracks as t1 on t0.track_id = t1.id where t1.album_id >= 331 group by t1.id order by t1.id desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select max(t0.track_id) from invoice_lines as t0 join tracks as t1 on t0.track_id = t1.id where t1.album_id >= 331 group by t1.id order by t1.id desc limit 5" }, "style": "rule" }
{ "index": 300, "split": "train" }
Which creation date corresponds to the tweet(s) made by the user with the highest user ID among those who posted after March 9, 2018, at 8:01:02 PM?
twitter_1
select t0.createdate, t0.uid as c2 from tweets as t0, (select max(uid) as c3 from tweets where createdate > '2018-03-09 20:01:02') as t1 where c2 = t1.c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "twitter_1", "sql": "select t0.createdate, t0.uid as c2 from tweets as t0, (select max(uid) as c3 from tweets where createdate > '2018-03-09 20:01:02') as t1 where c2 = t1.c3" }, "style": "rule" }
{ "index": 3960, "split": "train" }
For staff members whose nicknames include 'senger', how many days are there between their date of birth and the date they left the staff position?
driving_school
select julianday(t1.c0) - julianday(t0.c3) from (select date_of_birth as c0 from staff) as t1, (select date_left_staff as c3 from staff where nickname like '%senger' and nickname like '%senger') 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_of_birth as c0 from staff) as t1, (select date_left_staff as c3 from staff where nickname like '%senger' and nickname like '%senger') as t0" }, "style": "rule" }
{ "index": 3704, "split": "train" }
Which three first names have the fewest employees, and for each of those names, how many employees share that name and how many unique addresses are associated with that name? List these first names along with their employee counts and unique address counts, sorted by the smallest number of employees.
company_1
select fname as c1, count(fname), count(distinct (address)) from employee group by c1 order by count(*) 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": "company_1", "sql": "select fname as c1, count(fname), count(distinct (address)) from employee group by c1 order by count(*) asc nulls last limit 3" }, "style": "rule" }
{ "index": 684, "split": "train" }
Can you provide the ROM size in MiB, Wi-Fi capabilities, and screen mode details for phones that have display configurations starting with "Graphi", sorted by ROM size from largest to smallest?
phone_1
select t0.rom_mib as c1, t0.wifi, t1.screen_mode 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 where t2.type like 'Graphi%' order by c1 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "phone_1", "sql": "select t0.rom_mib as c1, t0.wifi, t1.screen_mode 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 where t2.type like 'Graphi%' order by c1 desc" }, "style": "rule" }
{ "index": 1061, "split": "train" }
Which political parties are listed either in the election records or in the party directory?
election
select anon_1.c0 from (select party as c0 from election union select party from party) 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": "election", "sql": "select anon_1.c0 from (select party as c0 from election union select party from party) as anon_1" }, "style": "rule" }
{ "index": 724, "split": "train" }