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 total sum of problem IDs, along with the product name and product ID, for each product where the lowest staff ID assigned in their problem logs is less than 4?
tracking_software_problems
select sum(t0.problem_id), t2.product_name, t2.product_id as c2 from problem_log as t0 join problems as t1 on t0.problem_id = t1.problem_id join product as t2 on t1.product_id = t2.product_id group by c2 having min(t0.assigned_to_staff_id) < 4
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select sum(t0.problem_id), t2.product_name, t2.product_id as c2 from problem_log as t0 join problems as t1 on t0.problem_id = t1.problem_id join product as t2 on t1.product_id = t2.product_id group by c2 having min(t0.assigned_to_staff_id) < 4...
{ "index": 1057, "split": "train" }
What are the names and IDs of the top 5 media types, ordered by the total sum of genre IDs for their tracks, considering only tracks with unit prices less than or equal to the combined total price of all tracks and belonging to media types 2 and 3?
store_1
select t0.name, t0.id as c3, sum(t1.genre_id) as c2 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id, (select sum(unit_price) as c0 from tracks) as t0 where t1.unit_price <= t0.c0 and t1.media_type_id between 2 and 3 group by c3 order by c2 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t0.name, t0.id as c3, sum(t1.genre_id) as c2 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id, (select sum(unit_price) as c0 from tracks) as t0 where t1.unit_price <= t0.c0 and t1.media_type_id between 2 and 3 group by c3 order by c2 d...
{ "index": 2383, "split": "train" }
For aircraft with a maximum distance of 3383 miles or less, what is the average distance flown, and which aircraft has the highest aid number?
flight_1
select avg(t0.distance), t1.aid as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.distance <= 3383 group by c0 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": "flight_1", "sql": "select avg(t0.distance), t1.aid as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.distance <= 3383 group by c0 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 2662, "split": "train" }
What is the percentage change in the number of unique visitors to the park from August 21, 2004, to August 15, 1990?
cre_Theme_park
select (count(distinct (t0.c1)) / cast(count(distinct (t1.c1)) as real) - 1) * 100 from (select sum(t1.tourist_id) as c1 from visitors as t0 join visits as t1 on t0.tourist_id = t1.tourist_id where t1.visit_date = '1990-08-15 14:24:10' group by t0.tourist_id) as t0, (select t0.tourist_id, sum(t1.tourist_id) as c1 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(distinct (t0.c1)) / cast(count(distinct (t1.c1)) as real) - 1) * 100 from (select sum(t1.tourist_id) as c1 from visitors as t0 join visits as t1 on t0.tourist_id = t1.tourist_id where t1.visit_date = '1990-08-15 14:24:10' group by t0.tourist...
{ "index": 3925, "split": "train" }
Which products with IDs of 3 or less have their product type codes and IDs listed, along with the average of their product IDs?
products_for_hire
select t0.product_type_code, t0.product_id as c1, avg(t1.product_id) from products_for_hire as t0 join view_product_availability as t1 on t0.product_id = t1.product_id where t1.product_id < 3 or t1.product_id <= 3 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": "products_for_hire", "sql": "select t0.product_type_code, t0.product_id as c1, avg(t1.product_id) from products_for_hire as t0 join view_product_availability as t1 on t0.product_id = t1.product_id where t1.product_id < 3 or t1.product_id <= 3 group by c1" }, "style": "rule" }
{ "index": 183, "split": "train" }
Can you find the first ten stations, ordered by their station IDs, that have at least ten bikes available or have the maximum number of bikes available across all stations? For each of these stations, what is their longitude, dock count, and station ID?
bike_1
select t0.long, t0.dock_count, t0.id from station as t0 join status as t1 on t0.id = t1.station_id, (select max(bikes_available) as c2 from status) as t0 where t1.bikes_available >= 10 or t1.bikes_available >= t0.c2 order by t1.station_id 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": "bike_1", "sql": "select t0.long, t0.dock_count, t0.id from station as t0 join status as t1 on t0.id = t1.station_id, (select max(bikes_available) as c2 from status) as t0 where t1.bikes_available >= 10 or t1.bikes_available >= t0.c2 order by t1.station_id asc nulls last limit 10"...
{ "index": 59, "split": "train" }
How many revenue entries are there for manufacturers based in Tokyo, and what are the top 10 headquarters with the most revenue records, sorted from highest to lowest?
manufactory_1
select headquarter as c1, count(revenue) as c0 from manufacturers where c1 = 'Tokyo' group by c1 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": "manufactory_1", "sql": "select headquarter as c1, count(revenue) as c0 from manufacturers where c1 = 'Tokyo' group by c1 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 2395, "split": "train" }
How many train lines in the Railway database were built by each builder?
railway
select count(builder) from railway
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "railway", "sql": "select count(builder) from railway" }, "style": "rule" }
{ "index": 2180, "split": "train" }
Among the students who are members of clubs whose names start with "Ten", who is the student from the city with the highest city code, and what are their last name and student ID?
club_1
select t0.lname, t0.stuid, t0.city_code as c0 from student as t0 join member_of_club as t1 on t0.stuid = t1.stuid join club as t2 on t1.clubid = t2.clubid where t2.clubname like 'Ten%' 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": "club_1", "sql": "select t0.lname, t0.stuid, t0.city_code as c0 from student as t0 join member_of_club as t1 on t0.stuid = t1.stuid join club as t2 on t1.clubid = t2.clubid where t2.clubname like 'Ten%' order by c0 desc limit 1" }, "style": "rule" }
{ "index": 2641, "split": "train" }
Can you find the personal name and author ID of the course author with ID 11, along with the total sum of their author IDs across courses and the number of unique subjects they teach? List the top 5 entries sorted by the total sum of author IDs in descending order.
e_learning
select sum(t0.author_id) as c1, count(distinct (t0.subject_id)), t1.personal_name, t1.author_id as c2 from courses as t0 join course_authors_and_tutors as t1 on t0.author_id = t1.author_id where c2 = 11 group by c2 order by c1 desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select sum(t0.author_id) as c1, count(distinct (t0.subject_id)), t1.personal_name, t1.author_id as c2 from courses as t0 join course_authors_and_tutors as t1 on t0.author_id = t1.author_id where c2 = 11 group by c2 order by c1 desc limit 5" }, "style": "r...
{ "index": 888, "split": "train" }
Can you list the names and times of the most recent five trains that pass through stations in Thurrock or stations with local authorities containing the letter "d"?
station_weather
select t0.name, t0.time as c0 from train as t0 join route as t1 on t0.id = t1.train_id join station as t2 on t1.station_id = t2.id where t2.local_authority = 'Thurrock' or t2.local_authority like '%d%' 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": "station_weather", "sql": "select t0.name, t0.time as c0 from train as t0 join route as t1 on t0.id = t1.train_id join station as t2 on t1.station_id = t2.id where t2.local_authority = 'Thurrock' or t2.local_authority like '%d%' order by c0 desc limit 5" }, "style": "rule" }
{ "index": 1988, "split": "train" }
What are the age, political party, driver ID, name, and home city of all drivers, including those who are associated with the school named 'St. Francis Assisi'?
school_bus
select anon_1.c4, anon_1.c1, anon_1.c3, anon_1.c0, anon_1.c2 from (select age as c4, party as c1, driver_id as c3, name as c0, home_city as c2 from driver union select t0.age as c4, t0.party as c1, t0.driver_id as c3, t0.name as c0, t0.home_city as c2 from driver as t0 join school_bus as t1 on t0.driver_id = t1.driver_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "school_bus", "sql": "select anon_1.c4, anon_1.c1, anon_1.c3, anon_1.c0, anon_1.c2 from (select age as c4, party as c1, driver_id as c3, name as c0, home_city as c2 from driver union select t0.age as c4, t0.party as c1, t0.driver_id as c3, t0.name as c0, t0.home_city as c2 from dr...
{ "index": 803, "split": "train" }
What is the percentage change in the highest overall rating of players with potential above 72 between players born on May 15, 1993, and those born on January 21, 1981?
soccer_1
select (max(t0.c1) / cast(max(t1.c1) as real) - 1) * 100 from (select t0.overall_rating as c1 from player_attributes as t0 join player as t1 on t0.player_api_id = t1.player_api_id where t1.birthday = '1981-01-21 00:00:00' and t0.potential > 72) as t0, (select t0.overall_rating as c1 from player_attributes as t0 join pl...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (max(t0.c1) / cast(max(t1.c1) as real) - 1) * 100 from (select t0.overall_rating as c1 from player_attributes as t0 join player as t1 on t0.player_api_id = t1.player_api_id where t1.birthday = '1981-01-21 00:00:00' and t0.potential > 72) as t0, (select t...
{ "index": 3048, "split": "train" }
Did the percentage change in the number of unique 'Hard Drive' documents received at 2005-09-30 00:10:02 exceed the percentage change for all other document types with descriptions starting with "f" received at the same time?
cre_Doc_Control_Systems
select abs((t2.c2 / cast(t2.c2 as real) - 1) * 100) > t1.c3 from (select count(distinct (t1.document_id)) as c2 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'Hard Drive' and t1.receipt_date = '2005-09-30 00:10:02' group by t0.document_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 abs((t2.c2 / cast(t2.c2 as real) - 1) * 100) > t1.c3 from (select count(distinct (t1.document_id)) as c2 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'Har...
{ "index": 3435, "split": "train" }
How many days are there between each employee's hire date and date of birth?
college_1
select julianday(t1.c2) - julianday(t0.c0) from (select emp_hiredate as c2 from employee) as t1, (select emp_dob as c0 from employee) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "college_1", "sql": "select julianday(t1.c2) - julianday(t0.c0) from (select emp_hiredate as c2 from employee) as t1, (select emp_dob as c0 from employee) as t0" }, "style": "rule" }
{ "index": 3676, "split": "train" }
What are the total sum of UIDs of their tweets and the user IDs for each user who is either the user with UID 4 or whose UID does not appear as a followee in the Follows table?
twitter_1
select sum(t0.uid), t1.uid as c1 from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid where (not c1 in (select follows.f2 as c2 from follows)) or c1 = 4 group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "twitter_1", "sql": "select sum(t0.uid), t1.uid as c1 from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid where (not c1 in (select follows.f2 as c2 from follows)) or c1 = 4 group by c1" }, "style": "rule" }
{ "index": 2410, "split": "train" }
Which three reviewers, listed in alphabetical order by their names, have rated the movie with the least common title in the database? Please include their reviewer IDs and names. --- This version makes clear that you're asking for the first three reviewers (by name) who rated the rarest movie title, aligning with wha...
movie_1
select t0.rid, t0.name as c2 from reviewer as t0 join rating as t1 on t0.rid = t1.rid join movie as t2 on t1.mid = t2.mid, (select title as c1 from movie group by c1 order by count(*) asc nulls last limit 1) as t0 where t2.title = t0.c1 order by c2 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "movie_1", "sql": "select t0.rid, t0.name as c2 from reviewer as t0 join rating as t1 on t0.rid = t1.rid join movie as t2 on t1.mid = t2.mid, (select title as c1 from movie group by c1 order by count(*) asc nulls last limit 1) as t0 where t2.title = t0.c1 order by c2 asc nulls las...
{ "index": 2202, "split": "train" }
For each chair whose name ends with "Ford," what is their name and how many years have they chaired festivals?
entertainment_awards
select chair_name as c0, count(year) from festival_detail where c0 like '%Ford' 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": "entertainment_awards", "sql": "select chair_name as c0, count(year) from festival_detail where c0 like '%Ford' group by c0" }, "style": "rule" }
{ "index": 1462, "split": "train" }
Can you provide the building IDs and their average height in feet for all buildings that are 160 feet tall or shorter?
protein_institute
select building_id as c1, avg(height_feet) from building where height_feet <= 160 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": "protein_institute", "sql": "select building_id as c1, avg(height_feet) from building where height_feet <= 160 group by c1" }, "style": "rule" }
{ "index": 131, "split": "train" }
Find the address ID and monthly rental for student addresses of students who have assessment notes recorded by teacher ID 10, and whose student IDs are greater than or equal to the smallest student ID among all assessment notes.
behavior_monitoring
select t0.address_id, t0.monthly_rental from student_addresses as t0 join students as t1 on t0.student_id = t1.student_id join assessment_notes as t2 on t1.student_id = t2.student_id, (select min(student_id) as c1 from assessment_notes) as t0 where t2.teacher_id = 10 and t2.student_id >= t0.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "behavior_monitoring", "sql": "select t0.address_id, t0.monthly_rental from student_addresses as t0 join students as t1 on t0.student_id = t1.student_id join assessment_notes as t2 on t1.student_id = t2.student_id, (select min(student_id) as c1 from assessment_notes) as t0 where t...
{ "index": 1732, "split": "train" }
Is the game ID associated with injury accident 15 higher than the game ID associated with injury accident 6, indicating that injury accident 15 occurred in a later game?
game_injury
select t1.c0 < t0.c0 from (select game_id as c0 from injury_accident where id = 6) as t1, (select game_id as c0 from injury_accident where id = 15) 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 t1.c0 < t0.c0 from (select game_id as c0 from injury_accident where id = 6) as t1, (select game_id as c0 from injury_accident where id = 15) as t0" }, "style": "rule" }
{ "index": 3568, "split": "train" }
What are the three media types with the fewest distinct albums that have at least five tracks and are of media type with ID 5? Please include the media type's name and ID, and order the results by the number of unique unit prices associated with their tracks, showing the least first.
store_1
select count(distinct (t0.album_id)), t1.name, t1.id as c1 from tracks as t0 join media_types as t1 on t0.media_type_id = t1.id where c1 = 5 or c1 = 5 group by c1 having count(*) >= 5 order by count(distinct (t0.unit_price)) asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select count(distinct (t0.album_id)), t1.name, t1.id as c1 from tracks as t0 join media_types as t1 on t0.media_type_id = t1.id where c1 = 5 or c1 = 5 group by c1 having count(*) >= 5 order by count(distinct (t0.unit_price)) asc nulls last limit 3" }, "style...
{ "index": 375, "split": "train" }
Can you list the IDs and names of browsers, along with the IDs of compatible accelerators and their earliest compatibility year, for web client accelerators whose names start with "CAC," sorted by the browser ID in descending order?
browser_web
select t0.id as c2, t0.name, t1.accelerator_id, t1.compatible_since_year from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id join web_client_accelerator as t2 on t1.accelerator_id = t2.id where t2.name like 'CAC%' order by c2 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "browser_web", "sql": "select t0.id as c2, t0.name, t1.accelerator_id, t1.compatible_since_year from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id join web_client_accelerator as t2 on t1.accelerator_id = t2.id where t2.name like 'CAC%' order by c...
{ "index": 2905, "split": "train" }
For the top three most recent project start dates, what are the project IDs and the start dates of grants awarded to organizations, where the associated documents' descriptions either contain the letter "r" or are the most common document description across all documents?
tracking_grants_for_research
select t0.date_from as c1, t0.project_id, t3.grant_start_date from project_staff as t0 join projects as t1 on t0.project_id = t1.project_id join organisations as t2 on t1.organisation_id = t2.organisation_id join grants as t3 on t2.organisation_id = t3.organisation_id join documents as t4 on t3.grant_id = t4.grant_id j...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t0.date_from as c1, t0.project_id, t3.grant_start_date from project_staff as t0 join projects as t1 on t0.project_id = t1.project_id join organisations as t2 on t1.organisation_id = t2.organisation_id join grants as t3 on t2.organisat...
{ "index": 68, "split": "train" }
What are the names and principal activities of the top three operating companies that have flights at airports with IATA codes containing "O", ordered alphabetically by the company's name?
flight_company
select t0.name as c0, t0.principal_activities from operate_company as t0 join flight as t1 on t0.id = t1.company_id join airport as t2 on t1.airport_id = t2.id where t2.iata like '%O%' order by c0 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_company", "sql": "select t0.name as c0, t0.principal_activities from operate_company as t0 join flight as t1 on t0.id = t1.company_id join airport as t2 on t1.airport_id = t2.id where t2.iata like '%O%' order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 2424, "split": "train" }
Can you list the principal activities, names, and IDs of companies involved in operations whose names contain the letter "i" or the phrase "ific Carg"?
flight_company
select principal_activities, name as c0, id from operate_company where c0 like '%i%' or c0 like '%ific Carg%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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, name as c0, id from operate_company where c0 like '%i%' or c0 like '%ific Carg%'" }, "style": "rule" }
{ "index": 1413, "split": "train" }
Which staff members, whose last names end with "locko," have the highest number of unique first names among such staff, and who are the top three when listed in reverse alphabetical order by their first names?
tracking_software_problems
select staff_first_name as c1, count(distinct (staff_first_name)) from staff where staff_last_name like '%locko' group by c1 order by c1 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select staff_first_name as c1, count(distinct (staff_first_name)) from staff where staff_last_name like '%locko' group by c1 order by c1 desc limit 3" }, "style": "rule" }
{ "index": 2643, "split": "train" }
Which genders and dorm names have amenities that are either the most common in the dorms or have names that contain "ud"?
dorm_1
select t0.gender, t0.dorm_name from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid join dorm_amenity as t2 on t1.amenid = t2.amenid, (select amenity_name as c1 from dorm_amenity group by c1 order by count(*) desc limit 1) as t0 where t2.amenity_name = t0.c1 or t2.amenity_name like '%ud%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select t0.gender, t0.dorm_name from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid join dorm_amenity as t2 on t1.amenid = t2.amenid, (select amenity_name as c1 from dorm_amenity group by c1 order by count(*) desc limit 1) as t0 where t2.amenity_name =...
{ "index": 2717, "split": "train" }
Which party IDs are associated with services that have an ID of 5 or higher?
e_government
select t0.party_id from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t1.service_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": "e_government", "sql": "select t0.party_id from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t1.service_id >= 5" }, "style": "rule" }
{ "index": 903, "split": "train" }
What are the majors, student IDs, and advisors of student 1021, who has allergies listed that are all recognized allergy types?
allergy_1
select anon_1.c3, anon_1.c0, anon_1.c2 from (select t0.major as c3, t0.stuid as c0, t0.advisor as c2 from student as t0 join has_allergy as t1 on t0.stuid = t1.stuid where t1.stuid = 1021 except select t0.major as c3, t0.stuid as c0, t0.advisor as c2 from student as t0 join has_allergy as t1 on t0.stuid = t1.stuid wher...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "allergy_1", "sql": "select anon_1.c3, anon_1.c0, anon_1.c2 from (select t0.major as c3, t0.stuid as c0, t0.advisor as c2 from student as t0 join has_allergy as t1 on t0.stuid = t1.stuid where t1.stuid = 1021 except select t0.major as c3, t0.stuid as c0, t0.advisor as c2 from stud...
{ "index": 2984, "split": "train" }
Can you list the top three combinations of software platform, device name, stock device ID, and stock shop ID for shops that either opened before 2009 or opened after the earliest opening year among shops located in places starting with 'D', ordered by shop ID from highest to lowest?
device
select t0.software_platform, t0.device, t1.device_id, t1.shop_id as c4 from device as t0 join stock as t1 on t0.device_id = t1.device_id join shop as t2 on t1.shop_id = t2.shop_id, (select min(open_year) as c1 from shop where location like 'D%') as t0 where t2.open_year < 2009 or t2.open_year > t0.c1 order by c4 desc l...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "device", "sql": "select t0.software_platform, t0.device, t1.device_id, t1.shop_id as c4 from device as t0 join stock as t1 on t0.device_id = t1.device_id join shop as t2 on t1.shop_id = t2.shop_id, (select min(open_year) as c1 from shop where location like 'D%') as t0 where t2.op...
{ "index": 1445, "split": "train" }
Can you provide a list of all names that belong to either managers or trains?
railway
select anon_1.c0 from (select name as c0 from manager union select name from train) 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": "railway", "sql": "select anon_1.c0 from (select name as c0 from manager union select name from train) as anon_1" }, "style": "rule" }
{ "index": 1854, "split": "train" }
What is the percentage increase or decrease in the number of unique policies per customer between January 1, 2017, and September 5, 2018?
insurance_and_eClaims
select (count(distinct (t0.c1)) / cast(count(distinct (t1.c1)) as real) - 1) * 100 from (select count(distinct (t1.policy_id)) as c1 from customers as t0 join policies as t1 on t0.customer_id = t1.customer_id where t1.start_date = '2018-09-05 22:15:23' group by t0.customer_id) as t0, (select t0.customer_id, count(disti...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_and_eClaims", "sql": "select (count(distinct (t0.c1)) / cast(count(distinct (t1.c1)) as real) - 1) * 100 from (select count(distinct (t1.policy_id)) as c1 from customers as t0 join policies as t1 on t0.customer_id = t1.customer_id where t1.start_date = '2018-09-05 22:15...
{ "index": 3037, "split": "train" }
When looking at Alice's friendships with people whose names include 'B', what is her rank from most recent to oldest based on when the friendship occurred?
network_2
select t1.c4, t1.c2 as c5 from (select row_number() over (order by year desc) as c4, name as c2 from personfriend where friend like '%B%') as t1 where c5 = 'Alice'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t1.c4, t1.c2 as c5 from (select row_number() over (order by year desc) as c4, name as c2 from personfriend where friend like '%B%') as t1 where c5 = 'Alice'" }, "style": "rule" }
{ "index": 3494, "split": "train" }
Can you provide the Actid and Activity Name for all activities, including those that students with last names starting with "Schul" are participating in?
activity_1
select anon_1.c1, anon_1.c0 from (select actid as c1, activity_name as c0 from activity union select t0.actid as c1, t0.activity_name as c0 from activity as t0 join participates_in as t1 on t0.actid = t1.actid join student as t2 on t1.stuid = t2.stuid where t2.lname like 'Schul%') 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": "activity_1", "sql": "select anon_1.c1, anon_1.c0 from (select actid as c1, activity_name as c0 from activity union select t0.actid as c1, t0.activity_name as c0 from activity as t0 join participates_in as t1 on t0.actid = t1.actid join student as t2 on t1.stuid = t2.stuid where t...
{ "index": 240, "split": "train" }
How many purchase transactions have been recorded in the database?
tracking_share_transactions
select count(*) from purchases
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(*) from purchases" }, "style": "rule" }
{ "index": 969, "split": "train" }
How many inventory items are available at store 1?
sakila_1
select count(*) from inventory where store_id = 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "sakila_1", "sql": "select count(*) from inventory where store_id = 1" }, "style": "rule" }
{ "index": 1606, "split": "train" }
Which colors and their descriptions are associated with at least two different products, excluding product 6?
products_gen_characteristics
select t0.color_description, t0.color_code as c1 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where (not t1.product_id in (select product_characteristics.product_id as c2 from product_characteristics where product_characteristics.product_id = 6 or product_characteristics.product_id = 6)) g...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select t0.color_description, t0.color_code as c1 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where (not t1.product_id in (select product_characteristics.product_id as c2 from product_characteristics where produ...
{ "index": 1359, "split": "train" }
Who are the three students living in the largest dorms that have amenities with `amenid` equal to the highest `amenid` (at least 904) for dorm 104, or any amenity with `amenid` 904 or higher? Please include their student IDs, dorm IDs, dorm names, and capacities, sorted by the largest dorm capacities.
dorm_1
select t0.stuid, t0.dormid, t1.dorm_name, t1.student_capacity as c2 from lives_in as t0 join dorm as t1 on t0.dormid = t1.dormid join has_amenity as t2 on t1.dormid = t2.dormid, (select max(amenid) as c4 from has_amenity where amenid >= 904 and dormid = 104) as t0 where t2.amenid = t0.c4 or t2.amenid >= 904 order by c2...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "dorm_1", "sql": "select t0.stuid, t0.dormid, t1.dorm_name, t1.student_capacity as c2 from lives_in as t0 join dorm as t1 on t0.dormid = t1.dormid join has_amenity as t2 on t1.dormid = t2.dormid, (select max(amenid) as c4 from has_amenity where amenid >= 904 and dormid = 104) as t...
{ "index": 2469, "split": "train" }
Which host's ID and name, along with their associated party's ID, participated in parties that started in the year 2000 or 1999, and who has the highest host ID among these?
party_host
select t0.host_id, t0.name, t1.host_id as c2 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.first_year like '200%' or t2.first_year like '%1999%' order by c2 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "party_host", "sql": "select t0.host_id, t0.name, t1.host_id as c2 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.first_year like '200%' or t2.first_year like '%1999%' order by c2 desc limit 1" }, "style"...
{ "index": 317, "split": "train" }
maintains all necessary details and sounds more natural and conversational.
machine_repair
select t0.machine_id as c0, t0.machine_series, t0.quality_rank from machine as t0 join repair_assignment as t1 on t0.machine_id = t1.machine_id join technician as t2 on t1.technician_id = t2.technician_id where t2.name like '%Sew%' or t2.name like 'Jo%' 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": "machine_repair", "sql": "select t0.machine_id as c0, t0.machine_series, t0.quality_rank from machine as t0 join repair_assignment as t1 on t0.machine_id = t1.machine_id join technician as t2 on t1.technician_id = t2.technician_id where t2.name like '%Sew%' or t2.name like 'Jo%' o...
{ "index": 2588, "split": "train" }
What are the project code, the number of hours allocated to each project, and the name of the scientist with SSN 123234877?
scientist_1
select t0.code, t0.hours, t1.scientist from projects as t0 join assignedto as t1 on t0.code = t1.project join scientists as t2 on t1.scientist = t2.ssn where t2.ssn = 123234877
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "scientist_1", "sql": "select t0.code, t0.hours, t1.scientist from projects as t0 join assignedto as t1 on t0.code = t1.project join scientists as t2 on t1.scientist = t2.ssn where t2.ssn = 123234877" }, "style": "rule" }
{ "index": 423, "split": "train" }
What is the percentage change in the sum of problem IDs for all logs assigned to staff with IDs of 8 or less at 11:30:53 PM on November 12, 2011?
tracking_software_problems
select (sum(problem_id) / cast(sum(problem_id) as real) - 1) * 100 from problem_log where log_entry_date = '2011-11-12 23:30:53' and assigned_to_staff_id <= 8
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select (sum(problem_id) / cast(sum(problem_id) as real) - 1) * 100 from problem_log where log_entry_date = '2011-11-12 23:30:53' and assigned_to_staff_id <= 8" }, "style": "rule" }
{ "index": 3060, "split": "train" }
For each country, what is the highest mountain ID among climbers, excluding those who have climbed mountains named starting with "Mount Kenya" or containing "enzi (Hans"?
climbing
select country as c2, max(mountain_id) from climber where (not name in (select name as c1 from mountain where name like 'Mount Kenya%' or name like '%enzi (Hans%')) group by c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "climbing", "sql": "select country as c2, max(mountain_id) from climber where (not name in (select name as c1 from mountain where name like 'Mount Kenya%' or name like '%enzi (Hans%')) group by c2" }, "style": "rule" }
{ "index": 2668, "split": "train" }
Which supplier ranks third in total value purchased, considering only those whose purchase sums are between 8,042.78 and 67,216.31, when suppliers are ordered from highest to lowest total value?
department_store
select t1.c5, t1.c3 as c0 from (select row_number() over (order by t0.c4 desc) as c5, t0.c2 as c3 from (select t0.supplier_id as c2, sum(t1.total_value_purchased) as c4 from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id where t1.total_value_purchased between 8042.78 and 67216.31 group ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select t1.c5, t1.c3 as c0 from (select row_number() over (order by t0.c4 desc) as c5, t0.c2 as c3 from (select t0.supplier_id as c2, sum(t1.total_value_purchased) as c4 from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id...
{ "index": 3479, "split": "train" }
Which students have taken courses with 4 or more credits in departments whose names start with "Athletic," and what are their total credits and names?
college_2
select t0.tot_cred, t0.name from student as t0 join department as t1 on t0.dept_name = t1.dept_name join course as t2 on t1.dept_name = t2.dept_name where t2.credits >= 4 and t2.dept_name like 'Athletic%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.tot_cred, t0.name from student as t0 join department as t1 on t0.dept_name = t1.dept_name join course as t2 on t1.dept_name = t2.dept_name where t2.credits >= 4 and t2.dept_name like 'Athletic%'" }, "style": "rule" }
{ "index": 649, "split": "train" }
For each host, how many parties have they participated in?
party_host
select host_id as c1, count(party_id) from party_host 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": "party_host", "sql": "select host_id as c1, count(party_id) from party_host group by c1" }, "style": "rule" }
{ "index": 1517, "split": "train" }
Which aircraft description has the fewest number of aircraft, and how many aircraft are there with that description, specifically for aircraft described as "Light utility helicopter"?
aircraft
select description as c1, count(aircraft) as c0 from aircraft where c1 = 'Light utility helicopter' group by c1 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "aircraft", "sql": "select description as c1, count(aircraft) as c0 from aircraft where c1 = 'Light utility helicopter' group by c1 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 2251, "split": "train" }
What are the Customer IDs, Account IDs, and other account details, along with the Card IDs and transaction types, for all accounts involved in financial transactions made with customer cards whose card type includes "red"?
customers_card_transactions
select t0.customer_id, t0.account_id, t0.other_account_details, t1.card_id, t1.transaction_type from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id join customers_cards as t2 on t1.card_id = t2.card_id where t2.card_type_code like '%red%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select t0.customer_id, t0.account_id, t0.other_account_details, t1.card_id, t1.transaction_type from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id join customers_cards as t2 on t1.card_id = t2.card_id where...
{ "index": 1174, "split": "train" }
For each person, what is the total height, ordered from the highest to the lowest person ID?
entrepreneur
select sum(height) from people group by people_id order by people_id desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "entrepreneur", "sql": "select sum(height) from people group by people_id order by people_id desc" }, "style": "rule" }
{ "index": 1959, "split": "train" }
Which track with media type ID 3 has the name that comes last in reverse alphabetical order?
store_1
select t0.name as c0 from tracks as t0 join media_types as t1 on t0.media_type_id = t1.id where t1.id = 3 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": "store_1", "sql": "select t0.name as c0 from tracks as t0 join media_types as t1 on t0.media_type_id = t1.id where t1.id = 3 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 2490, "split": "train" }
For the patient with SSN 100000004, list up to ten phone numbers that have no more than three unique primary care physicians (PCPs), sorted by the number of different PCPs in ascending order.
hospital_1
select phone as c0 from patient where ssn = 100000004 group by c0 having count(distinct (pcp)) <= 3 order by count(distinct (pcp)) 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": "hospital_1", "sql": "select phone as c0 from patient where ssn = 100000004 group by c0 having count(distinct (pcp)) <= 3 order by count(distinct (pcp)) asc nulls last limit 10" }, "style": "rule" }
{ "index": 984, "split": "train" }
What is the difference between artist ID 95 and 213?
store_1
select t0.c2 - 213 from (select max(t1.artist_id) as c2 from artists as t0 join albums as t1 on t0.id = t1.artist_id where t0.id = 95 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": "store_1", "sql": "select t0.c2 - 213 from (select max(t1.artist_id) as c2 from artists as t0 join albums as t1 on t0.id = t1.artist_id where t0.id = 95 group by t0.id) as t0" }, "style": "rule" }
{ "index": 3254, "split": "train" }
Which customers have transactions less than $1,529.97, and what are their customer IDs, card numbers, and the expiration dates of those cards?
customers_card_transactions
select distinct t0.customer_id, t0.card_number, t0.date_valid_to from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.transaction_amount < 1529.97
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct t0.customer_id, t0.card_number, t0.date_valid_to from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.transaction_amount < 1529.97" }, "style": "rule" }
{ "index": 266, "split": "train" }
How many journals have sales of exactly 1232?
journal_committee
select count(*) from journal where sales = 1232
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "journal_committee", "sql": "select count(*) from journal where sales = 1232" }, "style": "rule" }
{ "index": 1638, "split": "train" }
What are the distinct city, country, ZIP/postcode, and customer ID details for the customer with ID 10?
customers_and_addresses
select distinct t0.city, t0.country, t0.zip_postcode, t1.customer_id as c1 from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id where c1 = 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select distinct t0.city, t0.country, t0.zip_postcode, t1.customer_id as c1 from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id where c1 = 10" }, "style": "rule" }
{ "index": 309, "split": "train" }
Find the three users with the smallest user IDs who have at most one tweet, have more than 6,662,425 followers, and belong to partition IDs 10 or higher. For each, indicate how many unique tweets they posted and their followers count.
twitter_1
select count(distinct (t0.uid)), t1.followers as c0 from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid where c0 > 6662425 and t1.partitionid >= 10 group by t1.uid having count(*) <= 1 order by t1.uid 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": "twitter_1", "sql": "select count(distinct (t0.uid)), t1.followers as c0 from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid where c0 > 6662425 and t1.partitionid >= 10 group by t1.uid having count(*) <= 1 order by t1.uid asc nulls last limit 3" }, "style": "rule" }
{ "index": 2022, "split": "train" }
What is the catalog level number for the entry with ID 2?
product_catalog
select catalog_level_number from catalog_contents_additional_attributes where catalog_entry_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": "product_catalog", "sql": "select catalog_level_number from catalog_contents_additional_attributes where catalog_entry_id = 2" }, "style": "rule" }
{ "index": 3390, "split": "train" }
What are the most recent five apartments along with their apartment ID, number of bedrooms, and number of bathrooms, including their booking status and start date, for guests whose gender code ends with "ale?
apartment_rentals
select t0.apt_id, t0.bedroom_count, t0.bathroom_count, t1.booking_status_code, t1.booking_start_date as c1 from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.gender_code like '%ale' 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": "apartment_rentals", "sql": "select t0.apt_id, t0.bedroom_count, t0.bathroom_count, t1.booking_status_code, t1.booking_start_date as c1 from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.gender_code ...
{ "index": 2347, "split": "train" }
What are the store names, department store IDs, and department store chain IDs for all department stores, including those that belong to chains with names ending in "t"?
department_store
select anon_1.c1, anon_1.c2, anon_1.c0 from (select store_name as c1, dept_store_id as c2, dept_store_chain_id as c0 from department_stores union select t0.store_name as c1, t0.dept_store_id as c2, t0.dept_store_chain_id as c0 from department_stores as t0 join department_store_chain as t1 on t0.dept_store_chain_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": "department_store", "sql": "select anon_1.c1, anon_1.c2, anon_1.c0 from (select store_name as c1, dept_store_id as c2, dept_store_chain_id as c0 from department_stores union select t0.store_name as c1, t0.dept_store_id as c2, t0.dept_store_chain_id as c0 from department_stores as ...
{ "index": 478, "split": "train" }
What is the numerical difference between 114 and the largest customer ID among those who complained about product 117?
customer_complaints
select t0.c0 - 114 from (select max(t1.customer_id) as c0 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 117 group by t0.product_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customer_complaints", "sql": "select t0.c0 - 114 from (select max(t1.customer_id) as c0 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 117 group by t0.product_id) as t0" }, "style": "rule" }
{ "index": 3221, "split": "train" }
Can you list the names of countries and their leagues where the country's ID is at least 10257, but excluding any leagues that have the same name as a country?
soccer_1
select t0.name as c0, t1.name as c1 from country as t0 join league as t1 on t0.id = t1.country_id where t1.country_id >= 10257 and (not c1 in (select c0 as c0 from country))
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select t0.name as c0, t1.name as c1 from country as t0 join league as t1 on t0.id = t1.country_id where t1.country_id >= 10257 and (not c1 in (select c0 as c0 from country))" }, "style": "rule" }
{ "index": 2699, "split": "train" }
What are the years of the first five events when the events are sorted alphabetically by their names?
swimming
select year from event order by name asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "swimming", "sql": "select year from event order by name asc nulls last limit 5" }, "style": "rule" }
{ "index": 2551, "split": "train" }
What is the difference between the total sum of customer IDs for customer 3 and the number 8?
tracking_orders
select t0.c0 - 8 from (select sum(t1.customer_id) as c0 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 3 group by t0.customer_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.c0 - 8 from (select sum(t1.customer_id) as c0 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 3 group by t0.customer_id) as t0" }, "style": "rule" }
{ "index": 3258, "split": "train" }
What are the different acceptance results and their associated submission ID for the submission with ID 3?
workshop_paper
select distinct result, submission_id as c1 from acceptance where c1 = 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": "workshop_paper", "sql": "select distinct result, submission_id as c1 from acceptance where c1 = 3" }, "style": "rule" }
{ "index": 974, "split": "train" }
How many countries are represented among the airports involved, and how many unique source airports have routes to destinations with an airport ID greater than 2927?
flight_4
select count(t0.country), count(distinct (t1.src_ap)) from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.dst_apid > 2927
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(t0.country), count(distinct (t1.src_ap)) from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.dst_apid > 2927" }, "style": "rule" }
{ "index": 464, "split": "train" }
Show the Employee ID, Salary, Name, and Aircraft ID for employees who do not have a certification for any aircraft that is scheduled for a flight.
flight_1
select t0.eid, t0.salary, t0.name, t1.aid as c1 from employee as t0 join certificate as t1 on t0.eid = t1.eid where (not c1 in (select flight.aid as c0 from flight))
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.eid, t0.salary, t0.name, t1.aid as c1 from employee as t0 join certificate as t1 on t0.eid = t1.eid where (not c1 in (select flight.aid as c0 from flight))" }, "style": "rule" }
{ "index": 935, "split": "train" }
List the names of the top three railways sorted alphabetically, making sure that any null railway names appear last.
railway
select railway as c0 from railway order by c0 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "railway", "sql": "select railway as c0 from railway order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 611, "split": "train" }
Can you list the short names and descriptions of the top 10 buildings that have apartments with a room count starting with '8', sorted in reverse alphabetical order by their descriptions?
apartment_rentals
select t0.building_short_name, t0.building_description as c0 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.room_count like '8%' 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": "apartment_rentals", "sql": "select t0.building_short_name, t0.building_description as c0 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.room_count like '8%' order by c0 desc limit 10" }, "style": "rule" }
{ "index": 94, "split": "train" }
How much did the maximum total amount spent by any student increase or decrease between 2017-10-08 at 13:00:30 and 2017-10-09 at 18:15:00? Specifically, what is the percentage change in the highest amount spent by a student between these two times?
restaurant_1
select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select sum(t1.spent) as c0 from student as t0 join visits_restaurant as t1 on t0.stuid = t1.stuid where t1.time = '2017-10-09 18:15:00' group by t0.stuid) as t0, (select t0.stuid, sum(t1.spent) as c0 from student as t0 join visits_restaurant as t1 on t0.stu...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "restaurant_1", "sql": "select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select sum(t1.spent) as c0 from student as t0 join visits_restaurant as t1 on t0.stuid = t1.stuid where t1.time = '2017-10-09 18:15:00' group by t0.stuid) as t0, (select t0.stuid, sum(t1.spent) ...
{ "index": 3045, "split": "train" }
Which five artists from the USA or whose country names end with "K" have the highest number of distinct song ratings, and what is that number for each? Please list them in alphabetical order by their names.
music_1
select count(distinct (t0.rating)), t1.artist_name as c1 from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where t1.country = 'USA' or t1.country like '%K' group by c1 order by c1 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select count(distinct (t0.rating)), t1.artist_name as c1 from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where t1.country = 'USA' or t1.country like '%K' group by c1 order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 304, "split": "train" }
What are the customer IDs and their total savings balances, grouped by customer ID?
small_bank_1
select custid as c1, sum(balance) from savings group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select custid as c1, sum(balance) from savings group by c1" }, "style": "rule" }
{ "index": 831, "split": "train" }
Based on the minimum card ID within the date range from February 28, 2018, to March 12, 2018, where does the card with ID 6 rank when the cards are ordered from highest to lowest?
customers_card_transactions
select t1.c4, t1.c1 as c2 from (select row_number() over (order by t0.c0 desc) as c4, t0.c3 as c1 from (select t0.card_id as c3, min(t1.card_id) as c0 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t0.date_valid_to between '2018-02-28 22:26:31' and '2018-03-12 02:16:45' gr...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t1.c4, t1.c1 as c2 from (select row_number() over (order by t0.c0 desc) as c4, t0.c3 as c1 from (select t0.card_id as c3, min(t1.card_id) as c0 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id whe...
{ "index": 3478, "split": "train" }
What are the country, zip code, and administrative region of the addresses, along with the staff IDs for the five lessons involving vehicles whose details start with "V," sorted by staff ID from smallest to largest?
driving_school
select t0.country, t0.zip_postcode, t0.state_province_county, t2.staff_id as c3 from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id join lessons as t2 on t1.customer_id = t2.customer_id join vehicles as t3 on t2.vehicle_id = t3.vehicle_id where t3.vehicle_details like 'V%' order by c3 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": "driving_school", "sql": "select t0.country, t0.zip_postcode, t0.state_province_county, t2.staff_id as c3 from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id join lessons as t2 on t1.customer_id = t2.customer_id join vehicles as t3 on t2.vehicle_id ...
{ "index": 2970, "split": "train" }
Which 10 student phone numbers are associated with the highest maximum GPAs, when grouped by student phone?
college_1
select stu_phone as c0 from student group by c0 order by max(stu_gpa) 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 stu_phone as c0 from student group by c0 order by max(stu_gpa) desc limit 10" }, "style": "rule" }
{ "index": 1300, "split": "train" }
Among the countries that have the letter "a" in their name, which one hosts the largest number of unique airlines?
flight_4
select t0.c1 as c0, count(distinct (t0.c2)) as c3 from (select country as c1, alid as c2 from airlines where c1 like '%a%') as t0 group by c0 order by c3 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_4", "sql": "select t0.c1 as c0, count(distinct (t0.c2)) as c3 from (select country as c1, alid as c2 from airlines where c1 like '%a%') as t0 group by c0 order by c3 desc limit 1" }, "style": "rule" }
{ "index": 3656, "split": "train" }
For each store, what is the smallest district ID associated with it, considering only districts with IDs greater than 4?
store_product
select store_id as c0, min(district_id) from store_district where district_id > 4 group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select store_id as c0, min(district_id) from store_district where district_id > 4 group by c0" }, "style": "rule" }
{ "index": 1877, "split": "train" }
Which are the first three restaurant types (by their type ID) associated with restaurants that have an ID of 1 or less? List their type IDs and descriptions.
restaurant_1
select t0.restypeid as c0, t0.restypedescription from restaurant_type as t0 join type_of_restaurant as t1 on t0.restypeid = t1.restypeid join restaurant as t2 on t1.resid = t2.resid join visits_restaurant as t3 on t2.resid = t3.resid where t3.resid <= 1 order by c0 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "restaurant_1", "sql": "select t0.restypeid as c0, t0.restypedescription from restaurant_type as t0 join type_of_restaurant as t1 on t0.restypeid = t1.restypeid join restaurant as t2 on t1.resid = t2.resid join visits_restaurant as t3 on t2.resid = t3.resid where t3.resid <= 1 ord...
{ "index": 1134, "split": "train" }
Who are the students with 120 study hours who have the highest GPA, and what are their dates of birth?
college_1
select t0.stu_dob, t0.stu_gpa as c1 from student as t0, (select max(stu_gpa) as c0 from student where stu_hrs = 120) 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": "college_1", "sql": "select t0.stu_dob, t0.stu_gpa as c1 from student as t0, (select max(stu_gpa) as c0 from student where stu_hrs = 120) as t1 where c1 = t1.c0" }, "style": "rule" }
{ "index": 3749, "split": "train" }
Which names belong to either trains or managers?
railway
select anon_1.c1 from (select name as c1 from train union select name from manager) 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": "railway", "sql": "select anon_1.c1 from (select name as c1 from train union select name from manager) as anon_1" }, "style": "rule" }
{ "index": 2743, "split": "train" }
List the names, birthdays, and IDs of players who have an overall rating of at least 79.
soccer_1
select t0.player_name, t0.birthday from player as t0 join player_attributes as t1 on t0.player_api_id = t1.player_api_id where t1.overall_rating >= 79 or t1.overall_rating > 80
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "soccer_1", "sql": "select t0.player_name, t0.birthday from player as t0 join player_attributes as t1 on t0.player_api_id = t1.player_api_id where t1.overall_rating >= 79 or t1.overall_rating > 80" }, "style": "rule" }
{ "index": 2764, "split": "train" }
Which treatments and physicians are associated with the most frequently performed procedure, combined with those procedures that cost no more than 1500?
hospital_1
select anon_1.c2, anon_1.c0 from (select t0.treatment as c2, t0.physician as c0 from trained_in as t0 join procedures as t1 on t0.treatment = t1.code, (select name as c1 from procedures group by c1 order by count(*) asc nulls last limit 1) as t1 where t1.name = t1.c1 union select t0.treatment as c2, t0.physician as 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": "hospital_1", "sql": "select anon_1.c2, anon_1.c0 from (select t0.treatment as c2, t0.physician as c0 from trained_in as t0 join procedures as t1 on t0.treatment = t1.code, (select name as c1 from procedures group by c1 order by count(*) asc nulls last limit 1) as t1 where t1.name...
{ "index": 2172, "split": "train" }
What is the average customer ID for orders shipped with tracking number 1334 or with the most frequently used shipment tracking number?
tracking_orders
select avg(t0.customer_id) from orders as t0 join shipments as t1 on t0.order_id = t1.order_id, (select shipment_tracking_number as c1 from shipments group by c1 order by count(*) desc limit 1) as t0 where t1.shipment_tracking_number = 1334 or t1.shipment_tracking_number = t0.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select avg(t0.customer_id) from orders as t0 join shipments as t1 on t0.order_id = t1.order_id, (select shipment_tracking_number as c1 from shipments group by c1 order by count(*) desc limit 1) as t0 where t1.shipment_tracking_number = 1334 or t1.shipmen...
{ "index": 403, "split": "train" }
Which form name has the highest number of entries and form IDs, when listing all forms in reverse alphabetical order?
e_government
select form_name as c0, count(*), count(form_id) from forms group by c0 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": "e_government", "sql": "select form_name as c0, count(*), count(form_id) from forms group by c0 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 2900, "split": "train" }
For each gymnast, what are their top three highest total scores among those who scored more on the horizontal bar than the total number of horizontal bar score entries, sorted from highest to lowest?
gymnast
select t0.gymnast_id as c2, max(t0.total_points) as c0 from gymnast as t0, (select count(horizontal_bar_points) as c1 from gymnast) as t0 where t0.horizontal_bar_points > t0.c1 group by c2 order by c0 asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "gymnast", "sql": "select t0.gymnast_id as c2, max(t0.total_points) as c0 from gymnast as t0, (select count(horizontal_bar_points) as c1 from gymnast) as t0 where t0.horizontal_bar_points > t0.c1 group by c2 order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 2306, "split": "train" }
How many different ranks do captains of ships with IDs greater than or equal to 4 have at each age, for the top 10 oldest ages?
ship_1
select age as c0, count(distinct (rank)) from captain where ship_id >= 4 group by c0 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": "ship_1", "sql": "select age as c0, count(distinct (rank)) from captain where ship_id >= 4 group by c0 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 2698, "split": "train" }
For the party with ID 12, what is the total sum of customer IDs linked to services with IDs 3 or higher?
e_government
select t0.c1 from (select sum(t1.customer_id) as c1 from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t0.party_id = 12 and t1.service_id >= 3 group by t0.party_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": "e_government", "sql": "select t0.c1 from (select sum(t1.customer_id) as c1 from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t0.party_id = 12 and t1.service_id >= 3 group by t0.party_id) as t0" }, "style": "rule" }
{ "index": 3378, "split": "train" }
Which are the three most recent parties hosted by Carlos Delfino, and what are their locations, IDs, and the years they took place?
party_host
select t0.location, t0.party_id, t0.last_year as c0 from party as t0 join party_host as t1 on t0.party_id = t1.party_id join host as t2 on t1.host_id = t2.host_id where t2.name = 'Carlos Delfino' order by c0 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "party_host", "sql": "select t0.location, t0.party_id, t0.last_year as c0 from party as t0 join party_host as t1 on t0.party_id = t1.party_id join host as t2 on t1.host_id = t2.host_id where t2.name = 'Carlos Delfino' order by c0 desc limit 3" }, "style": "rule" }
{ "index": 2690, "split": "train" }
Who are the three customers with the highest number of products in their orders, and what are their IDs, names, and the total count of products they have ordered?
tracking_orders
select t0.customer_id as c2, t0.customer_name, count(t2.product_id) as c0 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id group by c2 order by c0 desc limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.customer_id as c2, t0.customer_name, count(t2.product_id) as c0 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id group by c2 order by c0 desc limit 3" }, "style": ...
{ "index": 554, "split": "train" }
Which address and city are associated with students who registered for courses between November 7 and November 8, 2008, or on or after November 6, 2008, and among these, which one has the highest address ID?
student_assessment
select t0.address_id as c2, t0.city, t1.address_id from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id join people as t2 on t1.person_id = t2.person_id join students as t3 on t2.person_id = t3.student_id join student_course_registrations as t4 on t3.student_id = t4.student_id where t4.regi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select t0.address_id as c2, t0.city, t1.address_id from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id join people as t2 on t1.person_id = t2.person_id join students as t3 on t2.person_id = t3.student_id join student_cour...
{ "index": 428, "split": "train" }
Which three origins send the most flights, where the destination either ends with "C." or starts with "Los An"?
flight_1
select origin as c0 from flight where destination like '%C.' or destination like 'Los An%' group by c0 order by count(price) 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": "flight_1", "sql": "select origin as c0 from flight where destination like '%C.' or destination like 'Los An%' group by c0 order by count(price) desc limit 3" }, "style": "rule" }
{ "index": 1404, "split": "train" }
Who are the parties, their comptrollers, and the delegates involved in elections held in counties with populations under 87,200?
election
select t0.party, t0.comptroller, t1.delegate from party as t0 join election as t1 on t0.party_id = t1.party join county as t2 on t1.district = t2.county_id where t2.population < 87200.0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "election", "sql": "select t0.party, t0.comptroller, t1.delegate from party as t0 join election as t1 on t0.party_id = t1.party join county as t2 on t1.district = t2.county_id where t2.population < 87200.0" }, "style": "rule" }
{ "index": 411, "split": "train" }
How many distinct skills are associated with engineers for skills whose descriptions end with "al" or start with "Mec"? Please list the count along with the skill id for each of these skills.
assets_maintenance
select count(distinct (t0.skill_id)), t1.skill_id as c1 from engineer_skills as t0 join skills as t1 on t0.skill_id = t1.skill_id where t1.skill_description like '%al' or t1.skill_description like 'Mec%' 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": "assets_maintenance", "sql": "select count(distinct (t0.skill_id)), t1.skill_id as c1 from engineer_skills as t0 join skills as t1 on t0.skill_id = t1.skill_id where t1.skill_description like '%al' or t1.skill_description like 'Mec%' group by c1" }, "style": "rule" }
{ "index": 111, "split": "train" }
What are the names, employee IDs, and aircraft IDs of the first ten certifications for the employee with ID 141582651, sorted by aircraft ID?
flight_1
select t0.name, t0.eid, t1.aid as c1 from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 141582651 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": "flight_1", "sql": "select t0.name, t0.eid, t1.aid as c1 from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 141582651 order by c1 asc nulls last limit 10" }, "style": "rule" }
{ "index": 2381, "split": "train" }
Is the number of unique documents linked to functional area 8 fewer than six?
document_management
select t0.c1 < 6 from (select count(distinct (t1.document_code)) as c1 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t0.functional_area_code = 8 group by t0.functional_area_code) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "document_management", "sql": "select t0.c1 < 6 from (select count(distinct (t1.document_code)) as c1 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t0.functional_area_code = 8 group by t0.functional_area...
{ "index": 3337, "split": "train" }
Does the browser with ID 3 have a higher market share than the browser with ID 2?
browser_web
select t1.c2 > t0.c2 from (select market_share as c2 from browser where id = 2) as t1, (select market_share as c2 from browser where id = 3) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "browser_web", "sql": "select t1.c2 > t0.c2 from (select market_share as c2 from browser where id = 2) as t1, (select market_share as c2 from browser where id = 3) as t0" }, "style": "rule" }
{ "index": 3538, "split": "train" }
Which building, associated with departments that offer a course worth 3 credits, is listed first alphabetically?
college_2
select t0.building as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.credits = 3 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": "college_2", "sql": "select t0.building as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.credits = 3 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 8, "split": "train" }
Can you list the value points, machine IDs, and machine series for all machines that were repaired by technicians who started between 2005 and 2016, excluding those repaired by technician Eddie Collins?
machine_repair
select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.value_points as c0, t0.machine_id as c1, t0.machine_series as c2 from machine as t0 join repair_assignment as t1 on t0.machine_id = t1.machine_id join technician as t2 on t1.technician_id = t2.technician_id where t2.starting_year between 2005.0 and 2016.0 except se...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "machine_repair", "sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.value_points as c0, t0.machine_id as c1, t0.machine_series as c2 from machine as t0 join repair_assignment as t1 on t0.machine_id = t1.machine_id join technician as t2 on t1.technician_id = t2.technic...
{ "index": 2229, "split": "train" }
Which are the three most common product names, and how many times does each appear in the database?
solvency_ii
select count(product_name) as c0 from products order by c0 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": "solvency_ii", "sql": "select count(product_name) as c0 from products order by c0 desc limit 3" }, "style": "rule" }
{ "index": 1373, "split": "train" }
What are the total of game IDs, the home team names, and the game IDs for matches where the score begins with "1"?
game_injury
select sum(t0.game_id), t1.home_team, t1.id as c2 from injury_accident as t0 join game as t1 on t0.game_id = t1.id where t1.score like '1%' group by c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_injury", "sql": "select sum(t0.game_id), t1.home_team, t1.id as c2 from injury_accident as t0 join game as t1 on t0.game_id = t1.id where t1.score like '1%' group by c2" }, "style": "rule" }
{ "index": 818, "split": "train" }