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
Which product has the highest number of related logs, and what are its Product ID, Product Name, and the total count of logs?
tracking_software_problems
select t0.product_id as c0, t0.product_name, count(*) as c2 from product as t0 join problems as t1 on t0.product_id = t1.product_id join problem_log as t2 on t1.problem_id = t2.problem_id group by c0 order by c2 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t0.product_id as c0, t0.product_name, count(*) as c2 from product as t0 join problems as t1 on t0.product_id = t1.product_id join problem_log as t2 on t1.problem_id = t2.problem_id group by c0 order by c2 desc limit 1" }, "style": "...
{ "index": 1543, "split": "train" }
Can you tell me the name and population of each county, along with the delegate and party from election districts where the political parties were active between 1998 and 2002?
election
select t0.county_name, t0.population, t1.delegate, t1.party from county as t0 join election as t1 on t0.county_id = t1.district join party as t2 on t1.party = t2.party_id where t2.year between 1998.0 and 2002.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.county_name, t0.population, t1.delegate, t1.party from county as t0 join election as t1 on t0.county_id = t1.district join party as t2 on t1.party = t2.party_id where t2.year between 1998.0 and 2002.0" }, "style": "rule" }
{ "index": 835, "split": "train" }
Can you show the festival IDs, locations, and audience numbers for festivals that took place in years greater than or equal to the total number of years recorded in the database?
entertainment_awards
select distinct t0.festival_id, t0.location, t0.num_of_audience from festival_detail as t0, (select count(year) as c0 from festival_detail) as t0 where t0.year >= t0.c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "entertainment_awards", "sql": "select distinct t0.festival_id, t0.location, t0.num_of_audience from festival_detail as t0, (select count(year) as c0 from festival_detail) as t0 where t0.year >= t0.c0" }, "style": "rule" }
{ "index": 2047, "split": "train" }
Which counties have their zip code, name, and population listed for parties that are either not involved in the election or specifically have the party ID 4?
election
select t0.zip_code, t0.county_name, t0.population from county as t0 join election as t1 on t0.county_id = t1.district join party as t2 on t1.party = t2.party_id where (not t2.party_id in (select t1.party as c0 from election)) or t2.party_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": "election", "sql": "select t0.zip_code, t0.county_name, t0.population from county as t0 join election as t1 on t0.county_id = t1.district join party as t2 on t1.party = t2.party_id where (not t2.party_id in (select t1.party as c0 from election)) or t2.party_id = 4" }, "style":...
{ "index": 1680, "split": "train" }
Which are the three most recent customer and address pairs who ordered the most common kind of product detail, sorted by address ID from highest to lowest?
customers_and_addresses
select t0.customer_id, t0.address_id as c2 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id join order_items as t3 on t2.order_id = t3.order_id join products as t4 on t3.product_id = t4.product_id, (select product_details...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t0.customer_id, t0.address_id as c2 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id join order_items as t3 on t2.order_id = t3.order_id joi...
{ "index": 917, "split": "train" }
Can you tell me the top 3 cases where the number of unique overall ratings, the number of unique player attribute IDs, and the highest crossing value are reported for players with Player Api IDs greater than or equal to the total number of players? And these should be sorted by the highest weight.
soccer_1
select count(distinct (t0.overall_rating)), count(distinct (t0.player_api_id)), max(t0.crossing) from player_attributes as t0 join player as t1 on t0.player_api_id = t1.player_api_id, (select count(player_api_id) as c2 from player) as t0 where t1.player_api_id >= t0.c2 order by max(t1.weight) 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": "soccer_1", "sql": "select count(distinct (t0.overall_rating)), count(distinct (t0.player_api_id)), max(t0.crossing) from player_attributes as t0 join player as t1 on t0.player_api_id = t1.player_api_id, (select count(player_api_id) as c2 from player) as t0 where t1.player_api_id ...
{ "index": 1026, "split": "train" }
Which station with more than 15 bikes available has the lowest station ID, and what are its location's latitude and station ID?
bike_1
select t0.lat, t1.station_id as c1 from station as t0 join status as t1 on t0.id = t1.station_id where t1.bikes_available > 15 order by c1 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "bike_1", "sql": "select t0.lat, t1.station_id as c1 from station as t0 join status as t1 on t0.id = t1.station_id where t1.bikes_available > 15 order by c1 asc nulls last limit 1" }, "style": "rule" }
{ "index": 2852, "split": "train" }
What are the actor IDs and last names of the actors who have appeared in films and have an actor ID of 109?
sakila_1
select distinct t0.actor_id, t0.last_name from actor as t0 join film_actor as t1 on t0.actor_id = t1.actor_id where t1.actor_id = 109
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "sakila_1", "sql": "select distinct t0.actor_id, t0.last_name from actor as t0 join film_actor as t1 on t0.actor_id = t1.actor_id where t1.actor_id = 109" }, "style": "rule" }
{ "index": 1564, "split": "train" }
What are the Market ID, number of cities, and country for the market estimations of film with ID 1 that has gross revenue over 79,912,963 dollars, and specifically the record with the highest film ID among these?
film_rank
select t0.market_id, t0.number_cities, t0.country, t1.film_id as c0 from market as t0 join film_market_estimation as t1 on t0.market_id = t1.market_id join film as t2 on t1.film_id = t2.film_id where t2.gross_in_dollar > 79912963 and t2.film_id = 1 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": "film_rank", "sql": "select t0.market_id, t0.number_cities, t0.country, t1.film_id as c0 from market as t0 join film_market_estimation as t1 on t0.market_id = t1.market_id join film as t2 on t1.film_id = t2.film_id where t2.gross_in_dollar > 79912963 and t2.film_id = 1 order by c0...
{ "index": 2814, "split": "train" }
Which customer and order correspond to each order ID, and what are the average invoice number and the highest account ID associated with those transactions?
customers_and_invoices
select t0.customer_id, t0.order_id as c0, avg(t2.invoice_number), max(t2.account_id) from orders as t0 join invoices as t1 on t0.order_id = t1.order_id join financial_transactions as t2 on t1.invoice_number = t2.invoice_number group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t0.customer_id, t0.order_id as c0, avg(t2.invoice_number), max(t2.account_id) from orders as t0 join invoices as t1 on t0.order_id = t1.order_id join financial_transactions as t2 on t1.invoice_number = t2.invoice_number group by c0" }, ...
{ "index": 2006, "split": "train" }
Which products have problems with IDs 7 or 14, and what are their names and product IDs?
tracking_software_problems
select t0.product_name from product as t0 join problems as t1 on t0.product_id = t1.product_id where t1.problem_id = 7 or t1.problem_id = 14
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t0.product_name from product as t0 join problems as t1 on t0.product_id = t1.product_id where t1.problem_id = 7 or t1.problem_id = 14" }, "style": "rule" }
{ "index": 1111, "split": "train" }
How much larger is the user ID that user 7 trusts compared to the user ID that user 2 trusts?
epinions_1
select t1.c0 - t0.c0 from (select target_u_id as c0 from trust where source_u_id = 2) as t1, (select target_u_id as c0 from trust where source_u_id = 7) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "epinions_1", "sql": "select t1.c0 - t0.c0 from (select target_u_id as c0 from trust where source_u_id = 2) as t1, (select target_u_id as c0 from trust where source_u_id = 7) as t0" }, "style": "rule" }
{ "index": 3607, "split": "train" }
What are the enzyme products, OMIM identifiers, and porphyria associations for enzymes linked to medicines that are not FDA approved, sorted in reverse alphabetical order by the enzyme's product name?
medicine_enzyme_interaction
select t0.product as c2, t0.omim, t0.porphyria from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id join medicine as t2 on t1.medicine_id = t2.id where t2.fda_approved = 'No' 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": "medicine_enzyme_interaction", "sql": "select t0.product as c2, t0.omim, t0.porphyria from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id join medicine as t2 on t1.medicine_id = t2.id where t2.fda_approved = 'No' order by c2 desc" }, "style": "rule...
{ "index": 1906, "split": "train" }
Show the lowest 10 order shipping charges along with the order status code and customer ID for customers who responded to a mailshot, where the mailshot response outcome code includes "Respon", sorted by customer ID with nulls positioned last.
customers_campaigns_ecommerce
select t0.order_shipping_charges, t0.order_status_code, t0.customer_id as c0 from customer_orders as t0 join customers as t1 on t0.customer_id = t1.customer_id join mailshot_customers as t2 on t1.customer_id = t2.customer_id where t2.outcome_code like '%Respon%' 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": "customers_campaigns_ecommerce", "sql": "select t0.order_shipping_charges, t0.order_status_code, t0.customer_id as c0 from customer_orders as t0 join customers as t1 on t0.customer_id = t1.customer_id join mailshot_customers as t2 on t1.customer_id = t2.customer_id where t2.outcom...
{ "index": 1218, "split": "train" }
What is the percentage change in the number of unique wind speeds recorded at stations on Thursdays at 6:30 AM?
station_weather
select (count(distinct (t0.wind_speed_mph)) / cast(count(distinct (t0.wind_speed_mph)) as real) - 1) * 100 from weekly_weather as t0 join station as t1 on t0.station_id = t1.id join route as t2 on t1.id = t2.station_id join train as t3 on t2.train_id = t3.id where t3.time = '06:30' and t0.day_of_week like 'Th%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (count(distinct (t0.wind_speed_mph)) / cast(count(distinct (t0.wind_speed_mph)) as real) - 1) * 100 from weekly_weather as t0 join station as t1 on t0.station_id = t1.id join route as t2 on t1.id = t2.station_id join train as t3 on t2.train_id = t...
{ "index": 3050, "split": "train" }
Who is the first staff member (by first name in alphabetical order) who has handled a complaint from a customer with an ID of 116 or less?
customer_complaints
select t0.first_name as c0 from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id where t1.customer_id <= 116 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": "customer_complaints", "sql": "select t0.first_name as c0 from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id where t1.customer_id <= 116 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 2514, "split": "train" }
For claims made on the most frequently used policy type, list the date the claim was made and the claimed amount.
insurance_policies
select anon_1.c2, anon_1.c1 from (select date_claim_made as c2, amount_claimed as c1 from claims intersect select t0.date_claim_made as c2, t0.amount_claimed as c1 from claims as t0 join customer_policies as t1 on t0.policy_id = t1.policy_id, (select policy_type_code as c0 from customer_policies group by c0 order by co...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_policies", "sql": "select anon_1.c2, anon_1.c1 from (select date_claim_made as c2, amount_claimed as c1 from claims intersect select t0.date_claim_made as c2, t0.amount_claimed as c1 from claims as t0 join customer_policies as t1 on t0.policy_id = t1.policy_id, (select ...
{ "index": 2417, "split": "train" }
What are the department names, their building locations, budgets, and instructor salaries for departments whose names end with the letter "y," ordered by instructor salary from highest to lowest?
college_2
select t0.dept_name, t0.building, t0.budget, t1.salary as c2 from department as t0 join instructor as t1 on t0.dept_name = t1.dept_name where t1.dept_name like '%y' 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": "college_2", "sql": "select t0.dept_name, t0.building, t0.budget, t1.salary as c2 from department as t0 join instructor as t1 on t0.dept_name = t1.dept_name where t1.dept_name like '%y' order by c2 desc" }, "style": "rule" }
{ "index": 1461, "split": "train" }
Can you tell me the nationalities and architect IDs of architects who built mills in the location with the highest average built year for mills ending in "n," considering only mills built from 1820 onward?
architecture
select t0.nationality, t1.architect_id from architect as t0 join mill as t1 on t0.id = t1.architect_id, (select location as c1 from mill where name like '%n' group by c1 order by avg(built_year) desc limit 1) as t0 where t1.location = t0.c1 and t1.built_year >= 1819
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "architecture", "sql": "select t0.nationality, t1.architect_id from architect as t0 join mill as t1 on t0.id = t1.architect_id, (select location as c1 from mill where name like '%n' group by c1 order by avg(built_year) desc limit 1) as t0 where t1.location = t0.c1 and t1.built_yea...
{ "index": 2532, "split": "train" }
Which appointments include patients along with their physicians' names and positions, for departments where the department head's ID is less than 9 and the department name is not associated with any procedures?
hospital_1
select t0.appointmentid, t0.patient, t1.name, t1.position from appointment as t0 join physician as t1 on t0.physician = t1.employeeid join department as t2 on t1.employeeid = t2.head where t2.head < 9 and (not t2.name in (select procedures.name as c2 from procedures))
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "hospital_1", "sql": "select t0.appointmentid, t0.patient, t1.name, t1.position from appointment as t0 join physician as t1 on t0.physician = t1.employeeid join department as t2 on t1.employeeid = t2.head where t2.head < 9 and (not t2.name in (select procedures.name as c2 from pro...
{ "index": 173, "split": "train" }
What are the top three highest song ratings in the 'nazrul' genre, along with the genre's overall rating and name, sorted by the genres with the highest average song resolution?
music_1
select max(t0.rating), t1.rating, t1.g_name as c2 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where c2 = 'nazrul' group by c2 order by avg(t0.resolution) 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": "music_1", "sql": "select max(t0.rating), t1.rating, t1.g_name as c2 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where c2 = 'nazrul' group by c2 order by avg(t0.resolution) desc limit 3" }, "style": "rule" }
{ "index": 590, "split": "train" }
What are the city, state/province/county, and address ID for students' addresses associated with the least frequently reported incident type?
behavior_monitoring
select t0.city, t0.state_province_county, t1.address_id from addresses as t0 join students as t1 on t0.address_id = t1.address_id join behavior_incident as t2 on t1.student_id = t2.student_id join ref_incident_type as t3 on t2.incident_type_code = t3.incident_type_code, (select incident_type_description as c0 from ref_...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.city, t0.state_province_county, t1.address_id from addresses as t0 join students as t1 on t0.address_id = t1.address_id join behavior_incident as t2 on t1.student_id = t2.student_id join ref_incident_type as t3 on t2.incident_type_code = t3...
{ "index": 390, "split": "train" }
What are the top 5 follow relationships involving users who have posted tweets with UID exactly 1? Specifically, I want to see the F2 and F1 values from the follows table, along with the UID of the users in the user profiles, sorted by UID from highest to lowest.
twitter_1
select t0.f2, t0.f1, t1.uid as c0 from follows as t0 join user_profiles as t1 on t0.f2 = t1.uid join tweets as t2 on t1.uid = t2.uid where t2.uid between 1 and 1 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": "twitter_1", "sql": "select t0.f2, t0.f1, t1.uid as c0 from follows as t0 join user_profiles as t1 on t0.f2 = t1.uid join tweets as t2 on t1.uid = t2.uid where t2.uid between 1 and 1 order by c0 desc limit 5" }, "style": "rule" }
{ "index": 2283, "split": "train" }
What are the three task details that have the highest number of unique task IDs, listed in reverse alphabetical order?
tracking_grants_for_research
select task_details as c1, count(distinct (task_id)) from tasks 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_grants_for_research", "sql": "select task_details as c1, count(distinct (task_id)) from tasks group by c1 order by c1 desc limit 3" }, "style": "rule" }
{ "index": 364, "split": "train" }
What are the titles and the number of unique managers they report to for employees whose first names contain "e" or end with "ret"?
store_1
select title as c0, count(distinct (reports_to)) from employees where first_name like '%e%' or first_name like '%ret' group by c0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select title as c0, count(distinct (reports_to)) from employees where first_name like '%e%' or first_name like '%ret' group by c0" }, "style": "rule" }
{ "index": 949, "split": "train" }
What are the names of songs and the corresponding artists whose gender ends with the letter "e"?
music_1
select t0.song_name, t1.artist_name from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where t1.gender like '%e'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "music_1", "sql": "select t0.song_name, t1.artist_name from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where t1.gender like '%e'" }, "style": "rule" }
{ "index": 2563, "split": "train" }
What are the date of births and people IDs of individuals who have entrepreneurs funded by the most common investor, but who are not involved in the most common company?
entrepreneur
select anon_1.c0, anon_1.c2 from (select t0.date_of_birth as c0, t0.people_id as c2 from people as t0 join entrepreneur as t1 on t0.people_id = t1.people_id, (select investor as c3 from entrepreneur group by c3 order by count(*) desc limit 1) as t2 where t1.investor = t2.c3 except select t0.date_of_birth as c0, t0.peop...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c2 from (select t0.date_of_birth as c0, t0.people_id as c2 from people as t0 join entrepreneur as t1 on t0.people_id = t1.people_id, (select investor as c3 from entrepreneur group by c3 order by count(*) desc limit 1) as t2 where t1...
{ "index": 303, "split": "train" }
What are the first 10 product names associated with order item ID 15, sorted alphabetically?
tracking_orders
select t0.product_name as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_item_id = 15 order by c0 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.product_name as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.order_item_id = 15 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 603, "split": "train" }
Show the first 10 address IDs from the Addresses table and their corresponding address IDs in People_Addresses where the address ID is less than 92, sorted by the People_Addresses ID.
student_assessment
select t0.address_id, t1.address_id as c0 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where c0 < 92 order by c0 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select t0.address_id, t1.address_id as c0 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where c0 < 92 order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 798, "split": "train" }
Which catalogs with IDs of 2 or higher have a catalog structure that is not classified under the most frequently occurring catalog level? In other words, what are the IDs and latest revision dates of these catalogs?
product_catalog
select anon_1.c2, anon_1.c0 from (select t0.catalog_id as c2, t0.date_of_latest_revision as c0 from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_id >= 2 except select t0.catalog_id as c2, t0.date_of_latest_revision as c0 from catalogs as t0 join catalog_structure as t1 o...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select anon_1.c2, anon_1.c0 from (select t0.catalog_id as c2, t0.date_of_latest_revision as c0 from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_id >= 2 except select t0.catalog_id as c2, t0.date_of_latest...
{ "index": 691, "split": "train" }
Did customer 6's address start date come after customer 9's address start date?
customers_and_products_contacts
select t1.c1 > t0.c1 from (select date_from as c1 from customer_address_history where customer_id = 6) as t1, (select date_from as c1 from customer_address_history where customer_id = 9) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select t1.c1 > t0.c1 from (select date_from as c1 from customer_address_history where customer_id = 6) as t1, (select date_from as c1 from customer_address_history where customer_id = 9) as t0" }, "style": "rule" }
{ "index": 3078, "split": "train" }
Who are the reviewers and their ratings for the movie titled "E.T." that was directed by the most frequently appearing director in the database?
movie_1
select t0.name, t0.rid, t1.rid from reviewer as t0 join rating as t1 on t0.rid = t1.rid join movie as t2 on t1.mid = t2.mid, (select director as c3 from movie group by c3 order by count(*) desc limit 1) as t0 where t2.title = 'E.T.' and t2.director = t0.c3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "movie_1", "sql": "select t0.name, t0.rid, t1.rid from reviewer as t0 join rating as t1 on t0.rid = t1.rid join movie as t2 on t1.mid = t2.mid, (select director as c3 from movie group by c3 order by count(*) desc limit 1) as t0 where t2.title = 'E.T.' and t2.director = t0.c3" },...
{ "index": 16, "split": "train" }
How many years earlier did the browser with ID 2 become compatible with an accelerator compared to the latest starting year when Internet Explorer was first compatible with an accelerator?
browser_web
select t2.c2 - t0.c3 from (select max(t1.c3) as c2 from (select min(t1.compatible_since_year) as c3 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id where t0.name = 'Internet Explorer' group by t0.id) as t1) as t2, (select t0.id, min(t1.compatible_since_year) as c3 from browser as t...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "browser_web", "sql": "select t2.c2 - t0.c3 from (select max(t1.c3) as c2 from (select min(t1.compatible_since_year) as c3 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id where t0.name = 'Internet Explorer' group by t0.id) as t1) as t2, (selec...
{ "index": 3161, "split": "train" }
Which operating systems are associated with accelerator device ID 2 that have been compatible with browsers since 2000 or earlier?
browser_web
select t0.operating_system from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id where t1.accelerator_id = 2 and t1.compatible_since_year <= 2000
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.operating_system from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id where t1.accelerator_id = 2 and t1.compatible_since_year <= 2000" }, "style": "rule" }
{ "index": 1474, "split": "train" }
On October 14, 2007, at 9:50 PM, is the percentage change in the average product ID for customer 118 greater than the count-based measure calculated for all other customers who have a customer type code containing "d Cred" and also filed complaints on that same date?
customer_complaints
select abs((t2.c4 / cast(t2.c4 as real) - 1) * 100) > t1.c3 from (select avg(t1.product_id) as c4 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 118 and t1.date_complaint_raised = '2007-10-14 21:50:43' group by t0.customer_id) as t2, (select abs((count(t0.c4) / cast...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 abs((t2.c4 / cast(t2.c4 as real) - 1) * 100) > t1.c3 from (select avg(t1.product_id) as c4 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 118 and t1.date_complaint_raised = '2007-10-14 21:5...
{ "index": 3436, "split": "train" }
What is the numerical difference between the address IDs associated with customer 7 and customer 3 in their address history?
customers_and_products_contacts
select t1.c0 - t0.c0 from (select address_id as c0 from customer_address_history where customer_id = 3) as t1, (select address_id as c0 from customer_address_history where customer_id = 7) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select t1.c0 - t0.c0 from (select address_id as c0 from customer_address_history where customer_id = 3) as t1, (select address_id as c0 from customer_address_history where customer_id = 7) as t0" }, "style": "rule" }
{ "index": 3598, "split": "train" }
For students with IDs less than 15, how many days passed between their enrollment date and their course completion date?
e_learning
select julianday(t1.c2) - julianday(t0.c1) from (select date_of_completion as c2 from student_course_enrolment where student_id < 15 and student_id < 15) as t1, (select date_of_enrolment as c1 from student_course_enrolment) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select julianday(t1.c2) - julianday(t0.c1) from (select date_of_completion as c2 from student_course_enrolment where student_id < 15 and student_id < 15) as t1, (select date_of_enrolment as c1 from student_course_enrolment) as t0" }, "style": "rule" }
{ "index": 3709, "split": "train" }
Which are the three cities that have fewer than two airports with a specific airport id of 5959 or the least common airport id overall, and for each of these cities, how many different countries are represented? The list should be sorted by the number of countries from the fewest to the most.
flight_4
select t0.city as c1, count(t0.country) as c2 from airports as t0, (select apid as c0 from airports group by c0 order by count(*) asc nulls last limit 1) as t0 where t0.apid = 5959 or t0.apid = t0.c0 group by c1 having count(*) < 2 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": "flight_4", "sql": "select t0.city as c1, count(t0.country) as c2 from airports as t0, (select apid as c0 from airports group by c0 order by count(*) asc nulls last limit 1) as t0 where t0.apid = 5959 or t0.apid = t0.c0 group by c1 having count(*) < 2 order by c2 asc nulls last li...
{ "index": 708, "split": "train" }
Is the address ID linked to customer 12 less than 12?
customers_and_addresses
select address_id < 12 from customer_addresses where customer_id = 12
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select address_id < 12 from customer_addresses where customer_id = 12" }, "style": "rule" }
{ "index": 3336, "split": "train" }
How many store IDs are there for each type of store?
store_product
select type as c0, count(store_id) from store 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 type as c0, count(store_id) from store group by c0" }, "style": "rule" }
{ "index": 2024, "split": "train" }
How many properties are recorded in the database?
local_govt_and_lot
select count(*) from properties
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select count(*) from properties" }, "style": "rule" }
{ "index": 1870, "split": "train" }
Did customer 14 become a customer before customer 8?
customers_and_addresses
select t1.c2 < t0.c2 from (select date_became_customer as c2 from customers where customer_id = 14) as t1, (select date_became_customer as c2 from customers where customer_id = 8) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t1.c2 < t0.c2 from (select date_became_customer as c2 from customers where customer_id = 14) as t1, (select date_became_customer as c2 from customers where customer_id = 8) as t0" }, "style": "rule" }
{ "index": 3122, "split": "train" }
Which students have lived in both dorms with IDs greater than or equal to 140 and dorms with IDs less than or equal to 140? Please provide their majors, student IDs, and genders.
dorm_1
select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.major as c2, t0.stuid as c0, t0.sex as c1 from student as t0 join lives_in as t1 on t0.stuid = t1.stuid where t1.dormid >= 140 intersect select t0.major as c2, t0.stuid as c0, t0.sex as c1 from student as t0 join lives_in as t1 on t0.stuid = t1.stuid where t1.dormi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.major as c2, t0.stuid as c0, t0.sex as c1 from student as t0 join lives_in as t1 on t0.stuid = t1.stuid where t1.dormid >= 140 intersect select t0.major as c2, t0.stuid as c0, t0.sex as c1 from student as t0 ...
{ "index": 1911, "split": "train" }
In the Office Locations database, which building has the fewest office locations, and how many unique companies have offices there?
company_office
select count(distinct (t0.company_id)) as c1 from office_locations as t0, (select building_id as c0 from office_locations group by c0 order by count(*) asc nulls last limit 1) as t0 where t0.building_id = t0.c0 order by c1 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select count(distinct (t0.company_id)) as c1 from office_locations as t0, (select building_id as c0 from office_locations group by c0 order by count(*) asc nulls last limit 1) as t0 where t0.building_id = t0.c0 order by c1 desc limit 1" }, "style": "r...
{ "index": 1645, "split": "train" }
Among airlines that have more than three routes, which airline has the first name in alphabetical order that is active, and has airline ID and the minimum airline ID associated with routes that either contain "8Q" in their airline code or are the most frequently occurring airline?
flight_4
select t0.name as c3, t0.active, t0.alid as c4, min(t1.alid) from airlines as t0 join routes as t1 on t0.alid = t1.alid, (select airline as c1 from routes group by c1 order by count(*) desc limit 1) as t0 where t1.airline like '%8Q%' or t1.airline = t0.c1 group by c4 having count(*) > 3 order by c3 asc nulls last limit...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.name as c3, t0.active, t0.alid as c4, min(t1.alid) from airlines as t0 join routes as t1 on t0.alid = t1.alid, (select airline as c1 from routes group by c1 order by count(*) desc limit 1) as t0 where t1.airline like '%8Q%' or t1.airline = t0.c1 group...
{ "index": 1992, "split": "train" }
Can you identify the top five industries that have the highest average sales, and for each of these industries, tell me how many unique headquarters locations and how many companies are in that industry?
company_employee
select industry as c0, count(headquarters), count(*) from company group by c0 order by avg(sales_in_billion) desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_employee", "sql": "select industry as c0, count(headquarters), count(*) from company group by c0 order by avg(sales_in_billion) desc limit 5" }, "style": "rule" }
{ "index": 955, "split": "train" }
What are the three project detail descriptions for the project with ID 4, ranked in reverse alphabetical order?
tracking_grants_for_research
select t0.project_details as c0 from projects as t0 join project_outcomes as t1 on t0.project_id = t1.project_id where t1.project_id = 4 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_grants_for_research", "sql": "select t0.project_details as c0 from projects as t0 join project_outcomes as t1 on t0.project_id = t1.project_id where t1.project_id = 4 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 2910, "split": "train" }
What is the difference between the smallest customer ID associated with customer 16 on the move-in date of March 27, 2015, and the smallest customer ID for that same customer on the same date but only considering properties with IDs of 108 or higher?
local_govt_and_lot
select t1.c1 - t0.c1 from (select min(t1.customer_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t1, (select t0.customer_id, min(t1.customer_id) as c1 from customers as t0 joi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t1.c1 - t0.c1 from (select min(t1.customer_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t1, (sele...
{ "index": 3969, "split": "train" }
For each investor with exactly one transaction and investor details equal to 'l', what is the count of the distinct transaction amounts, the total number of transactions (which should be one), and the investor's ID?
tracking_share_transactions
select count(distinct (t0.amount_of_transaction)), count(t0.investor_id), t1.investor_id as c0 from transactions as t0 join investors as t1 on t0.investor_id = t1.investor_id where t1.investor_details = 'l' group by c0 having count(*) = 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select count(distinct (t0.amount_of_transaction)), count(t0.investor_id), t1.investor_id as c0 from transactions as t0 join investors as t1 on t0.investor_id = t1.investor_id where t1.investor_details = 'l' group by c0 having count(*) = 1" ...
{ "index": 659, "split": "train" }
How far is the average `country_id` for country 27 from 100?
sakila_1
select t0.c1 - 100.0 from (select avg(t1.country_id) as c1 from country as t0 join city as t1 on t0.country_id = t1.country_id where t0.country_id = 27 group by t0.country_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "sakila_1", "sql": "select t0.c1 - 100.0 from (select avg(t1.country_id) as c1 from country as t0 join city as t1 on t0.country_id = t1.country_id where t0.country_id = 27 group by t0.country_id) as t0" }, "style": "rule" }
{ "index": 3899, "split": "train" }
Which organizations have services whose descriptions start with "Un" or "Unsa"? List their organization details and IDs for the first 10 results, sorted alphabetically by organization details.
local_govt_and_lot
select t0.organization_details as c0 from organizations as t0 join services as t1 on t0.organization_id = t1.organization_id where t1.service_details like 'Un%' or t1.service_details like 'Unsa%' order by c0 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t0.organization_details as c0 from organizations as t0 join services as t1 on t0.organization_id = t1.organization_id where t1.service_details like 'Un%' or t1.service_details like 'Unsa%' order by c0 asc nulls last limit 10" }, "style": "r...
{ "index": 1264, "split": "train" }
Can you list the top 10 stores, including their types, names, and IDs, along with the district IDs they belong to, where the districts have a city area between 10 and 25, or at least 28, sorted by store type?
store_product
select t0.type as c2, t0.store_name, t0.store_id, t1.district_id, t1.store_id from store as t0 join store_district as t1 on t0.store_id = t1.store_id join district as t2 on t1.district_id = t2.district_id where t2.city_area between 10.0 and 25.0 or t2.city_area >= 28.0 order by c2 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": "store_product", "sql": "select t0.type as c2, t0.store_name, t0.store_id, t1.district_id, t1.store_id from store as t0 join store_district as t1 on t0.store_id = t1.store_id join district as t2 on t1.district_id = t2.district_id where t2.city_area between 10.0 and 25.0 or t2.city...
{ "index": 609, "split": "train" }
List the open dates and IDs of churches that opened in 1830, ordering the results alphabetically by their names with any missing names appearing last.
wedding
select open_date as c0, church_id from church where c0 = 1830 order by name asc nulls last
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "wedding", "sql": "select open_date as c0, church_id from church where c0 = 1830 order by name asc nulls last" }, "style": "rule" }
{ "index": 2636, "split": "train" }
Is the highest product ID for product 2 less than the total number of unique maximum product IDs across all products?
products_for_hire
select t2.c1 < t1.c2 from (select max(t1.product_id) as c1 from products_for_hire as t0 join view_product_availability as t1 on t0.product_id = t1.product_id where t0.product_id = 2 group by t0.product_id) as t2, (select count(distinct (t0.c1)) as c2 from (select max(t1.product_id) as c1 from products_for_hire as t0 jo...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c1 < t1.c2 from (select max(t1.product_id) as c1 from products_for_hire as t0 join view_product_availability as t1 on t0.product_id = t1.product_id where t0.product_id = 2 group by t0.product_id) as t2, (select count(distinct (t0.c1)) as c2 f...
{ "index": 3320, "split": "train" }
Is the maximum aperture of the camera lens with ID 7 smaller than that of the lens with ID 4?
mountain_photos
select t1.c2 < t0.c2 from (select max_aperture as c2 from camera_lens where id = 4) as t1, (select max_aperture as c2 from camera_lens where id = 7) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "mountain_photos", "sql": "select t1.c2 < t0.c2 from (select max_aperture as c2 from camera_lens where id = 4) as t1, (select max_aperture as c2 from camera_lens where id = 7) as t0" }, "style": "rule" }
{ "index": 3919, "split": "train" }
Which product with ID 3 has the highest number of order items, and what are its details? Show me the top three counts of how many times this product appears in orders, along with its details and ID.
customers_and_addresses
select count(*) as c0, t0.product_details, t0.product_id as c2 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where c2 = 3 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": "customers_and_addresses", "sql": "select count(*) as c0, t0.product_details, t0.product_id as c2 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where c2 = 3 group by c2 order by c0 desc limit 3" }, "style": "rule" }
{ "index": 2248, "split": "train" }
Show the three accounts with the lowest average card ID, along with their other account details, for accounts whose names include the digit "4", ordered by account ID.
customers_card_transactions
select avg(t0.card_id), t1.other_account_details from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.account_name like '%4%' group by t1.account_id order by t1.account_id 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": "customers_card_transactions", "sql": "select avg(t0.card_id), t1.other_account_details from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.account_name like '%4%' group by t1.account_id order by t1.account_id asc nulls last limit 3" }...
{ "index": 1963, "split": "train" }
Show the bottom five entries when ordered by the number of unique churches, displaying the total open date values, the number of church names, and the count of distinct church IDs in each case.
wedding
select sum(open_date), count(name), count(distinct (church_id)) as c0 from church order by c0 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "wedding", "sql": "select sum(open_date), count(name), count(distinct (church_id)) as c0 from church order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 930, "split": "train" }
When was the problem with the highest product ID, whose closure was authorized by staff member 8, first reported?
tracking_software_problems
select t0.date_problem_reported, t0.product_id as c3 from problems as t0, (select max(product_id) as c1 from problems where closure_authorised_by_staff_id = 8) as t1 where c3 = t1.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t0.date_problem_reported, t0.product_id as c3 from problems as t0, (select max(product_id) as c1 from problems where closure_authorised_by_staff_id = 8) as t1 where c3 = t1.c1" }, "style": "rule" }
{ "index": 3805, "split": "train" }
What are the color descriptions and color codes for products that either have characteristics of the most common characteristic type, or have characteristics whose names end with "arm"?
products_gen_characteristics
select anon_1.c0, anon_1.c2 from (select t0.color_description as c0, t0.color_code as c2 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code join product_characteristics as t2 on t1.product_id = t2.product_id join characteristics as t3 on t2.characteristic_id = t3.characteristic_id, (select chara...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c2 from (select t0.color_description as c0, t0.color_code as c2 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code join product_characteristics as t2 on t1.product_id = t2.product_id join char...
{ "index": 1853, "split": "train" }
Which shops that have happy hours corresponding to shop ID 3 but not to shop ID 10 have what their scores and number of staff?
coffee_shop
select anon_1.c0, anon_1.c1 from (select t0.score as c0, t0.num_of_staff as c1 from shop as t0 join happy_hour as t1 on t0.shop_id = t1.shop_id where t1.shop_id = 3 except select t0.score as c0, t0.num_of_staff as c1 from shop as t0 join happy_hour as t1 on t0.shop_id = t1.shop_id where t1.shop_id = 10) as anon_1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "coffee_shop", "sql": "select anon_1.c0, anon_1.c1 from (select t0.score as c0, t0.num_of_staff as c1 from shop as t0 join happy_hour as t1 on t0.shop_id = t1.shop_id where t1.shop_id = 3 except select t0.score as c0, t0.num_of_staff as c1 from shop as t0 join happy_hour as t1 on ...
{ "index": 307, "split": "train" }
Considering the activities, what are the activity names and their IDs, along with the number of unique faculty members involved who have faculty IDs between 1177 and 6112, and are associated with activities having IDs between 782 and 790? Please group the results by each activity." This version maintains all relevant ...
activity_1
select t0.activity_name, t0.actid as c2, count(distinct (t1.facid)) from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.facid between 1177 and 6112 and t1.actid between 782 and 790 group by c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "activity_1", "sql": "select t0.activity_name, t0.actid as c2, count(distinct (t1.facid)) from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.facid between 1177 and 6112 and t1.actid between 782 and 790 group by c2" }, "style": "rule" }
{ "index": 1201, "split": "train" }
What are the card numbers and the average customer IDs for each card, considering only those cards that became valid before November 5, 2009, at 09:26:01, or after May 23, 2013, at 07:55:36? Among these, which card has the lowest average customer ID?
customers_card_transactions
select card_number as c0, avg(customer_id) as c1 from customers_cards where date_valid_from <= '2009-11-05 09:26:01' or date_valid_from > '2013-05-23 07:55:36' group by c0 order by c1 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_card_transactions", "sql": "select card_number as c0, avg(customer_id) as c1 from customers_cards where date_valid_from <= '2009-11-05 09:26:01' or date_valid_from > '2013-05-23 07:55:36' group by c0 order by c1 asc nulls last limit 1" }, "style": "rule" }
{ "index": 2015, "split": "train" }
Find the first 10 address IDs of people living in South Keenan or in cities starting with "Lak," ordered by their address ID.
student_assessment
select t0.address_id as c0 from people_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id where t1.city = 'South Keenan' or t1.city like 'Lak%' order by c0 asc nulls last limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "student_assessment", "sql": "select t0.address_id as c0 from people_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id where t1.city = 'South Keenan' or t1.city like 'Lak%' order by c0 asc nulls last limit 10" }, "style": "rule" }
{ "index": 963, "split": "train" }
?
twitter_1
select count(*), t0.partitionid, t0.uid as c2 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid, (select name as c1 from user_profiles group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.followers > 890 and t0.name = t0.c1 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": "twitter_1", "sql": "select count(*), t0.partitionid, t0.uid as c2 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid, (select name as c1 from user_profiles group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.followers > 890 and t0.name = t0.c1 group by...
{ "index": 181, "split": "train" }
Is the organization associated with service ID 41 assigned a higher Organization ID than the smallest Organization ID among services whose type code contains "Chec"?
local_govt_and_lot
select t2.c3 > t1.c0 from (select organization_id as c3 from services where service_id = 41) as t2, (select min(organization_id) as c0 from services where service_type_code like '%Chec%') as t1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t2.c3 > t1.c0 from (select organization_id as c3 from services where service_id = 41) as t2, (select min(organization_id) as c0 from services where service_type_code like '%Chec%') as t1" }, "style": "rule" }
{ "index": 3276, "split": "train" }
What is the highest country ID, and what are the name and ID of the country with ID 13274?
soccer_1
select max(t0.country_id), t1.name, t1.id as c2 from league as t0 join country as t1 on t0.country_id = t1.id where c2 = 13274 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": "soccer_1", "sql": "select max(t0.country_id), t1.name, t1.id as c2 from league as t0 join country as t1 on t0.country_id = t1.id where c2 = 13274 group by c2" }, "style": "rule" }
{ "index": 2893, "split": "train" }
What is the participant type code that appears the least often, and how many times does it occur?
local_govt_in_alabama
select participant_type_code as c1, count(participant_type_code) as c0 from participants 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": "local_govt_in_alabama", "sql": "select participant_type_code as c1, count(participant_type_code) as c0 from participants group by c1 order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 987, "split": "train" }
What is the change in the average customer ID for customer 31 at the move-in event on September 27, 2016, involving properties with IDs 108 or above?
local_govt_and_lot
select t0.c2 - t0.c2 from (select avg(t1.customer_id) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 31 and t1.date_moved_in = '2016-09-27 12:00:00' and t1.property_id >= 108 group by t0.customer_id) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "local_govt_and_lot", "sql": "select t0.c2 - t0.c2 from (select avg(t1.customer_id) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 31 and t1.date_moved_in = '2016-09-27 12:00:00' and t1.property_id >= 108 group by t0...
{ "index": 3819, "split": "train" }
Show the location, date, and attendance of performances, along with the member IDs and performance IDs for members whose names contain 'e' or the phrase 'e Bu'.
performance_attendance
select t0.location, t0.date, t0.attendance, t1.member_id, t1.performance_id from performance as t0 join member_attendance as t1 on t0.performance_id = t1.performance_id join member as t2 on t1.member_id = t2.member_id where t2.name like '%e%' or t2.name like '%e Bu%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "performance_attendance", "sql": "select t0.location, t0.date, t0.attendance, t1.member_id, t1.performance_id from performance as t0 join member_attendance as t1 on t0.performance_id = t1.performance_id join member as t2 on t1.member_id = t2.member_id where t2.name like '%e%' or t...
{ "index": 2523, "split": "train" }
What are the majors, last names, and advisors of the first five students who play the most popular video game, sorted by major, placing students without a major at the end?
game_1
select t0.major as c3, t0.lname, t0.advisor from student as t0 join plays_games as t1 on t0.stuid = t1.stuid join video_games as t2 on t1.gameid = t2.gameid, (select gameid as c1 from video_games group by c1 order by count(*) desc limit 1) as t0 where t2.gameid = t0.c1 order by c3 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": "game_1", "sql": "select t0.major as c3, t0.lname, t0.advisor from student as t0 join plays_games as t1 on t0.stuid = t1.stuid join video_games as t2 on t1.gameid = t2.gameid, (select gameid as c1 from video_games group by c1 order by count(*) desc limit 1) as t0 where t2.gameid =...
{ "index": 1681, "split": "train" }
Which supervisors (Reports To) and their last names are associated with customers from states ending with "ON"?
store_1
select distinct t0.reports_to, t1.last_name from employees as t0 join customers as t1 on t0.id = t1.support_rep_id where t1.state like '%ON'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select distinct t0.reports_to, t1.last_name from employees as t0 join customers as t1 on t0.id = t1.support_rep_id where t1.state like '%ON'" }, "style": "rule" }
{ "index": 1248, "split": "train" }
Can you tell me the complaint type, complaint status, customer ID, and staff first name for complaints handled by staff members whose phone numbers start with "(383)553-1035x2039" or "751-262-8424x5"?
customer_complaints
select t0.complaint_type_code, t0.complaint_status_code, t0.customer_id, t1.first_name from complaints as t0 join staff as t1 on t0.staff_id = t1.staff_id where t1.phone_number like '(383)553-1035x2039%' or t1.phone_number like '751-262-8424x5%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.complaint_type_code, t0.complaint_status_code, t0.customer_id, t1.first_name from complaints as t0 join staff as t1 on t0.staff_id = t1.staff_id where t1.phone_number like '(383)553-1035x2039%' or t1.phone_number like '751-262-8424x5%'" }...
{ "index": 2580, "split": "train" }
What are the descriptions of the research outcomes associated with the project that has an ID of 12?
tracking_grants_for_research
select t0.outcome_description from research_outcomes as t0 join project_outcomes as t1 on t0.outcome_code = t1.outcome_code where t1.project_id = 12
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t0.outcome_description from research_outcomes as t0 join project_outcomes as t1 on t0.outcome_code = t1.outcome_code where t1.project_id = 12" }, "style": "rule" }
{ "index": 2146, "split": "train" }
What are the different trade names, names, and FDA approval statuses of medicines that have "ulpri" in their names?
medicine_enzyme_interaction
select distinct trade_name, name as c2, fda_approved from medicine where c2 like '%ulpri%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select distinct trade_name, name as c2, fda_approved from medicine where c2 like '%ulpri%'" }, "style": "rule" }
{ "index": 263, "split": "train" }
Which are the top five buildings that house the most departments with budgets less than 848,175.04 and names starting with "Mat"? List the building names, ordered by the number of such departments in each building. This phrasing clearly indicates that we're interested in the buildings with the highest count of matchin...
college_2
select building as c0 from department where budget < 848175.04 and dept_name like 'Mat%' group by c0 order by count(budget) 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": "college_2", "sql": "select building as c0 from department where budget < 848175.04 and dept_name like 'Mat%' group by c0 order by count(budget) desc limit 5" }, "style": "rule" }
{ "index": 2782, "split": "train" }
Can you tell me the names and IDs of pilots, along with their winning aircrafts and aircraft IDs, where the aircrafts are either associated with airports not listed in the airports database or specifically linked to airport number 2?
aircraft
select t0.name, t0.pilot_id, t2.aircraft, t2.aircraft_id from pilot as t0 join match as t1 on t0.pilot_id = t1.winning_pilot join aircraft as t2 on t1.winning_aircraft = t2.aircraft_id join airport_aircraft as t3 on t2.aircraft_id = t3.aircraft_id where (not t3.airport_id in (select airport.airport_id as c4 from airpor...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t0.name, t0.pilot_id, t2.aircraft, t2.aircraft_id from pilot as t0 join match as t1 on t0.pilot_id = t1.winning_pilot join aircraft as t2 on t1.winning_aircraft = t2.aircraft_id join airport_aircraft as t3 on t2.aircraft_id = t3.aircraft_id where (not t3...
{ "index": 674, "split": "train" }
Is the user who posted the tweet with ID 4 has a UID greater than the user who posted the tweet with ID 9?
twitter_1
select t1.c0 > t0.c0 from (select uid as c0 from tweets where id = 9) as t1, (select uid as c0 from tweets where id = 4) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "twitter_1", "sql": "select t1.c0 > t0.c0 from (select uid as c0 from tweets where id = 9) as t1, (select uid as c0 from tweets where id = 4) as t0" }, "style": "rule" }
{ "index": 3558, "split": "train" }
What is the smallest task project ID, along with the organization ID and project ID, for the project with ID 9, particularly the one with the highest minimum task project ID?
tracking_grants_for_research
select min(t0.project_id) as c1, t1.organisation_id, t1.project_id as c0 from tasks as t0 join projects as t1 on t0.project_id = t1.project_id where c0 = 9 group by c0 order by c1 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select min(t0.project_id) as c1, t1.organisation_id, t1.project_id as c0 from tasks as t0 join projects as t1 on t0.project_id = t1.project_id where c0 = 9 group by c0 order by c1 desc limit 1" }, "style": "rule" }
{ "index": 138, "split": "train" }
What are the maximum aperture, focal length in millimeters, and ID for each camera lens, along with the number of photos taken with that lens on mountains with IDs less than or equal to 12?
mountain_photos
select t0.max_aperture, t0.focal_length_mm, t0.id as c1, count(*) from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t1.mountain_id <= 12 or t1.mountain_id <= 2 group by c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "mountain_photos", "sql": "select t0.max_aperture, t0.focal_length_mm, t0.id as c1, count(*) from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t1.mountain_id <= 12 or t1.mountain_id <= 2 group by c1" }, "style": "rule" }
{ "index": 416, "split": "train" }
What are the brands of camera lenses that were used to take black-and-white photos?
mountain_photos
select t0.brand from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t1.color = 'Black/White'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "mountain_photos", "sql": "select t0.brand from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t1.color = 'Black/White'" }, "style": "rule" }
{ "index": 2223, "split": "train" }
List the last names and first names of the first five staff members who have log entries containing the letter "p", ordered alphabetically by their last name.
tracking_software_problems
select t0.staff_last_name as c0, t0.staff_first_name from staff as t0 join problem_log as t1 on t0.staff_id = t1.assigned_to_staff_id where t1.log_entry_description like '%p%' order by c0 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_software_problems", "sql": "select t0.staff_last_name as c0, t0.staff_first_name from staff as t0 join problem_log as t1 on t0.staff_id = t1.assigned_to_staff_id where t1.log_entry_description like '%p%' order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2303, "split": "train" }
Which advisors, student first names, number of hours played, and student IDs are associated with video games whose names include "he Vanis"?
game_1
select t0.advisor, t0.fname, t1.hours_played, t1.stuid from student as t0 join plays_games as t1 on t0.stuid = t1.stuid join video_games as t2 on t1.gameid = t2.gameid where t2.gname like '%he Vanis%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "game_1", "sql": "select t0.advisor, t0.fname, t1.hours_played, t1.stuid from student as t0 join plays_games as t1 on t0.stuid = t1.stuid join video_games as t2 on t1.gameid = t2.gameid where t2.gname like '%he Vanis%'" }, "style": "rule" }
{ "index": 148, "split": "train" }
What is the enrollment number, state, player position, and decision for the first tryout record of the player with ID 10001 who has a high school score less than or equal to the total sum of all players' high school scores, ordered by decision with any null decisions appearing last?
soccer_2
select t0.enr, t0.state, t1.ppos, t1.decision as c0 from college as t0 join tryout as t1 on t0.cname = t1.cname join player as t2 on t1.pid = t2.pid, (select sum(hs) as c3 from player) as t0 where t2.hs <= t0.c3 and t2.pid = 10001 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": "soccer_2", "sql": "select t0.enr, t0.state, t1.ppos, t1.decision as c0 from college as t0 join tryout as t1 on t0.cname = t1.cname join player as t2 on t1.pid = t2.pid, (select sum(hs) as c3 from player) as t0 where t2.hs <= t0.c3 and t2.pid = 10001 order by c0 asc nulls last lim...
{ "index": 170, "split": "train" }
How much lower is the Pages Per Minute Color of the product with ID 1 compared to the highest Pages Per Minute Color among all products?
store_product
select t2.c3 - t0.c1 from (select max(pages_per_minute_color) as c3 from product) as t2, (select pages_per_minute_color as c1 from product where product_id = 1) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select t2.c3 - t0.c1 from (select max(pages_per_minute_color) as c3 from product) as t2, (select pages_per_minute_color as c1 from product where product_id = 1) as t0" }, "style": "rule" }
{ "index": 3177, "split": "train" }
How much smaller is the total of order IDs for order 5 containing product 13 compared to the largest total order ID sum among all orders?
customers_and_products_contacts
select t2.c2 - t0.c3 from (select max(t1.c3) as c2 from (select sum(t1.order_id) as c3 from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id group by t0.order_id) as t1) as t2, (select t0.order_id, sum(t1.order_id) as c3 from customer_orders as t0 join order_items as t1 on t0.order_id = t1.orde...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_products_contacts", "sql": "select t2.c2 - t0.c3 from (select max(t1.c3) as c2 from (select sum(t1.order_id) as c3 from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id group by t0.order_id) as t1) as t2, (select t0.order_id, sum(t1.order_id...
{ "index": 3167, "split": "train" }
Can you list the names, IDs, and descriptions of the clubs that do not have any female members?
club_1
select anon_1.c2, anon_1.c1, anon_1.c0 from (select clubname as c2, clubid as c1, clubdesc as c0 from club except select t0.clubname as c2, t0.clubid as c1, t0.clubdesc as c0 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid join student as t2 on t1.stuid = t2.stuid where t2.sex like '%F') 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": "club_1", "sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select clubname as c2, clubid as c1, clubdesc as c0 from club except select t0.clubname as c2, t0.clubid as c1, t0.clubdesc as c0 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid join student as t2 on...
{ "index": 2491, "split": "train" }
Which customers have lessons using the most frequently used vehicle details or a truck, and what are their last names, cell phone numbers, addresses, and the lesson prices?
driving_school
select t0.last_name, t0.cell_mobile_phone_number, t0.customer_address_id, t1.price from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id join vehicles as t2 on t1.vehicle_id = t2.vehicle_id, (select vehicle_details as c2 from vehicles group by c2 order by count(*) desc limit 1) as t0 where t2.vehic...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.last_name, t0.cell_mobile_phone_number, t0.customer_address_id, t1.price from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id join vehicles as t2 on t1.vehicle_id = t2.vehicle_id, (select vehicle_details as c2 from vehicles...
{ "index": 548, "split": "train" }
What are the codes and descriptions of document structures that are associated with documents linked to the functional area labeled "Acknowledgement"?
document_management
select anon_1.c1, anon_1.c0 from (select document_structure_code as c1, document_structure_description as c0 from document_structures intersect select t0.document_structure_code as c1, t0.document_structure_description as c0 from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.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": "document_management", "sql": "select anon_1.c1, anon_1.c0 from (select document_structure_code as c1, document_structure_description as c0 from document_structures intersect select t0.document_structure_code as c1, t0.document_structure_description as c0 from document_structures ...
{ "index": 2495, "split": "train" }
When did the staff member who left on 2018-03-05 at 18:30:12 and had the highest staff address ID join the driving school?
driving_school
select t0.date_joined_staff, t0.staff_address_id as c3 from staff as t0, (select max(staff_address_id) as c1 from staff where date_left_staff = '2018-03-05 18:30:12') as t1 where c3 = t1.c1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select t0.date_joined_staff, t0.staff_address_id as c3 from staff as t0, (select max(staff_address_id) as c1 from staff where date_left_staff = '2018-03-05 18:30:12') as t1 where c3 = t1.c1" }, "style": "rule" }
{ "index": 3765, "split": "train" }
Is the skill ID required to fix fault 14 lower than the skill ID required for fault 7?
assets_maintenance
select t1.c2 < t0.c2 from (select skill_id as c2 from skills_required_to_fix where part_fault_id = 7) as t1, (select skill_id as c2 from skills_required_to_fix where part_fault_id = 14) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "assets_maintenance", "sql": "select t1.c2 < t0.c2 from (select skill_id as c2 from skills_required_to_fix where part_fault_id = 7) as t1, (select skill_id as c2 from skills_required_to_fix where part_fault_id = 14) as t0" }, "style": "rule" }
{ "index": 3559, "split": "train" }
Which are the five dorms with the fewest amenities?
dorm_1
select count(amenid) from has_amenity group by dormid order by dormid 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": "dorm_1", "sql": "select count(amenid) from has_amenity group by dormid order by dormid asc nulls last limit 5" }, "style": "rule" }
{ "index": 2676, "split": "train" }
What is the earliest and latest authorship position for papers with titles that include "ess, Painles"?
icfp_1
select min(t0.c1), max(t0.c1) from (select max(t1.authorder) as c1 from papers as t0 join authorship as t1 on t0.paperid = t1.paperid where t0.title like '%ess, Painles%' group by t0.paperid) 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": "icfp_1", "sql": "select min(t0.c1), max(t0.c1) from (select max(t1.authorder) as c1 from papers as t0 join authorship as t1 on t0.paperid = t1.paperid where t0.title like '%ess, Painles%' group by t0.paperid) as t0" }, "style": "rule" }
{ "index": 3643, "split": "train" }
Find the most recent customer who placed an order with status 'Delivered' or containing 'd', and include their date they became a customer, their payment method, and customer ID.
customers_and_addresses
select t0.date_became_customer as c0, t0.payment_method from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t1.order_status = 'Delivered' or t1.order_status like '%d%' 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": "customers_and_addresses", "sql": "select t0.date_became_customer as c0, t0.payment_method from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t1.order_status = 'Delivered' or t1.order_status like '%d%' order by c0 desc limit 1" }, "style":...
{ "index": 749, "split": "train" }
Which product appears first alphabetically among the products sold either by the store with the fewest products or by the store with ID 3?
store_product
select t0.product as c0 from product as t0 join store_product as t1 on t0.product_id = t1.product_id, (select store_id as c1 from store_product group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.store_id = t0.c1 or t1.store_id = 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": "store_product", "sql": "select t0.product as c0 from product as t0 join store_product as t1 on t0.product_id = t1.product_id, (select store_id as c1 from store_product group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.store_id = t0.c1 or t1.store_id = 3 order b...
{ "index": 1738, "split": "train" }
Show the purchase details and the number of purchase transactions for each purchase detail, sorted from the most to the least transactions.
tracking_share_transactions
select purchase_details as c0, count(purchase_transaction_id) as c1 from purchases group by c0 order by c1 desc
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select purchase_details as c0, count(purchase_transaction_id) as c1 from purchases group by c0 order by c1 desc" }, "style": "rule" }
{ "index": 505, "split": "train" }
Which people have the email address and first name listed, if they are students named Martin or whose details begin with "Nan"?
student_assessment
select t0.email_address, t0.first_name from people as t0 join students as t1 on t0.person_id = t1.student_id where t1.student_details = 'Martin' or t1.student_details like 'Nan%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.email_address, t0.first_name from people as t0 join students as t1 on t0.person_id = t1.student_id where t1.student_details = 'Martin' or t1.student_details like 'Nan%'" }, "style": "rule" }
{ "index": 1428, "split": "train" }
What is the total price range for hotels with star ratings that start with "1", and what are their star rating codes?
cre_Theme_park
select sum(t0.price_range), t1.star_rating_code as c0 from hotels as t0 join ref_hotel_star_ratings as t1 on t0.star_rating_code = t1.star_rating_code where c0 like '1%' 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": "cre_Theme_park", "sql": "select sum(t0.price_range), t1.star_rating_code as c0 from hotels as t0 join ref_hotel_star_ratings as t1 on t0.star_rating_code = t1.star_rating_code where c0 like '1%' group by c0" }, "style": "rule" }
{ "index": 1088, "split": "train" }
Is the salary in 2004 for the player with ID 'verlaju01' higher than the average salary of that player?
baseball_1
select t2.c1 > t1.c3 from (select salary as c1 from salary where year = 2004) as t2, (select avg(salary) as c3 from salary where player_id = 'verlaju01') as t1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "baseball_1", "sql": "select t2.c1 > t1.c3 from (select salary as c1 from salary where year = 2004) as t2, (select avg(salary) as c3 from salary where player_id = 'verlaju01') as t1" }, "style": "rule" }
{ "index": 3979, "split": "train" }
Identify the manufacturers based in the least common headquarters, and among them, find the top three manufacturers who have at most 50 revenue records each. For each of these manufacturers, what is their name and the number of their revenue entries, sorted from the manufacturers with the most revenue entries to the fe...
manufactory_1
select t0.name as c2, count(t0.revenue) as c0 from manufacturers as t0, (select headquarter as c1 from manufacturers group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.headquarter = t0.c1 group by c2 having c0 <= 50.0 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": "manufactory_1", "sql": "select t0.name as c2, count(t0.revenue) as c0 from manufacturers as t0, (select headquarter as c1 from manufacturers group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.headquarter = t0.c1 group by c2 having c0 <= 50.0 order by c0 desc lim...
{ "index": 2731, "split": "train" }