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
Can you tell me what are the top 10 Dormid, Has Amenity Amenid, and Dorm Amenity Amenid with amenid equal to 904 or amenid equal to 904 sorted by amenid?
dorm_1
select t0.dormid, t0.amenid, t1.amenid as c0 from has_amenity as t0 join dorm_amenity as t1 on t0.amenid = t1.amenid where c0 = 904 or c0 = 904 order by c0 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select t0.dormid, t0.amenid, t1.amenid as c0 from has_amenity as t0 join dorm_amenity as t1 on t0.amenid = t1.amenid where c0 = 904 or c0 = 904 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 1955, "split": "train" }
What are the titles of songs and their artist names for artists whose names end with "pu"?
music_1
select t0.song_name, t0.artist_name from song as t0 join files as t1 on t0.f_id = t1.f_id where t1.artist_name like '%pu'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.song_name, t0.artist_name from song as t0 join files as t1 on t0.f_id = t1.f_id where t1.artist_name like '%pu'" }, "style": "rule" }
{ "index": 261, "split": "train" }
Who are the ten tallest people whose dates of birth include a "0," and what are their names?
entrepreneur
select name from people where date_of_birth like '%0%' order by height 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": "entrepreneur", "sql": "select name from people where date_of_birth like '%0%' order by height desc limit 10" }, "style": "rule" }
{ "index": 2816, "split": "train" }
List the premise IDs and address type codes for customer addresses, along with the premise IDs, where the premise details include "a Glen Apt. 430" or start with "33294 William".
customers_campaigns_ecommerce
select t0.premise_id, t0.address_type_code, t1.premise_id from customer_addresses as t0 join premises as t1 on t0.premise_id = t1.premise_id where t1.premise_details like '%a Glen Apt. 430' or t1.premise_details like '33294 William %'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_campaigns_ecommerce", "sql": "select t0.premise_id, t0.address_type_code, t1.premise_id from customer_addresses as t0 join premises as t1 on t0.premise_id = t1.premise_id where t1.premise_details like '%a Glen Apt. 430' or t1.premise_details like '33294 William %'" },...
{ "index": 1755, "split": "train" }
Among customers ranked by the number of their savings accounts from most to least, what is the position of the customer who is 6th in this ranking?
small_bank_1
select t1.c4, t1.c0 as c5 from (select row_number() over (order by t0.c2 desc) as c4, t0.c3 as c0 from (select t0.custid as c3, count(distinct (t1.custid)) as c2 from accounts as t0 join savings as t1 on t0.custid = t1.custid group by c3) as t0) as t1 where c5 = 6
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select t1.c4, t1.c0 as c5 from (select row_number() over (order by t0.c2 desc) as c4, t0.c3 as c0 from (select t0.custid as c3, count(distinct (t1.custid)) as c2 from accounts as t0 join savings as t1 on t0.custid = t1.custid group by c3) as t0) as t1 where...
{ "index": 3501, "split": "train" }
Did the organization with ID 4 have a formation date earlier than its own formation date?
e_government
select date_formed < date_formed from organizations where organization_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": "e_government", "sql": "select date_formed < date_formed from organizations where organization_id = 4" }, "style": "rule" }
{ "index": 3132, "split": "train" }
What is the percentage change in the maximum customer ID for customer 79 with properties up to ID 629 on the date they moved in, which was March 27, 2015?
local_govt_and_lot
select (t0.c2 / cast(t0.c2 as real) - 1) * 100 from (select max(t1.customer_id) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 79 and t1.date_moved_in = '2015-03-27 12:00:00' and t1.property_id <= 629 group by t0.customer_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select (t0.c2 / cast(t0.c2 as real) - 1) * 100 from (select max(t1.customer_id) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 79 and t1.date_moved_in = '2015-03-27 12:00:00' and t1.prop...
{ "index": 3829, "split": "train" }
Can you list all invoices with IDs of 53 or higher, showing their total amounts and invoice IDs, sorted from the highest to the lowest total?
store_1
select t0.total as c0 from invoices as t0 join invoice_lines as t1 on t0.id = t1.invoice_id where t1.invoice_id >= 53 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": "store_1", "sql": "select t0.total as c0 from invoices as t0 join invoice_lines as t1 on t0.id = t1.invoice_id where t1.invoice_id >= 53 order by c0 desc" }, "style": "rule" }
{ "index": 217, "split": "train" }
Can you show me the date, venue, and workshop ID for the first five workshops where the submissions have scores either below 82 or at least 82, ordered by the workshop ID?
workshop_paper
select t0.date, t0.venue, t1.workshop_id as c1 from workshop as t0 join acceptance as t1 on t0.workshop_id = t1.workshop_id join submission as t2 on t1.submission_id = t2.submission_id where t2.scores < 82.0 or t2.scores >= 82.0 order by c1 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "workshop_paper", "sql": "select t0.date, t0.venue, t1.workshop_id as c1 from workshop as t0 join acceptance as t1 on t0.workshop_id = t1.workshop_id join submission as t2 on t1.submission_id = t2.submission_id where t2.scores < 82.0 or t2.scores >= 82.0 order by c1 asc nulls last...
{ "index": 1612, "split": "train" }
Among players whose average high school scores are between 300 and 1200, which player comes first alphabetically and what is their average high school score?
soccer_2
select pname as c1, avg(hs) from player group by c1 having avg(hs) between 300 and 1200 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": "soccer_2", "sql": "select pname as c1, avg(hs) from player group by c1 having avg(hs) between 300 and 1200 order by c1 asc nulls last limit 1" }, "style": "rule" }
{ "index": 2642, "split": "train" }
Can you tell me the product category code, unit of measure, and description for categories that include products which are either purple or red in color?
products_gen_characteristics
select t0.product_category_code, t0.unit_of_measure, t0.product_category_description from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code join ref_colors as t2 on t1.color_code = t2.color_code where t2.color_description = 'purple' or t2.color_description = 'red'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select t0.product_category_code, t0.unit_of_measure, t0.product_category_description from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code join ref_colors as t2 on t1.color_code = t2.col...
{ "index": 675, "split": "train" }
What are the points and constructor IDs for all constructors in the standings, including the data for the constructor with ID 152?
formula_1
select anon_1.c0, anon_1.c1 from (select points as c0, constructorid as c1 from constructorstandings union select t0.points as c0, t0.constructorid as c1 from constructorstandings as t0 join constructors as t1 on t0.constructorid = t1.constructorid where t1.constructorid = 152) 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": "formula_1", "sql": "select anon_1.c0, anon_1.c1 from (select points as c0, constructorid as c1 from constructorstandings union select t0.points as c0, t0.constructorid as c1 from constructorstandings as t0 join constructors as t1 on t0.constructorid = t1.constructorid where t1.co...
{ "index": 1493, "split": "train" }
What are the first three years of book clubs associated with companies incorporated in Hong Kong, sorted by their category with null categories listed last?
culture_company
select t0.year from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where t1.incorporated_in like 'Hong Kong%' order by t0.category asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "culture_company", "sql": "select t0.year from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where t1.incorporated_in like 'Hong Kong%' order by t0.category asc nulls last limit 3" }, "style": "rule" }
{ "index": 189, "split": "train" }
When did the customer with the highest customer ID place their order?
tracking_orders
select t0.date_order_placed, t0.customer_id as c0 from orders as t0, (select max(customer_id) as c3 from orders) as t1 where c0 = t1.c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.date_order_placed, t0.customer_id as c0 from orders as t0, (select max(customer_id) as c3 from orders) as t1 where c0 = t1.c3" }, "style": "rule" }
{ "index": 3801, "split": "train" }
When did the customer who made booking number 8 have their booking start?
products_for_hire
select t0.booking_start_date, t0.customer_id as c2 from bookings as t0, (select max(customer_id) as c3 from bookings where booking_id = 8) 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": "products_for_hire", "sql": "select t0.booking_start_date, t0.customer_id as c2 from bookings as t0, (select max(customer_id) as c3 from bookings where booking_id = 8) as t1 where c2 = t1.c3" }, "style": "rule" }
{ "index": 3789, "split": "train" }
What are the party IDs, associated form IDs, and service IDs for the first three parties linked to services named Welfare or containing "Heal", sorted by party ID?
e_government
select t0.party_id as c1, t0.form_id, t2.service_id from party_forms as t0 join parties as t1 on t0.party_id = t1.party_id join party_services as t2 on t1.party_id = t2.customer_id join services as t3 on t2.service_id = t3.service_id where t3.service_name = 'Welfare' or t3.service_name like '%Heal%' order by c1 asc nul...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_government", "sql": "select t0.party_id as c1, t0.form_id, t2.service_id from party_forms as t0 join parties as t1 on t0.party_id = t1.party_id join party_services as t2 on t1.party_id = t2.customer_id join services as t3 on t2.service_id = t3.service_id where t3.service_name =...
{ "index": 2672, "split": "train" }
How much did the highest project ID associated with leaders change between October 21, 1999, and November 1, 2004?
tracking_grants_for_research
select t1.c2 - t0.c2 from (select max(t1.project_id) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'leader' and t1.date_from = '1999-10-21 22:07:15' group by t0.role_code) as t1, (select t0.role_code, max(t1.project_id) as c2 from staff_roles as t0 join projec...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t1.c2 - t0.c2 from (select max(t1.project_id) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'leader' and t1.date_from = '1999-10-21 22:07:15' group by t0.role_code) as t1, (s...
{ "index": 3527, "split": "train" }
What are the apartment number, apartment ID, bedroom count, and booking’s apartment ID for the last three apartments booked by guests born on November 2nd, 1971, or earlier than August 26th, 1983, sorted by apartment ID?
apartment_rentals
select t0.apt_number, t0.apt_id, t0.bedroom_count, t1.apt_id as c1 from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.date_of_birth = '1971-11-02 01:51:56' or t2.date_of_birth < '1983-08-26 15:45:08' order by c1 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": "apartment_rentals", "sql": "select t0.apt_number, t0.apt_id, t0.bedroom_count, t1.apt_id as c1 from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.date_of_birth = '1971-11-02 01:51:56' or t2.date_of_...
{ "index": 1771, "split": "train" }
Which store IDs and district IDs are associated with stores that sell products having a maximum page size ending with "A4"?
store_product
select t0.store_id, t0.district_id from store_district as t0 join store as t1 on t0.store_id = t1.store_id join store_product as t2 on t1.store_id = t2.store_id join product as t3 on t2.product_id = t3.product_id where t3.max_page_size like '%A4'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select t0.store_id, t0.district_id from store_district as t0 join store as t1 on t0.store_id = t1.store_id join store_product as t2 on t1.store_id = t2.store_id join product as t3 on t2.product_id = t3.product_id where t3.max_page_size like '%A4'" }, "...
{ "index": 2464, "split": "train" }
What is the average Lot ID, along with the Investor ID and Lot ID, for each lot involved in transactions with ID 10 or 12?
tracking_share_transactions
select avg(t0.lot_id), t1.investor_id, t1.lot_id as c0 from transactions_lots as t0 join lots as t1 on t0.lot_id = t1.lot_id where c0 in (select t0.lot_id as c2 from transactions_lots where t0.transaction_id = 10 or t0.transaction_id = 12) group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select avg(t0.lot_id), t1.investor_id, t1.lot_id as c0 from transactions_lots as t0 join lots as t1 on t0.lot_id = t1.lot_id where c0 in (select t0.lot_id as c2 from transactions_lots where t0.transaction_id = 10 or t0.transaction_id = 12) gr...
{ "index": 1519, "split": "train" }
For each of the top five poll sources in the Candidate Poll database, what are the lowest Consider Rate, highest Support Rate, and the total number of people surveyed, sorted alphabetically by poll source?
candidate_poll
select poll_source as c0, min(consider_rate), max(support_rate), sum(people_id) from candidate group by c0 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": "candidate_poll", "sql": "select poll_source as c0, min(consider_rate), max(support_rate), sum(people_id) from candidate group by c0 order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 1634, "split": "train" }
What is the ranking of the Statistics department based on the average credits of its courses, when departments are ordered from highest to lowest average credits?
college_2
select t1.c1, t1.c4 as c3 from (select row_number() over (order by t0.c0 desc) as c1, t0.c5 as c4 from (select t0.dept_name as c5, avg(t1.credits) as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name group by c5) as t0) as t1 where c3 = 'Statistics'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_2", "sql": "select t1.c1, t1.c4 as c3 from (select row_number() over (order by t0.c0 desc) as c1, t0.c5 as c4 from (select t0.dept_name as c5, avg(t1.credits) as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name group by c5) as t0) as t1 where c3 =...
{ "index": 3466, "split": "train" }
What is the smallest checking account balance for the customer whose ID is 7 and whose name starts with "W"?
small_bank_1
select min(t0.balance), t1.custid as c1 from checking as t0 join accounts as t1 on t0.custid = t1.custid where c1 = 7 and t1.name like 'W%' group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select min(t0.balance), t1.custid as c1 from checking as t0 join accounts as t1 on t0.custid = t1.custid where c1 = 7 and t1.name like 'W%' group by c1" }, "style": "rule" }
{ "index": 472, "split": "train" }
Which are the details and IDs of the first five visitors (when ordered by visitor ID) who visited attractions staffed by Aurore?
cre_Theme_park
select t0.tourist_details, t0.tourist_id as c0 from visitors as t0 join visits as t1 on t0.tourist_id = t1.tourist_id join tourist_attractions as t2 on t1.tourist_attraction_id = t2.tourist_attraction_id join staff as t3 on t2.tourist_attraction_id = t3.tourist_attraction_id where t3.name = 'Aurore' order by c0 asc nul...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Theme_park", "sql": "select t0.tourist_details, t0.tourist_id as c0 from visitors as t0 join visits as t1 on t0.tourist_id = t1.tourist_id join tourist_attractions as t2 on t1.tourist_attraction_id = t2.tourist_attraction_id join staff as t3 on t2.tourist_attraction_id = t3.t...
{ "index": 1354, "split": "train" }
What is the total number of attribute definitions in the catalog?
product_catalog
select count(*) from attribute_definitions
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(*) from attribute_definitions" }, "style": "rule" }
{ "index": 267, "split": "train" }
What is the shortest height recorded for each person's name in the database?
perpetrator
select name as c1, min(height) from people 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": "perpetrator", "sql": "select name as c1, min(height) from people group by c1" }, "style": "rule" }
{ "index": 1164, "split": "train" }
What are the studio, director, and film ID of films that are associated with the most frequently occurring market, and that are located in markets with more cities than the total number of unique city counts across all markets?
film_rank
select t0.studio, t0.director, t0.film_id as c1 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id join market as t2 on t1.market_id = t2.market_id, (select market_id as c4 from market group by c4 order by count(*) desc limit 1) as t1, (select count(distinct (number_cities)) as c3 from market)...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "film_rank", "sql": "select t0.studio, t0.director, t0.film_id as c1 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id join market as t2 on t1.market_id = t2.market_id, (select market_id as c4 from market group by c4 order by count(*) desc limit 1) as t1...
{ "index": 2965, "split": "train" }
Which customers have never ordered a product with a name containing the letter "k"?
tracking_orders
select anon_1.c2, anon_1.c0, anon_1.c1 from (select customer_id as c2, customer_name as c0, customer_details as c1 from customers except select t0.customer_id as c2, t0.customer_name as c0, t0.customer_details as c1 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.o...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select anon_1.c2, anon_1.c0, anon_1.c1 from (select customer_id as c2, customer_name as c0, customer_details as c1 from customers except select t0.customer_id as c2, t0.customer_name as c0, t0.customer_details as c1 from customers as t0 join orders as t1...
{ "index": 278, "split": "train" }
What are the assets in billions and the company ID for company number 4, provided that it has fewer than five office locations?
company_office
select t0.assets_billion, t0.id as c0 from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.company_id = 4 group by c0 having count(*) < 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select t0.assets_billion, t0.id as c0 from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.company_id = 4 group by c0 having count(*) < 5" }, "style": "rule" }
{ "index": 2828, "split": "train" }
What is the percentage change in the number of unique inventory items rented between July 9, 2005, at noon, and August 2, 2005, in the Sakila 1 database?
sakila_1
select (count(distinct (t0.c2)) / cast(count(distinct (t1.c2)) as real) - 1) * 100 from (select sum(t1.inventory_id) as c2 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t1.rental_date = '2005-08-02 08:49:09' group by t0.inventory_id) as t0, (select t0.inventory_id, sum(t1.inventory_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": "sakila_1", "sql": "select (count(distinct (t0.c2)) / cast(count(distinct (t1.c2)) as real) - 1) * 100 from (select sum(t1.inventory_id) as c2 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t1.rental_date = '2005-08-02 08:49:09' group by t0.inven...
{ "index": 3046, "split": "train" }
What is the name of the category with category ID 4?
sakila_1
select distinct t0.name from category as t0 join film_category as t1 on t0.category_id = t1.category_id where t1.category_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": "sakila_1", "sql": "select distinct t0.name from category as t0 join film_category as t1 on t0.category_id = t1.category_id where t1.category_id = 4" }, "style": "rule" }
{ "index": 1792, "split": "train" }
For players whose names end with "ndrew" and who have between 300 and 1200 high school scores in total, what are the five players with the fewest total scores, listed in reverse alphabetical order by their names?
soccer_2
select pname as c1, count(hs) from player where hs between 300 and 1200 and c1 like '%ndrew' group by c1 having count(hs) <= 300 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": "soccer_2", "sql": "select pname as c1, count(hs) from player where hs between 300 and 1200 and c1 like '%ndrew' group by c1 having count(hs) <= 300 order by c1 desc limit 5" }, "style": "rule" }
{ "index": 2897, "split": "train" }
Show the unique combinations of venues, debate IDs, and audience sizes for each debate.
debate
select distinct venue, debate_id, num_of_audience from debate
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "debate", "sql": "select distinct venue, debate_id, num_of_audience from debate" }, "style": "rule" }
{ "index": 2374, "split": "train" }
List the first five follow relationships and user emails for users with UID greater than 5 who have posted tweets, sorted by email in reverse alphabetical order.
twitter_1
select t0.f1, t0.f2, t1.email as c1 from follows as t0 join user_profiles as t1 on t0.f2 = t1.uid join tweets as t2 on t1.uid = t2.uid where t2.uid > 5 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": "twitter_1", "sql": "select t0.f1, t0.f2, t1.email as c1 from follows as t0 join user_profiles as t1 on t0.f2 = t1.uid join tweets as t2 on t1.uid = t2.uid where t2.uid > 5 order by c1 desc limit 5" }, "style": "rule" }
{ "index": 752, "split": "train" }
What are the top 10 farms with the most total horses, and what is the smallest number of working horses among them?
farm
select sum(total_horses) as c1, min(working_horses) from farm 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": "farm", "sql": "select sum(total_horses) as c1, min(working_horses) from farm order by c1 desc limit 10" }, "style": "rule" }
{ "index": 2220, "split": "train" }
For the video games that students have played for at least 50 hours, but excluding the game with ID 5, what are the game types, IDs, and names?
game_1
select anon_1.c1, anon_1.c2, anon_1.c0 from (select t0.gtype as c1, t0.gameid as c2, t0.gname as c0 from video_games as t0 join plays_games as t1 on t0.gameid = t1.gameid where t1.hours_played >= 50 except select t0.gtype as c1, t0.gameid as c2, t0.gname as c0 from video_games as t0 join plays_games as t1 on t0.gameid ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_1", "sql": "select anon_1.c1, anon_1.c2, anon_1.c0 from (select t0.gtype as c1, t0.gameid as c2, t0.gname as c0 from video_games as t0 join plays_games as t1 on t0.gameid = t1.gameid where t1.hours_played >= 50 except select t0.gtype as c1, t0.gameid as c2, t0.gname as c0 fr...
{ "index": 1669, "split": "train" }
Can you tell me the first language (alphabetically) of songs performed by artists whose gender starts with "Ma" or who belong to the most common gender in the database?
music_1
select t0.languages as c1 from song as t0 join artist as t1 on t0.artist_name = t1.artist_name, (select gender as c0 from artist group by c0 order by count(*) desc limit 1) as t0 where t1.gender like 'Ma%' or t1.gender = t0.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": "music_1", "sql": "select t0.languages as c1 from song as t0 join artist as t1 on t0.artist_name = t1.artist_name, (select gender as c0 from artist group by c0 order by count(*) desc limit 1) as t0 where t1.gender like 'Ma%' or t1.gender = t0.c0 order by c1 asc nulls last limit 1"...
{ "index": 861, "split": "train" }
What are the names of countries that are associated with leagues having IDs at least as high as the total number of leagues, and whose league names end with the letter "A"?
soccer_1
select t0.name from country as t0 join league as t1 on t0.id = t1.country_id, (select count(country_id) as c1 from league) as t0 where t1.country_id >= t0.c1 and t1.name like '%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": "soccer_1", "sql": "select t0.name from country as t0 join league as t1 on t0.id = t1.country_id, (select count(country_id) as c1 from league) as t0 where t1.country_id >= t0.c1 and t1.name like '%A'" }, "style": "rule" }
{ "index": 2735, "split": "train" }
Can you list the names of projects that start with "As" and have a maximum of 299 hours, showing only the top three projects sorted by their maximum hours?
scientist_1
select name as c0, max(hours) as c1 from projects where code like 'As%' group by c0 having max(hours) = 299 order by c1 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": "scientist_1", "sql": "select name as c0, max(hours) as c1 from projects where code like 'As%' group by c0 having max(hours) = 299 order by c1 asc nulls last limit 3" }, "style": "rule" }
{ "index": 2526, "split": "train" }
Can you tell me the top train (based on the highest number of services) that departs at 21:49 and has a name containing "urai Fast Pas"? For that train, I want to know its services count, the local authority handling the station, the network name, and the station and train IDs associated with its route, ordered from th...
station_weather
select t0.services as c3, t0.local_authority, t0.network_name, t1.station_id, t1.train_id from station as t0 join route as t1 on t0.id = t1.station_id join train as t2 on t1.train_id = t2.id where t2.time = '21:49' and t2.name like '%urai Fast Pas%' order by c3 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select t0.services as c3, t0.local_authority, t0.network_name, t1.station_id, t1.train_id from station as t0 join route as t1 on t0.id = t1.station_id join train as t2 on t1.train_id = t2.id where t2.time = '21:49' and t2.name like '%urai Fast Pas%' orde...
{ "index": 1069, "split": "train" }
Did the maintenance contract with ID 12 end later than the contract with ID 2?
assets_maintenance
select t1.c2 > t0.c2 from (select contract_end_date as c2 from maintenance_contracts where maintenance_contract_id = 12) as t1, (select contract_end_date as c2 from maintenance_contracts where maintenance_contract_id = 2) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t1.c2 > t0.c2 from (select contract_end_date as c2 from maintenance_contracts where maintenance_contract_id = 12) as t1, (select contract_end_date as c2 from maintenance_contracts where maintenance_contract_id = 2) as t0" }, "style": "rule"...
{ "index": 3068, "split": "train" }
At what date was the person with ID 8 at their tallest height?
entrepreneur
select t0.date_of_birth, t0.height as c3 from people as t0, (select max(height) as c2 from people where people_id = 8) as t1 where c3 = t1.c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "entrepreneur", "sql": "select t0.date_of_birth, t0.height as c3 from people as t0, (select max(height) as c2 from people where people_id = 8) as t1 where c3 = t1.c2" }, "style": "rule" }
{ "index": 3771, "split": "train" }
Which clubs have both a player named Terry Newton and players who have scored 8.0 points or more? Please provide their club IDs and names.
sports_competition
select anon_1.c1, anon_1.c0 from (select t0.club_id as c1, t0.name as c0 from club as t0 join player as t1 on t0.club_id = t1.club_id where t1.points >= 8.0 intersect select t0.club_id as c1, t0.name as c0 from club as t0 join player as t1 on t0.club_id = t1.club_id where t1.name = 'Terry Newton') 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": "sports_competition", "sql": "select anon_1.c1, anon_1.c0 from (select t0.club_id as c1, t0.name as c0 from club as t0 join player as t1 on t0.club_id = t1.club_id where t1.points >= 8.0 intersect select t0.club_id as c1, t0.name as c0 from club as t0 join player as t1 on t0.club_...
{ "index": 616, "split": "train" }
Does the minimum organization ID associated with organization 8 and thing types ending with 'cs' exceed the minimum organization ID associated with organization 7?
local_govt_and_lot
select t1.c2 > t0.c2 from (select min(t1.organization_id) as c2 from organizations as t0 join things as t1 on t0.organization_id = t1.organization_id where t0.organization_id = 8 and t1.type_of_thing_code like '%cs' group by t0.organization_id) as t1, (select t0.organization_id, min(t1.organization_id) as c2 from organ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t1.c2 > t0.c2 from (select min(t1.organization_id) as c2 from organizations as t0 join things as t1 on t0.organization_id = t1.organization_id where t0.organization_id = 8 and t1.type_of_thing_code like '%cs' group by t0.organization_id) as t1,...
{ "index": 3549, "split": "train" }
Which users have trust relationships where the target user ID is below the overall average target user ID, and what are their names and user IDs, considering only those with four or fewer trust relationships?
epinions_1
select t0.name, t0.u_id as c1 from useracct as t0 join trust as t1 on t0.u_id = t1.source_u_id, (select avg(target_u_id) as c2 from trust) as t0 where t1.target_u_id < t0.c2 group by c1 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": "epinions_1", "sql": "select t0.name, t0.u_id as c1 from useracct as t0 join trust as t1 on t0.u_id = t1.source_u_id, (select avg(target_u_id) as c2 from trust) as t0 where t1.target_u_id < t0.c2 group by c1 having count(*) <= 4" }, "style": "rule" }
{ "index": 2162, "split": "train" }
Which tourist attractions with directions starting with "wa" or photos with names containing "e2" have their names and descriptions?
cre_Theme_park
select anon_1.c3, anon_1.c0 from (select name as c3, description as c0 from tourist_attractions where how_to_get_there like 'wa%' union select name as c2, description from photos where c2 like '%e2%') 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": "cre_Theme_park", "sql": "select anon_1.c3, anon_1.c0 from (select name as c3, description as c0 from tourist_attractions where how_to_get_there like 'wa%' union select name as c2, description from photos where c2 like '%e2%') as anon_1" }, "style": "rule" }
{ "index": 2589, "split": "train" }
How many days long is each booking, measured from its start date to its end date?
products_for_hire
select julianday(t1.c1) - julianday(t0.c3) from (select booking_end_date as c1 from bookings) as t1, (select booking_start_date as c3 from bookings) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select julianday(t1.c1) - julianday(t0.c3) from (select booking_end_date as c1 from bookings) as t1, (select booking_start_date as c3 from bookings) as t0" }, "style": "rule" }
{ "index": 3932, "split": "train" }
What are the top 5 aircraft names that appear most frequently in the dataset, and how many unique entries does each have?
flight_1
select name as c1, count(distinct (name)) as c0 from aircraft group by c1 order by c0 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_1", "sql": "select name as c1, count(distinct (name)) as c0 from aircraft group by c1 order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2757, "split": "train" }
What are the Lot IDs and details of lots linked to purchases that have purchase details ending with "a", sorted by lot ID from the highest to the lowest?
tracking_share_transactions
select t0.lot_id as c0, t0.lot_details from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id join transactions as t2 on t1.transaction_id = t2.transaction_id join purchases as t3 on t2.transaction_id = t3.purchase_transaction_id where t3.purchase_details like '%a' 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": "tracking_share_transactions", "sql": "select t0.lot_id as c0, t0.lot_details from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id join transactions as t2 on t1.transaction_id = t2.transaction_id join purchases as t3 on t2.transaction_id = t3.purchase_transaction_...
{ "index": 1379, "split": "train" }
What is the school ID, team name, enrollment, and school name of the school with a nickname beginning with "Tig" that has the lowest school ID?
school_player
select t0.school_id as c1, t0.team, t1.enrollment, t1.school from player as t0 join school as t1 on t0.school_id = t1.school_id join school_details as t2 on t1.school_id = t2.school_id where t2.nickname like 'Tig%' 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": "school_player", "sql": "select t0.school_id as c1, t0.team, t1.enrollment, t1.school from player as t0 join school as t1 on t0.school_id = t1.school_id join school_details as t2 on t1.school_id = t2.school_id where t2.nickname like 'Tig%' order by c1 asc nulls last limit 1" }, ...
{ "index": 1184, "split": "train" }
Is the source airport ID for route 27194 smaller than the source airport ID for route 6485?
flight_4
select t1.c0 < t0.c0 from (select src_apid as c0 from routes where rid = 27194) as t1, (select src_apid as c0 from routes where rid = 6485) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t1.c0 < t0.c0 from (select src_apid as c0 from routes where rid = 27194) as t1, (select src_apid as c0 from routes where rid = 6485) as t0" }, "style": "rule" }
{ "index": 3567, "split": "train" }
What are the track IDs, listed from the most recently opened to the oldest, based on the latest year each track was opened?
race_track
select track_id as c0 from track group by c0 order by max(year_opened) 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": "race_track", "sql": "select track_id as c0 from track group by c0 order by max(year_opened) desc" }, "style": "rule" }
{ "index": 2059, "split": "train" }
Which three parts with fault short names starting with "P" have the highest number of unique fault reports? For each, list the chargeable amount, part id, and the count of distinct fault IDs.
assets_maintenance
select t0.chargeable_amount, t0.part_id as c2, count(distinct (t1.part_id)) as c1 from parts as t0 join part_faults as t1 on t0.part_id = t1.part_id where t1.fault_short_name like 'P%' group by c2 having count(*) >= 5 order by c1 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t0.chargeable_amount, t0.part_id as c2, count(distinct (t1.part_id)) as c1 from parts as t0 join part_faults as t1 on t0.part_id = t1.part_id where t1.fault_short_name like 'P%' group by c2 having count(*) >= 5 order by c1 desc limit 3" }, ...
{ "index": 2236, "split": "train" }
Which genres (by ID and name) are linked to tracks from the artist with the most albums?
store_1
select anon_1.c0, anon_1.c2 from (select id as c0, name as c2 from genres intersect select t0.id as c0, t0.name as c2 from genres as t0 join tracks as t1 on t0.id = t1.genre_id join albums as t2 on t1.album_id = t2.id join artists as t3 on t2.artist_id = t3.id, (select id as c1 from artists group by c1 order by count(*...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c2 from (select id as c0, name as c2 from genres intersect select t0.id as c0, t0.name as c2 from genres as t0 join tracks as t1 on t0.id = t1.genre_id join albums as t2 on t1.album_id = t2.id join artists as t3 on t2.artist_id = t3.id, ...
{ "index": 703, "split": "train" }
What are the different cities and occupations of people whose city names start with "salt"?
network_2
select distinct city as c1, job from person where c1 like 'salt%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct city as c1, job from person where c1 like 'salt%'" }, "style": "rule" }
{ "index": 661, "split": "train" }
Find the unique user IDs and their ratings where the rating is greater than 6 or at least 10.
epinions_1
select distinct t0.u_id, t1.rating as c0 from useracct as t0 join review as t1 on t0.u_id = t1.u_id where c0 > 6 or c0 >= 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": "epinions_1", "sql": "select distinct t0.u_id, t1.rating as c0 from useracct as t0 join review as t1 on t0.u_id = t1.u_id where c0 > 6 or c0 >= 10" }, "style": "rule" }
{ "index": 1632, "split": "train" }
Which company with gas stations located at places ending with "ll" has the highest station ID, and what is its rank, profits in billion dollars, and station ID?
gas_company
select t0.rank, t0.profits_billion, t1.station_id as c0 from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id where t2.location like '%ll' 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": "gas_company", "sql": "select t0.rank, t0.profits_billion, t1.station_id as c0 from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id where t2.location like '%ll' order by c0 desc limit 1" }, "styl...
{ "index": 1487, "split": "train" }
What are the different genders, ages, cities, and names of people who have friends whose names end with "an"?
network_2
select distinct t0.gender, t0.age, t0.city, t1.name from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.friend like '%an'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct t0.gender, t0.age, t0.city, t1.name from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.friend like '%an'" }, "style": "rule" }
{ "index": 521, "split": "train" }
How many days have passed between the date when a document moved into a location and the date it moved out from that location?
cre_Doc_Tracking_DB
select julianday(t1.c3) - julianday(t0.c0) from (select date_in_locaton_to as c3 from document_locations) as t1, (select date_in_location_from as c0 from document_locations) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Tracking_DB", "sql": "select julianday(t1.c3) - julianday(t0.c0) from (select date_in_locaton_to as c3 from document_locations) as t1, (select date_in_location_from as c0 from document_locations) as t0" }, "style": "rule" }
{ "index": 3679, "split": "train" }
Which customers and the dates their cards are valid from are associated with accounts that have details starting with 'Regula', and also with account number 9? Essentially, looking for customers who meet both these account conditions.
customers_card_transactions
select anon_1.c1, anon_1.c0 from (select t0.customer_id as c1, t0.date_valid_from as c0 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id join accounts as t2 on t1.account_id = t2.account_id where t2.other_account_details like 'Regula%' intersect select t0.customer_id as c1, t0.dat...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select anon_1.c1, anon_1.c0 from (select t0.customer_id as c1, t0.date_valid_from as c0 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id join accounts as t2 on t1.account_id = t2.account_id where t2.othe...
{ "index": 715, "split": "train" }
For maintenance engineers working with parts named 'package', what are their company IDs, engineer IDs, and the IDs of the 'package' parts used in assets supplied by those companies?
assets_maintenance
select t0.company_id, t0.engineer_id, t3.part_id from maintenance_engineers as t0 join third_party_companies as t1 on t0.company_id = t1.company_id join assets as t2 on t1.company_id = t2.supplier_company_id join asset_parts as t3 on t2.asset_id = t3.asset_id join parts as t4 on t3.part_id = t4.part_id where t4.part_na...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t0.company_id, t0.engineer_id, t3.part_id from maintenance_engineers as t0 join third_party_companies as t1 on t0.company_id = t1.company_id join assets as t2 on t1.company_id = t2.supplier_company_id join asset_parts as t3 on t2.asset_id = t3....
{ "index": 2796, "split": "train" }
List the names and nationalities of up to five pilots associated with aircraft ID 1, showing their details in reverse alphabetical order of their names.
pilot_record
select t0.pilot_name as c2, t0.nationality, t1.aircraft_id from pilot as t0 join pilot_record as t1 on t0.pilot_id = t1.pilot_id join aircraft as t2 on t1.aircraft_id = t2.aircraft_id where t2.aircraft_id = 1 order by c2 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": "pilot_record", "sql": "select t0.pilot_name as c2, t0.nationality, t1.aircraft_id from pilot as t0 join pilot_record as t1 on t0.pilot_id = t1.pilot_id join aircraft as t2 on t1.aircraft_id = t2.aircraft_id where t2.aircraft_id = 1 order by c2 desc limit 5" }, "style": "rule"...
{ "index": 2107, "split": "train" }
Which products with IDs 2 or higher have exactly or fewer than five reports of problem ID 10, and what are their names and IDs sorted by the highest product ID first?
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.problem_id = 10 and t1.product_id >= 2 group by c1 having count(*) <= 5 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": "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.problem_id = 10 and t1.product_id >= 2 group by c1 having count(*) <= 5 order by c1 desc" }, "style": "rule" }
{ "index": 2157, "split": "train" }
Is the most recent login date for student 10 earlier than the most recent login date for student 13?
e_learning
select t1.c2 < t0.c2 from (select date_of_latest_logon as c2 from students where student_id = 10) as t1, (select date_of_latest_logon as c2 from students where student_id = 13) 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": "e_learning", "sql": "select t1.c2 < t0.c2 from (select date_of_latest_logon as c2 from students where student_id = 10) as t1, (select date_of_latest_logon as c2 from students where student_id = 13) as t0" }, "style": "rule" }
{ "index": 3851, "split": "train" }
Which devices have stock quantities of 100 or fewer units, excluding the device with ID 6? What are their device IDs, models, and software platforms?
device
select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.device_id as c2, t0.device as c1, t0.software_platform as c0 from device as t0 join stock as t1 on t0.device_id = t1.device_id where t1.quantity <= 100 except select t0.device_id as c2, t0.device as c1, t0.software_platform as c0 from device as t0 join stock 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": "device", "sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.device_id as c2, t0.device as c1, t0.software_platform as c0 from device as t0 join stock as t1 on t0.device_id = t1.device_id where t1.quantity <= 100 except select t0.device_id as c2, t0.device as c1, t0.so...
{ "index": 1237, "split": "train" }
Which products, identified by their details and IDs, have been ordered by customers living in areas with zip codes starting with "7," but not by those whose state or county begins with "SouthCarol"?
customers_and_addresses
select anon_1.c0, anon_1.c1 from (select t0.product_details as c0, t0.product_id as c1 from products as t0 join order_items as t1 on t0.product_id = t1.product_id join customer_orders as t2 on t1.order_id = t2.order_id join customers as t3 on t2.customer_id = t3.customer_id join customer_addresses as t4 on t3.customer_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select anon_1.c0, anon_1.c1 from (select t0.product_details as c0, t0.product_id as c1 from products as t0 join order_items as t1 on t0.product_id = t1.product_id join customer_orders as t2 on t1.order_id = t2.order_id join customers as t3 on t2....
{ "index": 882, "split": "train" }
What is the percentage change in the lowest student ID associated with "NOISE" incidents from February 25, 2018, to March 13, 2018?
behavior_monitoring
select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select min(t1.student_id) as c1 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t0.incident_type_code = 'NOISE' and t1.date_incident_end = '2018-02-25 05:38:58' group by t0.incident_type_code) as t0, (s...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select min(t1.student_id) as c1 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t0.incident_type_code = 'NOISE' and t1.date_incident...
{ "index": 3408, "split": "train" }
How many match results awarded 5 gold medals?
riding_club
select count(*) from match_result where gold = 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": "riding_club", "sql": "select count(*) from match_result where gold = 5" }, "style": "rule" }
{ "index": 2898, "split": "train" }
focusing on the bottom five projects based on the average of task project IDs, filtering by project details, limiting the number of results, and specifying the sorting order. It maintains the technical details needed to recreate the SQL query but in a way that sounds more natural and accessible.
tracking_grants_for_research
select avg(t0.project_id) as c0, t1.project_id as c1 from tasks as t0 join projects as t1 on t0.project_id = t1.project_id where t1.project_details like '%nt%' group by c1 having count(*) < 4 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": "tracking_grants_for_research", "sql": "select avg(t0.project_id) as c0, t1.project_id as c1 from tasks as t0 join projects as t1 on t0.project_id = t1.project_id where t1.project_details like '%nt%' group by c1 having count(*) < 4 order by c0 asc nulls last limit 5" }, "style...
{ "index": 2826, "split": "train" }
What are the longitude, name, and station ID for the station with station ID 47?
bike_1
select t0.long, t0.name, t1.station_id as c0 from station as t0 join status as t1 on t0.id = t1.station_id where c0 = 47
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.long, t0.name, t1.station_id as c0 from station as t0 join status as t1 on t0.id = t1.station_id where c0 = 47" }, "style": "rule" }
{ "index": 2878, "split": "train" }
How many genders, ages, and names are there among people who are friends with someone whose name starts with "Bo," and what is the earliest year they became friends, sorted by the total number of genders in descending order?
network_2
select count(t0.gender) as c1, count(t0.age), count(t0.name), min(t1.year) from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like 'Bo%' 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": "network_2", "sql": "select count(t0.gender) as c1, count(t0.age), count(t0.name), min(t1.year) from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like 'Bo%' order by c1 desc" }, "style": "rule" }
{ "index": 1157, "split": "train" }
How many different source system codes are there in the CMI cross references?
local_govt_mdm
select count(distinct (source_system_code)) from cmi_cross_references
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_mdm", "sql": "select count(distinct (source_system_code)) from cmi_cross_references" }, "style": "rule" }
{ "index": 1170, "split": "train" }
Is the address ID for customer 7 lower than the address ID for customer 13?
customers_and_products_contacts
select t1.c0 < t0.c0 from (select address_id as c0 from customer_address_history where customer_id = 13) as t1, (select address_id as c0 from customer_address_history where customer_id = 7) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select t1.c0 < t0.c0 from (select address_id as c0 from customer_address_history where customer_id = 13) as t1, (select address_id as c0 from customer_address_history where customer_id = 7) as t0" }, "style": "rule" }
{ "index": 3563, "split": "train" }
Who are the top 10 individuals named Zach, including their job and age, ranked in reverse alphabetical order by their names?
network_2
select t0.name as c0, t0.job, t0.age from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name = 'Zach' order by c0 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select t0.name as c0, t0.job, t0.age from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name = 'Zach' order by c0 desc limit 10" }, "style": "rule" }
{ "index": 636, "split": "train" }
How many flights with specific distance conditions does each aircraft have, and which aircraft have two or fewer such flights? Specifically, count the flights for each aircraft where the aircraft's distance is either between 2128 and 7120 or where the aircraft's distance isn't listed among all flight distances.
flight_1
select count(t0.distance), t1.aid as c1 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.distance between 2128 and 7120 or (not t1.distance in (select t0.distance as c2 from flight)) group by c1 having count(*) <= 2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_1", "sql": "select count(t0.distance), t1.aid as c1 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.distance between 2128 and 7120 or (not t1.distance in (select t0.distance as c2 from flight)) group by c1 having count(*) <= 2" }, "style": "rule" }
{ "index": 1210, "split": "train" }
What is the difference in the total customer ID for customer 19 between the movement event on September 27, 2016, and itself?
local_govt_and_lot
select t0.c0 - t0.c0 from (select sum(t1.customer_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2016-09-27 12:00:00' group by t0.customer_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t0.c0 - t0.c0 from (select sum(t1.customer_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2016-09-27 12:00:00' group by t0.customer_id) as t0" }, ...
{ "index": 3525, "split": "train" }
Which drivers, based on their ages and IDs, have experience at a school bus for both less than 10 years and less than 6 years?
school_bus
select anon_1.c0, anon_1.c1 from (select t0.age as c0, t0.driver_id as c1 from driver as t0 join school_bus as t1 on t0.driver_id = t1.driver_id where t1.years_working <= 10 intersect select t0.age as c0, t0.driver_id as c1 from driver as t0 join school_bus as t1 on t0.driver_id = t1.driver_id where t1.years_working < ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "school_bus", "sql": "select anon_1.c0, anon_1.c1 from (select t0.age as c0, t0.driver_id as c1 from driver as t0 join school_bus as t1 on t0.driver_id = t1.driver_id where t1.years_working <= 10 intersect select t0.age as c0, t0.driver_id as c1 from driver as t0 join school_bus a...
{ "index": 1279, "split": "train" }
For the account named 262, what is the highest card ID associated with it, and what is the account ID?
customers_card_transactions
select max(t0.card_id), t1.account_id as c0 from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.account_name = 262 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": "customers_card_transactions", "sql": "select max(t0.card_id), t1.account_id as c0 from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.account_name = 262 group by c0" }, "style": "rule" }
{ "index": 525, "split": "train" }
Can you list the descriptions and aircraft names for all aircraft that won matches where the winning aircraft ID is 5, excluding those aircraft that are associated with airport aircraft records where the aircraft ID is 1?
aircraft
select anon_1.c0, anon_1.c1 from (select t0.description as c0, t0.aircraft as c1 from aircraft as t0 join match as t1 on t0.aircraft_id = t1.winning_aircraft where t1.winning_aircraft = 5 except select t0.description as c0, t0.aircraft as c1 from aircraft as t0 join airport_aircraft as t1 on t0.aircraft_id = t1.aircraf...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "aircraft", "sql": "select anon_1.c0, anon_1.c1 from (select t0.description as c0, t0.aircraft as c1 from aircraft as t0 join match as t1 on t0.aircraft_id = t1.winning_aircraft where t1.winning_aircraft = 5 except select t0.description as c0, t0.aircraft as c1 from aircraft as t0...
{ "index": 1062, "split": "train" }
Which train has the latest name in reverse alphabetical order among those serving stations with total passengers between approximately 29.66 and 40.44? For that train, what are its name, departure time, train ID, and the station's ID and train ID? Only show the top result based on this sorting.
train_station
select t0.name as c3, t0.time, t0.train_id, t1.station_id, t1.train_id from train as t0 join train_station as t1 on t0.train_id = t1.train_id join station as t2 on t1.station_id = t2.station_id where t2.total_passengers between 29.658 and 40.44 order by c3 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "train_station", "sql": "select t0.name as c3, t0.time, t0.train_id, t1.station_id, t1.train_id from train as t0 join train_station as t1 on t0.train_id = t1.train_id join station as t2 on t1.station_id = t2.station_id where t2.total_passengers between 29.658 and 40.44 order by c3...
{ "index": 597, "split": "train" }
What are the details of the first five purchases, sorted alphabetically by their purchase details?
tracking_share_transactions
select purchase_details as c0 from purchases 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": "tracking_share_transactions", "sql": "select purchase_details as c0 from purchases order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 1571, "split": "train" }
How much less or more is the total sum of project IDs for project 8 compared to the smallest total sum across all projects?
tracking_grants_for_research
select t2.c2 - t0.c0 from (select min(t1.c0) as c2 from (select sum(t1.project_id) as c0 from projects as t0 join tasks as t1 on t0.project_id = t1.project_id group by t0.project_id) as t1) as t2, (select t0.project_id, sum(t1.project_id) as c0 from projects as t0 join tasks as t1 on t0.project_id = t1.project_id where...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t2.c2 - t0.c0 from (select min(t1.c0) as c2 from (select sum(t1.project_id) as c0 from projects as t0 join tasks as t1 on t0.project_id = t1.project_id group by t0.project_id) as t1) as t2, (select t0.project_id, sum(t1.project_id) as...
{ "index": 3204, "split": "train" }
What are the issue dates, artist IDs, and volume IDs of the first 10 volumes ordered by issue date, with null issue dates listed last?
music_4
select issue_date as c0, artist_id, volume_id from volume 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": "music_4", "sql": "select issue_date as c0, artist_id, volume_id from volume order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 294, "split": "train" }
What is the numeric difference between the highest country ID associated with country 47 and the number 105?
sakila_1
select t0.c0 - 105 from (select max(t1.country_id) as c0 from country as t0 join city as t1 on t0.country_id = t1.country_id where t0.country_id = 47 group by t0.country_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": "sakila_1", "sql": "select t0.c0 - 105 from (select max(t1.country_id) as c0 from country as t0 join city as t1 on t0.country_id = t1.country_id where t0.country_id = 47 group by t0.country_id) as t0" }, "style": "rule" }
{ "index": 3250, "split": "train" }
Is the creation date of the tweet with ID 5 earlier than itself?
twitter_1
select createdate < createdate from tweets where id = 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "twitter_1", "sql": "select createdate < createdate from tweets where id = 5" }, "style": "rule" }
{ "index": 3824, "split": "train" }
What are the CMI Cross Reference IDs and corresponding master customer IDs from the Electoral Register where the master customer ID is exactly 5?
local_govt_mdm
select t0.cmi_cross_ref_id, t1.master_customer_id as c1 from electoral_register as t0 join cmi_cross_references as t1 on t0.cmi_cross_ref_id = t1.cmi_cross_ref_id where c1 between 5 and 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_mdm", "sql": "select t0.cmi_cross_ref_id, t1.master_customer_id as c1 from electoral_register as t0 join cmi_cross_references as t1 on t0.cmi_cross_ref_id = t1.cmi_cross_ref_id where c1 between 5 and 5" }, "style": "rule" }
{ "index": 2920, "split": "train" }
What is the percentage change in the total number of project IDs associated with all staff roles at the end date of March 4, 1988, compared to the baseline?
tracking_grants_for_research
select (count(t0.c1) / cast(count(t0.c1) as real) - 1) * 100 from (select sum(t1.project_id) as c1 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t1.date_to = '1988-03-04 19:30:05' group by t0.role_code) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select (count(t0.c1) / cast(count(t0.c1) as real) - 1) * 100 from (select sum(t1.project_id) as c1 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t1.date_to = '1988-03-04 19:30:05' group by t0.role_code)...
{ "index": 3900, "split": "train" }
Which department located in a building ending with "tman" offers the highest total number of credits across its courses?
college_2
select t0.dept_name as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t0.building like '%tman' group by c0 order by sum(t1.credits) 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": "college_2", "sql": "select t0.dept_name as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t0.building like '%tman' group by c0 order by sum(t1.credits) desc limit 1" }, "style": "rule" }
{ "index": 833, "split": "train" }
What are the brand, code, and name of medications, along with the prescribed medication and patient details, for hospital stays that started on or before May 1st, 2008, or exactly on May 2nd, 2008?
hospital_1
select t0.brand, t0.code, t0.name, t1.medication, t1.patient from medication as t0 join prescribes as t1 on t0.code = t1.medication join patient as t2 on t1.patient = t2.ssn join stay as t3 on t2.ssn = t3.patient where t3.staystart <= '2008-05-01 00:00:00' or t3.staystart = '2008-05-02 00:00: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": "hospital_1", "sql": "select t0.brand, t0.code, t0.name, t1.medication, t1.patient from medication as t0 join prescribes as t1 on t0.code = t1.medication join patient as t2 on t1.patient = t2.ssn join stay as t3 on t2.ssn = t3.patient where t3.staystart <= '2008-05-01 00:00:00' or...
{ "index": 1817, "split": "train" }
Who are the five customers with the smallest total payments, whose first names end with 'a' and who have made at least two payments? Please include their total amount paid, cell phone number, and customer ID, sorted from the lowest to the highest total payment.
driving_school
select sum(t0.amount_payment) as c2, t1.cell_mobile_phone_number, t1.customer_id as c1 from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.first_name like '%a' group by c1 having count(*) >= 2 order by c2 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select sum(t0.amount_payment) as c2, t1.cell_mobile_phone_number, t1.customer_id as c1 from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.first_name like '%a' group by c1 having count(*) >= 2 order by c2 asc null...
{ "index": 1700, "split": "train" }
Which movies have been reviewed by reviewers whose names start with "S" or are exactly "Ashley White," and what are their titles, IDs, and directors?
movie_1
select t0.title, t0.mid, t0.director from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid where t2.name like 'S%' or t2.name = 'Ashley White'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.title, t0.mid, t0.director from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid where t2.name like 'S%' or t2.name = 'Ashley White'" }, "style": "rule" }
{ "index": 2334, "split": "train" }
What are the names of all musicals and actors in the database?
musical
select anon_1.c1 from (select name as c1 from musical union select name from actor) 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": "musical", "sql": "select anon_1.c1 from (select name as c1 from musical union select name from actor) as anon_1" }, "style": "rule" }
{ "index": 1323, "split": "train" }
Which films have specific features and are in certain languages, where those films are available in stores other than the one rented by customer 250 and also feature actor 63?
sakila_1
select anon_1.c1, anon_1.c0 from (select t0.special_features as c1, t0.language_id as c0 from film as t0 join inventory as t1 on t0.film_id = t1.film_id where (not t1.store_id in (select store_id from customer where customer_id = 250)) intersect select t0.special_features as c1, t0.language_id as c0 from film as t0 joi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "sakila_1", "sql": "select anon_1.c1, anon_1.c0 from (select t0.special_features as c1, t0.language_id as c0 from film as t0 join inventory as t1 on t0.film_id = t1.film_id where (not t1.store_id in (select store_id from customer where customer_id = 250)) intersect select t0.speci...
{ "index": 373, "split": "train" }
What are the ages, birth states, and head IDs of heads who are currently acting temporarily, but not managing department 11?
department_management
select anon_1.c1, anon_1.c0, anon_1.c2 from (select t0.age as c1, t0.born_state as c0, t0.head_id as c2 from head as t0 join management as t1 on t0.head_id = t1.head_id where t1.temporary_acting like '%Y%' except select t0.age as c1, t0.born_state as c0, t0.head_id as c2 from head as t0 join management as t1 on t0.head...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_management", "sql": "select anon_1.c1, anon_1.c0, anon_1.c2 from (select t0.age as c1, t0.born_state as c0, t0.head_id as c2 from head as t0 join management as t1 on t0.head_id = t1.head_id where t1.temporary_acting like '%Y%' except select t0.age as c1, t0.born_state ...
{ "index": 1872, "split": "train" }
For each problem, what is its ID and how many different staff members authorized its closure?
tracking_software_problems
select problem_id as c0, count(distinct (closure_authorised_by_staff_id)) from problems group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select problem_id as c0, count(distinct (closure_authorised_by_staff_id)) from problems group by c0" }, "style": "rule" }
{ "index": 1367, "split": "train" }
What is the airport ID associated with the flight that has an ID of 8?
flight_company
select airport_id from flight where id = 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": "flight_company", "sql": "select airport_id from flight where id = 8" }, "style": "rule" }
{ "index": 3989, "split": "train" }
What is the difference between the highest worldwide grossing movie that earned up to 40,400,425 and the movie with ID 9?
culture_company
select t2.c3 - t0.c1 from (select max(gross_worldwide) as c3 from movie where gross_worldwide <= 40400425) as t2, (select gross_worldwide as c1 from movie where movie_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": "culture_company", "sql": "select t2.c3 - t0.c1 from (select max(gross_worldwide) as c3 from movie where gross_worldwide <= 40400425) as t2, (select gross_worldwide as c1 from movie where movie_id = 9) as t0" }, "style": "rule" }
{ "index": 3163, "split": "train" }
How many roles are assigned to the user with the most login entries?
document_management
select count(t0.role_code) from roles as t0 join users as t1 on t0.role_code = t1.role_code, (select user_name as c1 from users group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.user_name = t0.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": "document_management", "sql": "select count(t0.role_code) from roles as t0 join users as t1 on t0.role_code = t1.role_code, (select user_name as c1 from users group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.user_name = t0.c1" }, "style": "rule" }
{ "index": 410, "split": "train" }
Can you tell me the catalog level numbers that appear in either the catalog contents or their additional attribute records?
product_catalog
select anon_1.c0 from (select catalog_level_number as c0 from catalog_contents_additional_attributes union select catalog_level_number from catalog_contents) 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": "product_catalog", "sql": "select anon_1.c0 from (select catalog_level_number as c0 from catalog_contents_additional_attributes union select catalog_level_number from catalog_contents) as anon_1" }, "style": "rule" }
{ "index": 2088, "split": "train" }
What are the formation dates of organizations and their corresponding organization IDs for organizations that have contact individuals with individual ID 13 or where the contact individual is not listed in the Individuals table?
e_government
select distinct t0.date_formed, t1.organization_id from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where t1.individual_id = 13 or (not t1.individual_id in (select individuals.individual_id as c2 from individuals))
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_government", "sql": "select distinct t0.date_formed, t1.organization_id from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where t1.individual_id = 13 or (not t1.individual_id in (select individuals.individual_id as c...
{ "index": 813, "split": "train" }