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 the rank of the year 2002 in terms of salary among teams with "CIN" in their ID, when sorted from the lowest to the highest salary?
baseball_1
select t1.c3, t1.c2 as c1 from (select row_number() over (order by salary asc nulls last) as c3, year as c2 from salary where team_id like '%CIN%') as t1 where c1 = 2002
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "baseball_1", "sql": "select t1.c3, t1.c2 as c1 from (select row_number() over (order by salary asc nulls last) as c3, year as c2 from salary where team_id like '%CIN%') as t1 where c1 = 2002" }, "style": "rule" }
{ "index": 3908, "split": "train" }
Can you list the titles, authors, and book IDs of books whose writers' names end with "man," sorted by their book IDs, placing any with unknown IDs at the end?
book_2
select title, writer as c1, book_id as c2 from book where c1 like '%man' order by c2 asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "book_2", "sql": "select title, writer as c1, book_id as c2 from book where c1 like '%man' order by c2 asc nulls last" }, "style": "rule" }
{ "index": 2877, "split": "train" }
How many days pass between when a claim was made and when it was settled?
insurance_policies
select julianday(t1.c3) - julianday(t0.c0) from (select date_claim_settled as c3 from claims) as t1, (select date_claim_made as c0 from claims) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_policies", "sql": "select julianday(t1.c3) - julianday(t0.c0) from (select date_claim_settled as c3 from claims) as t1, (select date_claim_made as c0 from claims) as t0" }, "style": "rule" }
{ "index": 3811, "split": "train" }
Did the organization with ID 5 become established more recently than the organization with ID 1?
e_government
select t1.c2 > t0.c2 from (select date_formed as c2 from organizations where organization_id = 5) as t1, (select date_formed as c2 from organizations where organization_id = 1) 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_government", "sql": "select t1.c2 > t0.c2 from (select date_formed as c2 from organizations where organization_id = 5) as t1, (select date_formed as c2 from organizations where organization_id = 1) as t0" }, "style": "rule" }
{ "index": 3086, "split": "train" }
What are the different payment methods and order shipping charges for orders with a shipping method code that includes "pe"?
customers_campaigns_ecommerce
select distinct t0.payment_method, t1.order_shipping_charges from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t1.shipping_method_code like '%pe%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct t0.payment_method, t1.order_shipping_charges from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t1.shipping_method_code like '%pe%'" }, "style": "rule" }
{ "index": 2447, "split": "train" }
Which user IDs belong to users who share the most common name starting with "He"?
epinions_1
select t0.u_id from useracct as t0, (select name as c0 from useracct where c0 like 'He%' group by c0 order by count(*) desc limit 1) as t0 where t0.name = t0.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "epinions_1", "sql": "select t0.u_id from useracct as t0, (select name as c0 from useracct where c0 like 'He%' group by c0 order by count(*) desc limit 1) as t0 where t0.name = t0.c0" }, "style": "rule" }
{ "index": 1150, "split": "train" }
How many records are there in the Party_Forms table for the form with ID 2?
e_government
select count(*) from party_forms where form_id = 2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_government", "sql": "select count(*) from party_forms where form_id = 2" }, "style": "rule" }
{ "index": 542, "split": "train" }
Which "no" numbers are found in either the wines or the appellations?
wine_1
select anon_1.c0 from (select no as c0 from wine union select no from appellations) 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": "wine_1", "sql": "select anon_1.c0 from (select no as c0 from wine union select no from appellations) as anon_1" }, "style": "rule" }
{ "index": 2127, "split": "train" }
What is the Game ID associated with the injury accident record that has an ID of 12?
game_injury
select game_id from injury_accident where id = 12
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_injury", "sql": "select game_id from injury_accident where id = 12" }, "style": "rule" }
{ "index": 3383, "split": "train" }
What are the typical buying prices, product category codes, and color codes for the product with ID 5? Please list the first five results when sorted by typical buying price, placing any null values last.
products_gen_characteristics
select typical_buying_price as c2, product_category_code, color_code from products where product_id = 5 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": "products_gen_characteristics", "sql": "select typical_buying_price as c2, product_category_code, color_code from products where product_id = 5 order by c2 asc nulls last limit 5" }, "style": "rule" }
{ "index": 18, "split": "train" }
Who are the five staff members with the last names alphabetically at the top, handling complaints about products priced exactly at 35?
customer_complaints
select t0.last_name as c0, t0.staff_id from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id join products as t2 on t1.product_id = t2.product_id where t2.product_price between 35 and 35 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": "customer_complaints", "sql": "select t0.last_name as c0, t0.staff_id from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id join products as t2 on t1.product_id = t2.product_id where t2.product_price between 35 and 35 order by c0 asc nulls last limit 5" }, "style...
{ "index": 2026, "split": "train" }
Show me the top-ranked service, based on the lowest total sum of `service_id`, among services whose names include "a". Please include its rank, service ID, and service name.?
e_government
select t1.c2, t1.c1 as c4 from (select row_number() over (order by t0.c5 asc nulls last) as c2, t0.c3 as c1 from (select t0.service_id as c3, sum(t1.service_id) as c5 from services as t0 join party_services as t1 on t0.service_id = t1.service_id where t0.service_name like '%a%' group by c3) as t0) as t1 where c4 = 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": "e_government", "sql": "select t1.c2, t1.c1 as c4 from (select row_number() over (order by t0.c5 asc nulls last) as c2, t0.c3 as c1 from (select t0.service_id as c3, sum(t1.service_id) as c5 from services as t0 join party_services as t1 on t0.service_id = t1.service_id where t0.se...
{ "index": 3483, "split": "train" }
What are the constructor ID and points for the team with ID 203, based on the constructor standings?
formula_1
select anon_1.c1, anon_1.c0 from (select constructorid as c1, points as c0 from constructorstandings intersect select t0.constructorid as c1, t0.points as c0 from constructorstandings as t0 join constructors as t1 on t0.constructorid = t1.constructorid where t1.constructorid = 203) 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.c1, anon_1.c0 from (select constructorid as c1, points as c0 from constructorstandings intersect select t0.constructorid as c1, t0.points as c0 from constructorstandings as t0 join constructors as t1 on t0.constructorid = t1.constructorid where t...
{ "index": 2599, "split": "train" }
Can you tell me the nickname and school ID of the school with the smallest ID, among those with a school ID less than the average ID of players whose teams start with "St. Loui" or include "C"?
school_player
select t0.nickname, t0.school_id as c1 from school_details as t0 join school as t1 on t0.school_id = t1.school_id join player as t2 on t1.school_id = t2.school_id, (select avg(school_id) as c2 from player where team like 'St. Loui%' or team like '%C%') as t0 where t2.school_id < t0.c2 order by c1 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "school_player", "sql": "select t0.nickname, t0.school_id as c1 from school_details as t0 join school as t1 on t0.school_id = t1.school_id join player as t2 on t1.school_id = t2.school_id, (select avg(school_id) as c2 from player where team like 'St. Loui%' or team like '%C%') as ...
{ "index": 1238, "split": "train" }
Can you provide the annual interchanges, station IDs, annual entry and exit figures, and number of platforms for all stations, including those served by trains whose names end with "and Express"?
train_station
select anon_1.c3, anon_1.c2, anon_1.c1, anon_1.c0 from (select annual_interchanges as c3, station_id as c2, annual_entry_exit as c1, number_of_platforms as c0 from station union select t0.annual_interchanges as c3, t0.station_id as c2, t0.annual_entry_exit as c1, t0.number_of_platforms as c0 from station as t0 join tra...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c3, anon_1.c2, anon_1.c1, anon_1.c0 from (select annual_interchanges as c3, station_id as c2, annual_entry_exit as c1, number_of_platforms as c0 from station union select t0.annual_interchanges as c3, t0.station_id as c2, t0.annual_entry_exit...
{ "index": 2339, "split": "train" }
What are the brands and maximum apertures of the top 10 camera lenses, used to photograph mountains whose names contain "n’", sorted by brand name in alphabetical order?
mountain_photos
select t0.max_aperture, t0.brand as c0 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id join mountain as t2 on t1.mountain_id = t2.id where t2.name like '%n’%' 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": "mountain_photos", "sql": "select t0.max_aperture, t0.brand as c0 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id join mountain as t2 on t1.mountain_id = t2.id where t2.name like '%n’%' order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 1591, "split": "train" }
What are the top five principal activities with the most operating companies, sorted from highest to lowest number of companies?
flight_company
select principal_activities as c1, count(id) as c0 from operate_company 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_company", "sql": "select principal_activities as c1, count(id) as c0 from operate_company group by c1 order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2437, "split": "train" }
Can you provide the October, March, and December temperatures along with the GDP for the top three cities, ordered by October temperature descending, where the cities hosted matches at venues starting with "Estadio Cuscatlán , San Salvador , El" or "Estadio Rigoberto López , Managua , Nicaragua"?
city_record
select t0.oct as c1, t0.mar, t0.dec, t1.gdp from temperature as t0 join city as t1 on t0.city_id = t1.city_id join hosting_city as t2 on t1.city_id = t2.host_city join match as t3 on t2.match_id = t3.match_id where t3.venue like 'Estadio Cuscatlán , San Salvador , El%' or t3.venue like 'Estadio Rigoberto López , Managu...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "city_record", "sql": "select t0.oct as c1, t0.mar, t0.dec, t1.gdp from temperature as t0 join city as t1 on t0.city_id = t1.city_id join hosting_city as t2 on t1.city_id = t2.host_city join match as t3 on t2.match_id = t3.match_id where t3.venue like 'Estadio Cuscatlán , San Salv...
{ "index": 756, "split": "train" }
Which customers placed bookings where the performer’s name ends with "e" or where the performer’s address ID is greater than 180? And what are the order dates for those bookings?
cre_Drama_Workshop_Groups
select anon_1.c1, anon_1.c0 from (select t0.customer_id as c1, t0.order_date as c0 from bookings as t0 join drama_workshop_groups as t1 on t0.workshop_group_id = t1.workshop_group_id join addresses as t2 on t1.address_id = t2.address_id join performers as t3 on t2.address_id = t3.address_id where t3.customer_name like ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Drama_Workshop_Groups", "sql": "select anon_1.c1, anon_1.c0 from (select t0.customer_id as c1, t0.order_date as c0 from bookings as t0 join drama_workshop_groups as t1 on t0.workshop_group_id = t1.workshop_group_id join addresses as t2 on t1.address_id = t2.address_id join pe...
{ "index": 632, "split": "train" }
Does the number of unique 'Herbs' products starting with the letter "c" fall below the maximum number of products found in any product category?
products_gen_characteristics
select t2.c2 < t1.c0 from (select count(distinct (t1.product_id)) as c2 from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code where t0.product_category_code = 'Herbs' and t1.product_name like 'c%' group by t0.product_category_code) as t2, (select max(t0.c2) as c0 f...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select t2.c2 < t1.c0 from (select count(distinct (t1.product_id)) as c2 from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code where t0.product_category_code = 'Herbs' and t1.product_name...
{ "index": 3321, "split": "train" }
grouping by country, filtering by prominence and height constraints, selecting maximum heights per country, ordering alphabetically, and limiting to three results.
climbing
select max(height) from mountain where prominence <= 3825.0 or prominence >= 3825.0 group by country having max(height) <= 4977.0 order by country asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "climbing", "sql": "select max(height) from mountain where prominence <= 3825.0 or prominence >= 3825.0 group by country having max(height) <= 4977.0 order by country asc nulls last limit 3" }, "style": "rule" }
{ "index": 2095, "split": "train" }
How many products are listed in the database?
customer_complaints
select count(*) from products
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_complaints", "sql": "select count(*) from products" }, "style": "rule" }
{ "index": 230, "split": "train" }
Is the average customer ID for product 118, based on open complaints, higher than the average customer ID for product 120?
customer_complaints
select t1.c0 > t0.c0 from (select avg(t1.customer_id) as c0 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.complaint_status_code = 'Open' group by t0.product_id) as t1, (select t0.product_id, avg(t1.customer_id) as c0 from products as t0 join complaints 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": "customer_complaints", "sql": "select t1.c0 > t0.c0 from (select avg(t1.customer_id) as c0 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.complaint_status_code = 'Open' group by t0.product_id) as t1, (select t0.product_i...
{ "index": 3542, "split": "train" }
For students who have fewer than two course enrollments after enrolling in courses with IDs greater than 2 before November 22, 2017, what are their latest logon date, middle name, student ID, and the highest student ID among their relevant enrollments?
e_learning
select t0.date_of_latest_logon, t0.middle_name, t0.student_id as c2, max(t1.student_id) from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_enrolment < '2017-11-22 18:29:18' and t1.course_id > 2 group by c2 having count(*) < 2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t0.date_of_latest_logon, t0.middle_name, t0.student_id as c2, max(t1.student_id) from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_enrolment < '2017-11-22 18:29:18' and t1.course_id > 2 group by c...
{ "index": 2540, "split": "train" }
Show the departure date, origin, price, and distance of the five flights with aircraft distances no more than 1504, ordered from the longest to the shortest distance.
flight_1
select t0.departure_date, t0.origin, t0.price, t1.distance as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where c0 <= 1504 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 t0.departure_date, t0.origin, t0.price, t1.distance as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where c0 <= 1504 order by c0 desc limit 5" }, "style": "rule" }
{ "index": 413, "split": "train" }
Is the smallest customer ID linked to customer 8 greater than the smallest customer ID linked to customer 11, when considering only payments with an amount due of at least 259.18?
products_for_hire
select t1.c1 > t0.c1 from (select min(t1.customer_id) as c1 from customers as t0 join payments as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 11 and t1.amount_due >= 259.18 group by t0.customer_id) as t1, (select t0.customer_id, min(t1.customer_id) as c1 from customers as t0 join payments as t1 on t0.c...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select t1.c1 > t0.c1 from (select min(t1.customer_id) as c1 from customers as t0 join payments as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 11 and t1.amount_due >= 259.18 group by t0.customer_id) as t1, (select t0.customer_id, min(t1...
{ "index": 3553, "split": "train" }
Which employee with fewer than five certificates and matching the eid 390487451 has the last name in reverse alphabetical order, and what is their name and eid?
flight_1
select t0.name as c1, t0.eid as c0 from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 390487451 group by c0 having count(*) < 5 order by c1 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_1", "sql": "select t0.name as c1, t0.eid as c0 from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 390487451 group by c0 having count(*) < 5 order by c1 desc limit 1" }, "style": "rule" }
{ "index": 257, "split": "train" }
Show the date of birth for all guests with guest IDs less than 5.
apartment_rentals
select t0.date_of_birth from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where t1.guest_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": "apartment_rentals", "sql": "select t0.date_of_birth from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where t1.guest_id < 5" }, "style": "rule" }
{ "index": 250, "split": "train" }
How much higher or lower is the maximum song rating in the 'tagore' genre compared to the maximum rating in the 'modern' genre?
music_1
select t1.c1 - t0.c1 from (select max(t1.rating) as c1 from genre as t0 join song as t1 on t0.g_name = t1.genre_is where t0.g_name = 'tagore' group by t0.g_name) as t1, (select t0.g_name, max(t1.rating) as c1 from genre as t0 join song as t1 on t0.g_name = t1.genre_is where t0.g_name = 'modern' group by t0.g_name) as t...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t1.c1 - t0.c1 from (select max(t1.rating) as c1 from genre as t0 join song as t1 on t0.g_name = t1.genre_is where t0.g_name = 'tagore' group by t0.g_name) as t1, (select t0.g_name, max(t1.rating) as c1 from genre as t0 join song as t1 on t0.g_name = t1.ge...
{ "index": 3856, "split": "train" }
Is the crossing score for the player with ID 162355 less than 57?
soccer_1
select crossing < 57 from player_attributes where id = 162355
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 crossing < 57 from player_attributes where id = 162355" }, "style": "rule" }
{ "index": 3349, "split": "train" }
List the customer details, customer ID, and the average customer ID from orders for each customer who has orders ending with "pped" in their status.
tracking_orders
select t0.customer_details, t0.customer_id as c1, avg(t1.customer_id) from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t1.order_status like '%pped' 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": "tracking_orders", "sql": "select t0.customer_details, t0.customer_id as c1, avg(t1.customer_id) from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t1.order_status like '%pped' group by c1" }, "style": "rule" }
{ "index": 2549, "split": "train" }
How many days are there between the active to date and active from date for the customer contact channels?
customers_and_addresses
select julianday(t1.c3) - julianday(t0.c2) from (select active_to_date as c3 from customer_contact_channels) as t1, (select active_from_date as c2 from customer_contact_channels) 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_addresses", "sql": "select julianday(t1.c3) - julianday(t0.c2) from (select active_to_date as c3 from customer_contact_channels) as t1, (select active_from_date as c2 from customer_contact_channels) as t0" }, "style": "rule" }
{ "index": 3689, "split": "train" }
What is the percent change in the number of visitors who had their earliest attraction visit on August 6, 2013, compared to those on March 19, 2017?
cre_Theme_park
select (count(t0.c2) / cast(count(t1.c2) as real) - 1) * 100 from (select min(t1.tourist_attraction_id) as c2 from visitors as t0 join visits as t1 on t0.tourist_id = t1.tourist_id where t1.visit_date = '2017-03-19 08:48:19' group by t0.tourist_id) as t0, (select t0.tourist_id, min(t1.tourist_attraction_id) as c2 from ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (count(t0.c2) / cast(count(t1.c2) as real) - 1) * 100 from (select min(t1.tourist_attraction_id) as c2 from visitors as t0 join visits as t1 on t0.tourist_id = t1.tourist_id where t1.visit_date = '2017-03-19 08:48:19' group by t0.tourist_id) as t0,...
{ "index": 3016, "split": "train" }
What is the average number of points scored by the player with ID 11, grouped by their player ID, and how does it compare for the first five records when sorted by player ID?
sports_competition
select avg(points) from player where player_id = 11 group by player_id order by player_id 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": "sports_competition", "sql": "select avg(points) from player where player_id = 11 group by player_id order by player_id asc nulls last limit 5" }, "style": "rule" }
{ "index": 1420, "split": "train" }
What are the top three prep nurses, their appointment IDs, and their physician positions for appointments involving physicians affiliated with department 2, ordered by the highest prep nurse ID?
hospital_1
select t0.prepnurse as c2, t0.appointmentid, t1.position from appointment as t0 join physician as t1 on t0.physician = t1.employeeid join affiliated_with as t2 on t1.employeeid = t2.physician where t2.department = 2 order by c2 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "hospital_1", "sql": "select t0.prepnurse as c2, t0.appointmentid, t1.position from appointment as t0 join physician as t1 on t0.physician = t1.employeeid join affiliated_with as t2 on t1.employeeid = t2.physician where t2.department = 2 order by c2 desc limit 3" }, "style": "...
{ "index": 760, "split": "train" }
Among airlines that have at least 4 routes and are associated with airlines having IDs less than or equal to 3026, what is the country and airline ID, and how many routes do they have, specifically identifying the airline with the fewest routes?
flight_4
select t0.country, t0.alid as c2, count(t1.alid) as c0 from airlines as t0 join routes as t1 on t0.alid = t1.alid where t1.alid <= 3026 group by c2 having count(*) >= 4 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t0.country, t0.alid as c2, count(t1.alid) as c0 from airlines as t0 join routes as t1 on t0.alid = t1.alid where t1.alid <= 3026 group by c2 having count(*) >= 4 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 2525, "split": "train" }
Which staff members are assigned to department 1 and were also assigned on or before September 15, 2016, at 11:00:41? What are their genders, IDs, and names?
department_store
select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.staff_gender as c2, t0.staff_id as c0, t0.staff_name as c1 from staff as t0 join staff_department_assignments as t1 on t0.staff_id = t1.staff_id where t1.department_id = 1 intersect select t0.staff_gender as c2, t0.staff_id as c0, t0.staff_name as c1 from staff as ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.staff_gender as c2, t0.staff_id as c0, t0.staff_name as c1 from staff as t0 join staff_department_assignments as t1 on t0.staff_id = t1.staff_id where t1.department_id = 1 intersect select t0.staff_...
{ "index": 2744, "split": "train" }
What are the account opening dates and invoice numbers for transactions with amounts less than 1,462.62 or at least 1,903.41?
customers_and_invoices
select t0.date_account_opened, t1.invoice_number from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_amount < 1462.62 or t1.transaction_amount >= 1903.41
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t0.date_account_opened, t1.invoice_number from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_amount < 1462.62 or t1.transaction_amount >= 1903.41" }, "style": "rule" }
{ "index": 1628, "split": "train" }
Find the names and user IDs of all users who have not reviewed the item titled "orange".
epinions_1
select anon_1.c0, anon_1.c1 from (select name as c0, u_id as c1 from useracct except select t0.name as c0, t0.u_id as c1 from useracct as t0 join review as t1 on t0.u_id = t1.u_id join item as t2 on t1.i_id = t2.i_id where t2.title = 'orange') 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": "epinions_1", "sql": "select anon_1.c0, anon_1.c1 from (select name as c0, u_id as c1 from useracct except select t0.name as c0, t0.u_id as c1 from useracct as t0 join review as t1 on t0.u_id = t1.u_id join item as t2 on t1.i_id = t2.i_id where t2.title = 'orange') as anon_1" },...
{ "index": 1723, "split": "train" }
Which individuals had contact with organizations between March 12, 2018, in the morning, and March 24, 2018, in the late afternoon, and what are their IDs, middle names, last names, and the dates they were contacted?
e_government
select t0.individual_id, t0.individual_middle_name, t0.individual_last_name, t1.date_contact_to as c3 from individuals as t0 join organization_contact_individuals as t1 on t0.individual_id = t1.individual_id where c3 between '2018-03-12 07:55:28' and '2018-03-24 16:54:36'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.individual_id, t0.individual_middle_name, t0.individual_last_name, t1.date_contact_to as c3 from individuals as t0 join organization_contact_individuals as t1 on t0.individual_id = t1.individual_id where c3 between '2018-03-12 07:55:28' and '2018-...
{ "index": 2587, "split": "train" }
What is the longitude of stations that have ever had at least 10 bikes available?
bike_1
select t0.long from station as t0 join status as t1 on t0.id = t1.station_id where t1.bikes_available >= 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": "bike_1", "sql": "select t0.long from station as t0 join status as t1 on t0.id = t1.station_id where t1.bikes_available >= 10" }, "style": "rule" }
{ "index": 1539, "split": "train" }
What is the difference between the product ID of order 14 and the highest product ID less than or equal to 1?
customers_and_addresses
select t2.c0 - t0.c2 from (select max(product_id) as c0 from order_items where product_id <= 1) as t2, (select product_id as c2 from order_items where order_id = 14) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t2.c0 - t0.c2 from (select max(product_id) as c0 from order_items where product_id <= 1) as t2, (select product_id as c2 from order_items where order_id = 14) as t0" }, "style": "rule" }
{ "index": 3165, "split": "train" }
What is the highest number of truck details associated with any truck?
customer_deliveries
select count(truck_details) as c0 from trucks 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": "customer_deliveries", "sql": "select count(truck_details) as c0 from trucks order by c0 desc limit 1" }, "style": "rule" }
{ "index": 463, "split": "train" }
What are the ten most common details provided for street markets within Cre Theme Park?
cre_Theme_park
select market_details as c0, count(market_details) as c1 from street_markets group by c0 order by c1 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Theme_park", "sql": "select market_details as c0, count(market_details) as c1 from street_markets group by c0 order by c1 desc limit 10" }, "style": "rule" }
{ "index": 1377, "split": "train" }
Which albums have a total artist ID sum of 198 or more, and what are their album IDs and the total sum of artist IDs associated with each?
chinook_1
select albumid as c1, sum(artistid) from album group by c1 having sum(artistid) >= 198
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "chinook_1", "sql": "select albumid as c1, sum(artistid) from album group by c1 having sum(artistid) >= 198" }, "style": "rule" }
{ "index": 912, "split": "train" }
What is the difference between 4 and the problem ID linked to log entry 5?
tracking_software_problems
select problem_id - 4 from problem_log where problem_log_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": "tracking_software_problems", "sql": "select problem_id - 4 from problem_log where problem_log_id = 5" }, "style": "rule" }
{ "index": 3260, "split": "train" }
Which catalog entries have a length that ends with "3," and what are their Catalog ID, Level Number, and Level Name?
product_catalog
select t0.catalog_id, t0.catalog_level_number, t0.catalog_level_name from catalog_structure as t0 join catalog_contents as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.length like '%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": "product_catalog", "sql": "select t0.catalog_id, t0.catalog_level_number, t0.catalog_level_name from catalog_structure as t0 join catalog_contents as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.length like '%3'" }, "style": "rule" }
{ "index": 1457, "split": "train" }
Can you tell me the customer code, customer ID, payment method, and order status for the first customer (when sorted alphabetically by customer code) who bought products from suppliers with a total amount purchased of exactly 20,447.99, and whose total value purchased is less than the total value bought from supplier 1...
department_store
select t0.customer_code as c4, t0.customer_id, t0.payment_method_code, t1.order_status_code from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id join products as t3 on t2.product_id = t3.product_id join product_suppliers as t4 on t3.produ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select t0.customer_code as c4, t0.customer_id, t0.payment_method_code, t1.order_status_code from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id join products as t3 on t2....
{ "index": 2188, "split": "train" }
Among manufacturers that produce furniture with ID 1 or 2, which one is the oldest, and what are their opening year, ID, and number of shops?
manufacturer
select t0.open_year as c0, t0.manufacturer_id, t0.num_of_shops from manufacturer as t0 join furniture_manufacte as t1 on t0.manufacturer_id = t1.manufacturer_id join furniture as t2 on t1.furniture_id = t2.furniture_id where t2.furniture_id = 2 or t2.furniture_id = 1 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "manufacturer", "sql": "select t0.open_year as c0, t0.manufacturer_id, t0.num_of_shops from manufacturer as t0 join furniture_manufacte as t1 on t0.manufacturer_id = t1.manufacturer_id join furniture as t2 on t1.furniture_id = t2.furniture_id where t2.furniture_id = 2 or t2.furnit...
{ "index": 1036, "split": "train" }
Find the addresses where there are either members or shops located.
coffee_shop
select anon_1.c1 from (select address as c1 from member union select address from shop) 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": "coffee_shop", "sql": "select anon_1.c1 from (select address as c1 from member union select address from shop) as anon_1" }, "style": "rule" }
{ "index": 2010, "split": "train" }
Which three cities have hosted the fewest events, and how many times did each of them host?
city_record
select host_city as c0, count(year) from hosting_city group by c0 order by count(*) asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "city_record", "sql": "select host_city as c0, count(year) from hosting_city group by c0 order by count(*) asc nulls last limit 3" }, "style": "rule" }
{ "index": 475, "split": "train" }
What are the first 10 characteristic type codes and product IDs associated with product 8, ordered alphabetically by characteristic name?
products_gen_characteristics
select t0.characteristic_type_code, t1.product_id as c1 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where c1 = 8 order by t0.characteristic_name 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": "products_gen_characteristics", "sql": "select t0.characteristic_type_code, t1.product_id as c1 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where c1 = 8 order by t0.characteristic_name asc nulls last limit 10" }, ...
{ "index": 2042, "split": "train" }
Which customers, classified as good or bad, have rented products with a daily hire cost of exactly 26.15?
products_for_hire
select t0.good_or_bad_customer, t0.customer_id from customers as t0 join bookings as t1 on t0.customer_id = t1.customer_id join products_booked as t2 on t1.booking_id = t2.booking_id join products_for_hire as t3 on t2.product_id = t3.product_id where t3.daily_hire_cost = 26.15
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_for_hire", "sql": "select t0.good_or_bad_customer, t0.customer_id from customers as t0 join bookings as t1 on t0.customer_id = t1.customer_id join products_booked as t2 on t1.booking_id = t2.booking_id join products_for_hire as t3 on t2.product_id = t3.product_id where t...
{ "index": 162, "split": "train" }
What are the job titles of up to three people whose friends' names contain the letter "b" and whose own names contain "A," sorted by their city in reverse alphabetical order?
network_2
select t0.job from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like '%b%' and t1.friend like '%A%' order by t0.city desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "network_2", "sql": "select t0.job from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like '%b%' and t1.friend like '%A%' order by t0.city desc limit 3" }, "style": "rule" }
{ "index": 1936, "split": "train" }
What are the phone numbers and payment methods of parties that have both a service with an ID between 6 and 13 and a form with ID 3?
e_government
select anon_1.c0, anon_1.c1 from (select t0.party_phone as c0, t0.payment_method_code as c1 from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t1.service_id between 6 and 13 intersect select t0.party_phone as c0, t0.payment_method_code as c1 from parties as t0 join party_forms as t1 on t...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_government", "sql": "select anon_1.c0, anon_1.c1 from (select t0.party_phone as c0, t0.payment_method_code as c1 from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t1.service_id between 6 and 13 intersect select t0.party_phone as c0, t0.payment_m...
{ "index": 46, "split": "train" }
Can you find the 10 routes with the smallest station IDs, along with their train IDs, where the weekly weather at the station has a high temperature either above 54 or at most 54, sorted by station ID?
station_weather
select t0.station_id as c1, t0.train_id from route as t0 join station as t1 on t0.station_id = t1.id join weekly_weather as t2 on t1.id = t2.station_id where t2.high_temperature > 54 or t2.high_temperature <= 54 order by c1 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select t0.station_id as c1, t0.train_id from route as t0 join station as t1 on t0.station_id = t1.id join weekly_weather as t2 on t1.id = t2.station_id where t2.high_temperature > 54 or t2.high_temperature <= 54 order by c1 asc nulls last limit 10" }, ...
{ "index": 242, "split": "train" }
Which buildings have offices belonging to company 3 but do not have any offices for company 4? Please specify their IDs and current statuses.
company_office
select anon_1.c0, anon_1.c1 from (select t0.id as c0, t0.status as c1 from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where t1.company_id = 3 except select t0.id as c0, t0.status as c1 from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where t1.company_id = 4) as anon_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c1 from (select t0.id as c0, t0.status as c1 from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where t1.company_id = 3 except select t0.id as c0, t0.status as c1 from buildings as t0 join office_locations ...
{ "index": 2961, "split": "train" }
Which playlist has the smallest number of unique tracks, and what is that number?
store_1
select count(distinct (track_id)) as c0 from playlist_tracks order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select count(distinct (track_id)) as c0 from playlist_tracks order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 145, "split": "train" }
What is the difference between the camera lens ID used in photo 10 and the lowest camera lens ID among photos with names that include the letter "u"?
mountain_photos
select t2.c3 - t0.c2 from (select min(camera_lens_id) as c3 from photos where name like '%u%') as t2, (select camera_lens_id as c2 from photos where id = 10) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "mountain_photos", "sql": "select t2.c3 - t0.c2 from (select min(camera_lens_id) as c3 from photos where name like '%u%') as t2, (select camera_lens_id as c2 from photos where id = 10) as t0" }, "style": "rule" }
{ "index": 3195, "split": "train" }
Which are the top 10 products (by name in reverse alphabetical order), along with their maximum page size and the store ID, for stores located in districts with store ID 3?
store_product
select t0.product as c0, t0.max_page_size, t1.store_id from product as t0 join store_product as t1 on t0.product_id = t1.product_id join store as t2 on t1.store_id = t2.store_id join store_district as t3 on t2.store_id = t3.store_id where t3.store_id = 3 or t3.store_id = 3 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": "store_product", "sql": "select t0.product as c0, t0.max_page_size, t1.store_id from product as t0 join store_product as t1 on t0.product_id = t1.product_id join store as t2 on t1.store_id = t2.store_id join store_district as t3 on t2.store_id = t3.store_id where t3.store_id = 3 o...
{ "index": 925, "split": "train" }
How many customers have the customer ID 956?
insurance_fnol
select count(*) from customers where customer_id = 956
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_fnol", "sql": "select count(*) from customers where customer_id = 956" }, "style": "rule" }
{ "index": 933, "split": "train" }
Which product category codes are linked to products that have complaints with a status of 'New'?
customer_complaints
select t0.product_category_code from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.complaint_status_code = 'New'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_complaints", "sql": "select t0.product_category_code from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.complaint_status_code = 'New'" }, "style": "rule" }
{ "index": 1358, "split": "train" }
For accounts involved in transactions greater than 1336.21, what are the customer IDs, account names, and account IDs?
customers_card_transactions
select t0.customer_id, t0.account_name from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_amount > 1336.21
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select t0.customer_id, t0.account_name from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_amount > 1336.21" }, "style": "rule" }
{ "index": 1624, "split": "train" }
Can you find the nationalities, ages, and host IDs of the top 5 hosts who participated in parties held at locations starting with "Heineken Musi," and list them in order from Z to A based on their nationality?
party_host
select t0.nationality as c0, t0.age, t1.host_id from host as t0 join party_host as t1 on t0.host_id = t1.host_id join party as t2 on t1.party_id = t2.party_id where t2.location like 'Heineken Musi%' 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": "party_host", "sql": "select t0.nationality as c0, t0.age, t1.host_id from host as t0 join party_host as t1 on t0.host_id = t1.host_id join party as t2 on t1.party_id = t2.party_id where t2.location like 'Heineken Musi%' order by c0 desc limit 5" }, "style": "rule" }
{ "index": 712, "split": "train" }
List the ten professors with the lowest employee numbers who teach in departments where students have fewer than 36 hours, including their professor number, department code, highest degree, the department's employee number, and department name, sorted by professor number with any missing values at the end.
college_1
select t0.emp_num as c0, t0.dept_code, t0.prof_high_degree, t1.emp_num, t1.dept_name from professor as t0 join department as t1 on t0.dept_code = t1.dept_code join student as t2 on t1.dept_code = t2.dept_code where t2.stu_hrs < 36 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": "college_1", "sql": "select t0.emp_num as c0, t0.dept_code, t0.prof_high_degree, t1.emp_num, t1.dept_name from professor as t0 join department as t1 on t0.dept_code = t1.dept_code join student as t2 on t1.dept_code = t2.dept_code where t2.stu_hrs < 36 order by c0 asc nulls last li...
{ "index": 2546, "split": "train" }
List the five longest climbing times, sorted from the slowest to the fastest.
climbing
select time as c0 from climber 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": "climbing", "sql": "select time as c0 from climber order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2433, "split": "train" }
Can you list the email addresses and phone numbers of up to ten parties that have used form ID 5, sorted by their phone numbers with any missing numbers appearing last?
e_government
select t0.party_email, t0.party_phone as c0 from parties as t0 join party_forms as t1 on t0.party_id = t1.party_id where t1.form_id = 5 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": "e_government", "sql": "select t0.party_email, t0.party_phone as c0 from parties as t0 join party_forms as t1 on t0.party_id = t1.party_id where t1.form_id = 5 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 503, "split": "train" }
Which employees hired on or before April 1, 2002, have the highest "Reports To" value, and what are their hire dates?
store_1
select t0.hire_date, t0.reports_to as c3 from employees as t0, (select max(reports_to) as c0 from employees where hire_date <= '2002-04-01 00:00:00') as t1 where c3 = t1.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t0.hire_date, t0.reports_to as c3 from employees as t0, (select max(reports_to) as c0 from employees where hire_date <= '2002-04-01 00:00:00') as t1 where c3 = t1.c0" }, "style": "rule" }
{ "index": 3797, "split": "train" }
What is the organization ID associated with the item that has the ID 85?
local_govt_and_lot
select organization_id from things where thing_id = 85
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 organization_id from things where thing_id = 85" }, "style": "rule" }
{ "index": 3384, "split": "train" }
Which ratings are assigned to either songs or genres in the database?
music_1
select anon_1.c0 from (select rating as c0 from song union select rating from genre) 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": "music_1", "sql": "select anon_1.c0 from (select rating as c0 from song union select rating from genre) as anon_1" }, "style": "rule" }
{ "index": 2734, "split": "train" }
What are the top ten courses that have the highest minimum number of credits?
college_1
select crs_code as c1, min(crs_credit) as c0 from course group by c1 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": "college_1", "sql": "select crs_code as c1, min(crs_credit) as c0 from course group by c1 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 348, "split": "train" }
What are the IDs, names, and FDA approval statuses of the top five medicines that act as inhibitors—based on interactions ending with "nhibitor"—sorted by approval status from approved to unapproved?
medicine_enzyme_interaction
select t0.fda_approved as c1, t0.id, t0.name from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.interaction_type like '%nhibitor' 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": "medicine_enzyme_interaction", "sql": "select t0.fda_approved as c1, t0.id, t0.name from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.interaction_type like '%nhibitor' order by c1 desc limit 5" }, "style": "rule" }
{ "index": 435, "split": "train" }
For each roller coaster speed, how many parks have coasters at that speed, and how many different speeds are there overall?
roller_coaster
select speed as c0, count(park), count(distinct (speed)) from roller_coaster 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": "roller_coaster", "sql": "select speed as c0, count(park), count(distinct (speed)) from roller_coaster group by c0" }, "style": "rule" }
{ "index": 2533, "split": "train" }
On March 27, 2015, at noon, did customer 79 experience a percentage change in their maximum customer ID that is greater than the maximum percentage change observed across all customers on that same date?
local_govt_and_lot
select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c3 from (select max(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 = 79 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t2, (select abs((max(t0.c0) / cast(max(...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select abs((t2.c0 / cast(t2.c0 as real) - 1) * 100) > t1.c3 from (select max(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 = 79 and t1.date_moved_in = '2015-03-27 12:00:00...
{ "index": 3443, "split": "train" }
What are the card IDs and expiration dates of customer cards that have been used in transactions linked to accounts whose names start with "338"?
customers_card_transactions
select anon_1.c0, anon_1.c1 from (select card_id as c0, date_valid_to as c1 from customers_cards intersect select t0.card_id as c0, t0.date_valid_to as c1 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id join accounts as t2 on t1.account_id = t2.account_id where t2.account_name li...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select anon_1.c0, anon_1.c1 from (select card_id as c0, date_valid_to as c1 from customers_cards intersect select t0.card_id as c0, t0.date_valid_to as c1 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id...
{ "index": 2705, "split": "train" }
Can you tell me, for each catalog that has three or more associated attributes, how many catalog levels it contains along with its name?
product_catalog
select count(t0.catalog_level_number), t2.catalog_name from catalog_contents_additional_attributes as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number join catalogs as t2 on t1.catalog_id = t2.catalog_id group by t2.catalog_id having count(t0.attribute_id) >= 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": "product_catalog", "sql": "select count(t0.catalog_level_number), t2.catalog_name from catalog_contents_additional_attributes as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number join catalogs as t2 on t1.catalog_id = t2.catalog_id group by t2.ca...
{ "index": 2682, "split": "train" }
What is the average amount of memory used in kilobytes across all screen modes?
phone_1
select avg(used_kb) from screen_mode
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "phone_1", "sql": "select avg(used_kb) from screen_mode" }, "style": "rule" }
{ "index": 2282, "split": "train" }
Which country with an ID less than 45 that contains the city with ID 43 is alphabetically first? Please provide the country name.
sakila_1
select t0.country as c0 from country as t0 join city as t1 on t0.country_id = t1.country_id where t1.city_id = 43 and t1.country_id < 45 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "sakila_1", "sql": "select t0.country as c0 from country as t0 join city as t1 on t0.country_id = t1.country_id where t1.city_id = 43 and t1.country_id < 45 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 773, "split": "train" }
On what date did the assisting nurse reach their highest activity level after May 10, 2008?
hospital_1
select t0.dateundergoes, t0.assistingnurse as c3 from undergoes as t0, (select max(assistingnurse) as c4 from undergoes where dateundergoes > '2008-05-10 00:00:00') as t1 where c3 = t1.c4
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.dateundergoes, t0.assistingnurse as c3 from undergoes as t0, (select max(assistingnurse) as c4 from undergoes where dateundergoes > '2008-05-10 00:00:00') as t1 where c3 = t1.c4" }, "style": "rule" }
{ "index": 3777, "split": "train" }
For each organization whose details include "n Group," what is the smallest parent organization ID associated with it?
local_govt_and_lot
select organization_details as c0, min(parent_organization_id) from organizations where c0 like '%n Group%' 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": "local_govt_and_lot", "sql": "select organization_details as c0, min(parent_organization_id) from organizations where c0 like '%n Group%' group by c0" }, "style": "rule" }
{ "index": 1109, "split": "train" }
When was the train with the highest train number among those originating from locations ending with "ai" scheduled?
station_weather
select t0.time, t0.train_number as c1 from train as t0, (select max(train_number) as c0 from train where origin like '%ai') as t1 where c1 = t1.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select t0.time, t0.train_number as c1 from train as t0, (select max(train_number) as c0 from train where origin like '%ai') as t1 where c1 = t1.c0" }, "style": "rule" }
{ "index": 3794, "split": "train" }
Which musicals have the most common award and resulted in a win, and what are their names along with their average production year?
musical
select t0.name as c1, avg(t0.year) from musical as t0, (select award as c2 from musical group by c2 order by count(*) desc limit 1) as t0 where t0.award = t0.c2 and t0.result like '%Won%' 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": "musical", "sql": "select t0.name as c1, avg(t0.year) from musical as t0, (select award as c2 from musical group by c2 order by count(*) desc limit 1) as t0 where t0.award = t0.c2 and t0.result like '%Won%' group by c1" }, "style": "rule" }
{ "index": 2646, "split": "train" }
For each attribute data type in the attribute definitions, how many unique attribute names are associated with it, and how many total attribute definitions are there?
product_catalog
select attribute_data_type as c0, count(distinct (attribute_name)), count(*) from attribute_definitions 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": "product_catalog", "sql": "select attribute_data_type as c0, count(distinct (attribute_name)), count(*) from attribute_definitions group by c0" }, "style": "rule" }
{ "index": 1584, "split": "train" }
Which position and school ID correspond to the player with the highest value when ordering players in descending order?
school_player
select position, school_id from player order by player 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": "school_player", "sql": "select position, school_id from player order by player desc limit 1" }, "style": "rule" }
{ "index": 2430, "split": "train" }
Which employees, along with their role codes and employee IDs, are involved with the organization’s most frequently handled document type?
cre_Doc_Control_Systems
select t0.role_code, t0.employee_id from employees as t0 join circulation_history as t1 on t0.employee_id = t1.employee_id join draft_copies as t2 on t1.document_id = t2.document_id join document_drafts as t3 on t2.document_id = t3.document_id join documents as t4 on t3.document_id = t4.document_id join ref_document_ty...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Control_Systems", "sql": "select t0.role_code, t0.employee_id from employees as t0 join circulation_history as t1 on t0.employee_id = t1.employee_id join draft_copies as t2 on t1.document_id = t2.document_id join document_drafts as t3 on t2.document_id = t3.document_id jo...
{ "index": 1559, "split": "train" }
Which students have an ID less than or equal to 3, or whose ID equals the sum of all student IDs recorded in assessment notes?
behavior_monitoring
select t0.student_id from students as t0 join assessment_notes as t1 on t0.student_id = t1.student_id, (select sum(student_id) as c0 from assessment_notes) as t0 where t1.student_id <= 3 or t1.student_id = t0.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select t0.student_id from students as t0 join assessment_notes as t1 on t0.student_id = t1.student_id, (select sum(student_id) as c0 from assessment_notes) as t0 where t1.student_id <= 3 or t1.student_id = t0.c0" }, "style": "rule" }
{ "index": 1964, "split": "train" }
What are the colors of the top 5 products (sorted in reverse alphabetical order by product name) that appear in order items with a quantity containing the digit '3', excluding the product with ID 1?
customers_and_invoices
select t0.product_color from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_quantity like '%3%' and (not t1.product_id in (select t0.product_id as c1 from products where t0.product_id = 1)) order by t0.product_name 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": "customers_and_invoices", "sql": "select t0.product_color from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_quantity like '%3%' and (not t1.product_id in (select t0.product_id as c1 from products where t0.product_id = 1)) order by t0.prod...
{ "index": 2454, "split": "train" }
What is the difference between the source airport id of route 47490 and 2109?
flight_4
select src_apid - 2109 from routes where rid = 47490
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select src_apid - 2109 from routes where rid = 47490" }, "style": "rule" }
{ "index": 3236, "split": "train" }
Which medicines have their Id, Trade Name, FDA approval status, and Name listed in the database and also interact with enzymes whose product name includes "rinog"?
medicine_enzyme_interaction
select anon_1.c1, anon_1.c0, anon_1.c2, anon_1.c3 from (select id as c1, trade_name as c0, fda_approved as c2, name as c3 from medicine intersect select t0.id as c1, t0.trade_name as c0, t0.fda_approved as c2, t0.name as c3 from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id join enzyme...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select anon_1.c1, anon_1.c0, anon_1.c2, anon_1.c3 from (select id as c1, trade_name as c0, fda_approved as c2, name as c3 from medicine intersect select t0.id as c1, t0.trade_name as c0, t0.fda_approved as c2, t0.name as c3 from medicine as t...
{ "index": 1293, "split": "train" }
What is the percentage change in the number of clients with bookings between the most recent date, December 21, 1995, and the earliest date, October 9, 1983?
cre_Drama_Workshop_Groups
select (count(distinct (t0.c0)) / cast(count(distinct (t1.c0)) as real) - 1) * 100 from (select avg(t1.customer_id) as c0 from clients as t0 join bookings as t1 on t0.client_id = t1.customer_id where t1.actual_delivery_date = '1995-12-21 05:01:38' group by t0.client_id) as t0, (select avg(t1.customer_id) as c0 from cli...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Drama_Workshop_Groups", "sql": "select (count(distinct (t0.c0)) / cast(count(distinct (t1.c0)) as real) - 1) * 100 from (select avg(t1.customer_id) as c0 from clients as t0 join bookings as t1 on t0.client_id = t1.customer_id where t1.actual_delivery_date = '1995-12-21 05:01:...
{ "index": 3909, "split": "train" }
What is the numerical difference between 6 and the highest game ID associated with injury accidents in game 1?
game_injury
select t0.c0 - 6 from (select max(t1.game_id) as c0 from game as t0 join injury_accident as t1 on t0.id = t1.game_id where t0.id = 1 group by t0.id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_injury", "sql": "select t0.c0 - 6 from (select max(t1.game_id) as c0 from game as t0 join injury_accident as t1 on t0.id = t1.game_id where t0.id = 1 group by t0.id) as t0" }, "style": "rule" }
{ "index": 3239, "split": "train" }
Which town city and customer type code is the first listed when customers are sorted alphabetically by their town city, ignoring any entries with missing town city information?
customer_complaints
select town_city as c1, customer_type_code from customers 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": "customer_complaints", "sql": "select town_city as c1, customer_type_code from customers order by c1 asc nulls last limit 1" }, "style": "rule" }
{ "index": 2561, "split": "train" }
Can you tell me the count of unique Attribute IDs, the Catalog ID, and the latest revision date for catalogs where the average catalog level number exceeds 8, sorted by the number of unique attributes?
product_catalog
select count(distinct (t0.attribute_id)) as c1, t2.catalog_id as c2, t2.date_of_latest_revision from catalog_contents_additional_attributes as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number join catalogs as t2 on t1.catalog_id = t2.catalog_id group by c2 having avg(t0.catalog_level...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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(distinct (t0.attribute_id)) as c1, t2.catalog_id as c2, t2.date_of_latest_revision from catalog_contents_additional_attributes as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number join catalogs as t2 on t1....
{ "index": 69, "split": "train" }
Which are the first five departments that offer courses starting with "Bioinforma," including their building location, budget, and department name, sorted by building name with any departments lacking a building listed last?
college_2
select t0.building as c2, t0.budget, t0.dept_name from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.title like 'Bioinforma%' 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": "college_2", "sql": "select t0.building as c2, t0.budget, t0.dept_name from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.title like 'Bioinforma%' order by c2 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2121, "split": "train" }
Which campuses and years are included in either the campus founding records or the degree records?
csu_1
select anon_1.c1, anon_1.c0 from (select campus as c1, year as c0 from campuses union select campus, year from degrees) 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": "csu_1", "sql": "select anon_1.c1, anon_1.c0 from (select campus as c1, year as c0 from campuses union select campus, year from degrees) as anon_1" }, "style": "rule" }
{ "index": 1024, "split": "train" }
What is the difference between the total catalog level number of the catalog entry with ID 8 and the highest total catalog level number among all catalog entries whose capacity begins with "8"?
product_catalog
select t2.c0 - t0.c3 from (select max(t1.c3) as c0 from (select sum(t1.catalog_level_number) as c3 from catalog_contents as t0 join catalog_contents_additional_attributes as t1 on t0.catalog_entry_id = t1.catalog_entry_id where t0.capacity like '8%' group by t0.catalog_entry_id) as t1) as t2, (select t0.catalog_entry_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": "product_catalog", "sql": "select t2.c0 - t0.c3 from (select max(t1.c3) as c0 from (select sum(t1.catalog_level_number) as c3 from catalog_contents as t0 join catalog_contents_additional_attributes as t1 on t0.catalog_entry_id = t1.catalog_entry_id where t0.capacity like '8%' grou...
{ "index": 3173, "split": "train" }
What are the first five student first names and their highest number of hours (up to 42 hours) for students whose maximum hours do not exceed 42, sorted alphabetically by their first names?
college_1
select stu_fname as c0, max(stu_hrs) from student group by c0 having max(stu_hrs) <= 42 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": "college_1", "sql": "select stu_fname as c0, max(stu_hrs) from student group by c0 having max(stu_hrs) <= 42 order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 1432, "split": "train" }
How many operating companies are classified as corporate in the database?
flight_company
select count(*) from operate_company where type = 'Corporate'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(*) from operate_company where type = 'Corporate'" }, "style": "rule" }
{ "index": 1159, "split": "train" }
What are the ten highest gradepoints and their corresponding letter grades for grades that are either D or end with a hyphen, based on the grade conversions?
college_3
select t0.gradepoint as c0 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t1.grade = 'D' or t1.grade like '%-' 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": "college_3", "sql": "select t0.gradepoint as c0 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t1.grade = 'D' or t1.grade like '%-' order by c0 desc limit 10" }, "style": "rule" }
{ "index": 166, "split": "train" }
Which investors have both lots with an investor ID of 6 or less and transactions with an amount of 207,484,122.28 or less? Please provide their investor IDs and details.
tracking_share_transactions
select anon_1.c0, anon_1.c1 from (select t0.investor_id as c0, t0.investor_details as c1 from investors as t0 join lots as t1 on t0.investor_id = t1.investor_id where t1.investor_id <= 6 intersect select t0.investor_id as c0, t0.investor_details as c1 from investors as t0 join transactions as t1 on t0.investor_id = t1....
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select anon_1.c0, anon_1.c1 from (select t0.investor_id as c0, t0.investor_details as c1 from investors as t0 join lots as t1 on t0.investor_id = t1.investor_id where t1.investor_id <= 6 intersect select t0.investor_id as c0, t0.investor_deta...
{ "index": 1887, "split": "train" }