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 organisations are involved in project 13 but are not the organisation with ID 11? Please provide their organisation IDs, types, and details. | tracking_grants_for_research | select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.organisation_id as c0, t0.organisation_type as c2, t0.organisation_details as c1 from organisations as t0 join projects as t1 on t0.organisation_id = t1.organisation_id where t1.project_id = 13 except select t0.organisation_id as c0, t0.organisation_type as c2, t0.... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.organisation_id as c0, t0.organisation_type as c2, t0.organisation_details as c1 from organisations as t0 join projects as t1 on t0.organisation_id = t1.organisation_id where t1.project_... | {
"index": 2921,
"split": "train"
} | |
How much higher is the highest inventory record’s film ID for film 506 compared to film 48, considering only store 1? | sakila_1 | select t1.c1 - t0.c1 from (select max(t1.film_id) as c1 from film as t0 join inventory as t1 on t0.film_id = t1.film_id where t0.film_id = 48 and t1.store_id = 1 group by t0.film_id) as t1, (select t0.film_id, max(t1.film_id) as c1 from film as t0 join inventory as t1 on t0.film_id = t1.film_id where t0.film_id = 506 g... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "sakila_1",
"sql": "select t1.c1 - t0.c1 from (select max(t1.film_id) as c1 from film as t0 join inventory as t1 on t0.film_id = t1.film_id where t0.film_id = 48 and t1.store_id = 1 group by t0.film_id) as t1, (select t0.film_id, max(t1.film_id) as c1 from film as t0 join inventor... | {
"index": 3621,
"split": "train"
} | |
Can you tell me the first three amenities (by ID) with IDs of at least 900, including their names and the dorms they are associated with? | dorm_1 | select t0.amenid as c0, t0.amenity_name, t1.dormid from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t1.amenid >= 900 or t1.amenid > 922 order by c0 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "dorm_1",
"sql": "select t0.amenid as c0, t0.amenity_name, t1.dormid from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t1.amenid >= 900 or t1.amenid > 922 order by c0 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 845,
"split": "train"
} | |
Find the details of the first school—its name, type, and school ID—whose assigned driver is from a home city containing "artf," sorted alphabetically by school name. | school_bus | select t0.school as c2, t0.type, t0.school_id from school as t0 join school_bus as t1 on t0.school_id = t1.school_id join driver as t2 on t1.driver_id = t2.driver_id where t2.home_city like '%artf%' order by c2 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "school_bus",
"sql": "select t0.school as c2, t0.type, t0.school_id from school as t0 join school_bus as t1 on t0.school_id = t1.school_id join driver as t2 on t1.driver_id = t2.driver_id where t2.home_city like '%artf%' order by c2 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 299,
"split": "train"
} | |
When was the most recent log entry for the problem with the highest problem ID? | tracking_software_problems | select t0.log_entry_date, t0.problem_id as c1 from problem_log as t0, (select max(problem_id) as c0 from problem_log) as t1 where c1 = t1.c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t0.log_entry_date, t0.problem_id as c1 from problem_log as t0, (select max(problem_id) as c0 from problem_log) as t1 where c1 = t1.c0"
},
"style": "rule"
} | {
"index": 3814,
"split": "train"
} | |
What are the genders and first names of students who live in dorms with a dorm ID of 160 or higher and also have a record with student ID 1009? | dorm_1 | select anon_1.c0, anon_1.c1 from (select t0.sex as c0, t0.fname as c1 from student as t0 join lives_in as t1 on t0.stuid = t1.stuid where t1.stuid = 1009 intersect select t0.sex as c0, t0.fname as c1 from student as t0 join lives_in as t1 on t0.stuid = t1.stuid where t1.dormid >= 160) 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": "dorm_1",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.sex as c0, t0.fname as c1 from student as t0 join lives_in as t1 on t0.stuid = t1.stuid where t1.stuid = 1009 intersect select t0.sex as c0, t0.fname as c1 from student as t0 join lives_in as t1 on t0.stuid = t1.stuid w... | {
"index": 1035,
"split": "train"
} | |
Can you tell me the name, description, and opening hours of the earliest available attraction within the park that has a feature related to "rk" (like a park or similar)? I'm interested in just the top result, sorted by opening hours with any attractions missing opening hours listed last. | cre_Theme_park | select t0.opening_hours as c1, t0.description, t0.name from tourist_attractions as t0 join tourist_attraction_features as t1 on t0.tourist_attraction_id = t1.tourist_attraction_id join features as t2 on t1.feature_id = t2.feature_id where t2.feature_details like '%rk%' 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": "cre_Theme_park",
"sql": "select t0.opening_hours as c1, t0.description, t0.name from tourist_attractions as t0 join tourist_attraction_features as t1 on t0.tourist_attraction_id = t1.tourist_attraction_id join features as t2 on t1.feature_id = t2.feature_id where t2.feature_detai... | {
"index": 2892,
"split": "train"
} | |
For customers with custid 6 and 7, what are their three lowest checking account minimum balances, sorted by customer ID? | small_bank_1 | select min(t0.balance) from checking as t0 join accounts as t1 on t0.custid = t1.custid where t1.custid = 7 or t1.custid = 6 group by t1.custid order by t1.custid 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": "small_bank_1",
"sql": "select min(t0.balance) from checking as t0 join accounts as t1 on t0.custid = t1.custid where t1.custid = 7 or t1.custid = 6 group by t1.custid order by t1.custid asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 886,
"split": "train"
} | |
Can you tell me the IDs of the first three investors between IDs 17 and 19, sorted alphabetically by their details? | tracking_share_transactions | select t0.investor_id from investors as t0 join transactions as t1 on t0.investor_id = t1.investor_id where t1.investor_id between 17 and 19 order by t0.investor_details 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": "tracking_share_transactions",
"sql": "select t0.investor_id from investors as t0 join transactions as t1 on t0.investor_id = t1.investor_id where t1.investor_id between 17 and 19 order by t0.investor_details asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 252,
"split": "train"
} | |
Which customer has a transaction of exactly $1,475.56? | customers_card_transactions | select t0.customer_id from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.transaction_amount = 1475.56 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select t0.customer_id from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.transaction_amount = 1475.56"
},
"style": "rule"
} | {
"index": 1192,
"split": "train"
} | |
Which pilot with the alphabetically last name is associated with aircraft ID 2, and what are their Pilot Name, Pilot ID, and Team, along with the Aircraft ID and Pilot ID from their record? | pilot_record | select t0.pilot_name as c4, t0.pilot_id, t0.team, t1.aircraft_id, t1.pilot_id from pilot as t0 join pilot_record as t1 on t0.pilot_id = t1.pilot_id join aircraft as t2 on t1.aircraft_id = t2.aircraft_id where t2.aircraft_id = 2 order by c4 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": "pilot_record",
"sql": "select t0.pilot_name as c4, t0.pilot_id, t0.team, t1.aircraft_id, t1.pilot_id from pilot as t0 join pilot_record as t1 on t0.pilot_id = t1.pilot_id join aircraft as t2 on t1.aircraft_id = t2.aircraft_id where t2.aircraft_id = 2 order by c4 desc limit 1"
}... | {
"index": 2493,
"split": "train"
} | |
How many unique FDA approval statuses are there for the medicine with ID 10? | medicine_enzyme_interaction | select count(distinct (t0.fda_approved)) from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.medicine_id = 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": "medicine_enzyme_interaction",
"sql": "select count(distinct (t0.fda_approved)) from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.medicine_id = 10"
},
"style": "rule"
} | {
"index": 583,
"split": "train"
} | |
Which sexes are listed among the employees and their dependents? | company_1 | select anon_1.c1 from (select sex as c1 from employee union select sex from dependent) 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": "company_1",
"sql": "select anon_1.c1 from (select sex as c1 from employee union select sex from dependent) as anon_1"
},
"style": "rule"
} | {
"index": 20,
"split": "train"
} | |
Which activities have exactly one faculty member participating, where that faculty member's ID is either less than or equal to 8741 or less than 1121? Please provide the activity name and activity ID. | activity_1 | select t0.activity_name, t0.actid as c1 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.facid <= 8741 or t1.facid < 1121 group by c1 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": "activity_1",
"sql": "select t0.activity_name, t0.actid as c1 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.facid <= 8741 or t1.facid < 1121 group by c1 having count(*) = 1"
},
"style": "rule"
} | {
"index": 2013,
"split": "train"
} | |
Among product categories, what are the category codes, descriptions, and units of measure, along with the selling prices and product IDs of products that are associated with colors ending in "ite" or "ple"? | products_gen_characteristics | select t0.product_category_code, t0.product_category_description, t0.unit_of_measure, t1.typical_selling_price, t1.product_id from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code join ref_colors as t2 on t1.color_code = t2.color_code where t2.color_description lik... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_gen_characteristics",
"sql": "select t0.product_category_code, t0.product_category_description, t0.unit_of_measure, t1.typical_selling_price, t1.product_id from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code join r... | {
"index": 292,
"split": "train"
} | |
What are the account names and other details for accounts that have refund transactions, excluding those accounts with an ID greater than 6? | customers_card_transactions | select anon_1.c0, anon_1.c1 from (select t0.account_name as c0, t0.other_account_details as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_type = 'Refund' except select t0.account_name as c0, t0.other_account_details as c1 from accounts as t0 join financia... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.account_name as c0, t0.other_account_details as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_type = 'Refund' except select t0.accoun... | {
"index": 700,
"split": "train"
} | |
Was the guest with ID 14 born after themselves? | apartment_rentals | select date_of_birth > date_of_birth from guests where guest_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": "apartment_rentals",
"sql": "select date_of_birth > date_of_birth from guests where guest_id = 14"
},
"style": "rule"
} | {
"index": 3066,
"split": "train"
} | |
Which festival featuring a "Presenter Talent Show" with the largest audience has its details, including the number of attendees, location, festival name, and festival ID? | entertainment_awards | select t0.num_of_audience as c0, t0.location, t0.festival_name, t1.festival_id from festival_detail as t0 join nomination as t1 on t0.festival_id = t1.festival_id join artwork as t2 on t1.artwork_id = t2.artwork_id where t2.type = 'Presenter Talent Show' 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": "entertainment_awards",
"sql": "select t0.num_of_audience as c0, t0.location, t0.festival_name, t1.festival_id from festival_detail as t0 join nomination as t1 on t0.festival_id = t1.festival_id join artwork as t2 on t1.artwork_id = t2.artwork_id where t2.type = 'Presenter Talent ... | {
"index": 527,
"split": "train"
} | |
Can you tell me the investor IDs for investors who own lots with details starting with 'z', or for those who own the most common lot details in the database? | tracking_share_transactions | select t0.investor_id from investors as t0 join lots as t1 on t0.investor_id = t1.investor_id, (select lot_details as c1 from lots group by c1 order by count(investor_id) desc limit 1) as t0 where t1.lot_details like 'z%' or t1.lot_details = t0.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select t0.investor_id from investors as t0 join lots as t1 on t0.investor_id = t1.investor_id, (select lot_details as c1 from lots group by c1 order by count(investor_id) desc limit 1) as t0 where t1.lot_details like 'z%' or t1.lot_details = ... | {
"index": 941,
"split": "train"
} | |
What's the difference between the budget in millions for movie with ID 7 and 60 million? | culture_company | select budget_million - 60.0 from movie where movie_id = 7 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "culture_company",
"sql": "select budget_million - 60.0 from movie where movie_id = 7"
},
"style": "rule"
} | {
"index": 3220,
"split": "train"
} | |
Which student who plays games with ID less than 2 has the highest age, and what are their number of games played, hours played per week, and scholarship status? | game_1 | select t0.gamesplayed, t0.hoursperweek, t0.onscholarship, t1.age as c3 from sportsinfo as t0 join student as t1 on t0.stuid = t1.stuid join plays_games as t2 on t1.stuid = t2.stuid where t2.gameid < 2 order by c3 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "game_1",
"sql": "select t0.gamesplayed, t0.hoursperweek, t0.onscholarship, t1.age as c3 from sportsinfo as t0 join student as t1 on t0.stuid = t1.stuid join plays_games as t2 on t1.stuid = t2.stuid where t2.gameid < 2 order by c3 desc limit 1"
},
"style": "rule"
} | {
"index": 2631,
"split": "train"
} | |
Among the items with IDs from 4 to 7 that have reviews, which item's title appears last in reverse alphabetical order? | epinions_1 | select t0.title as c0 from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.i_id between 4 and 7 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": "epinions_1",
"sql": "select t0.title as c0 from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.i_id between 4 and 7 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 2739,
"split": "train"
} | |
Which are the five most recent customer addresses and their corresponding customer names for customers who placed orders on or after February 24, 2018, at 1:18:49 PM, with order statuses starting with "Deliv," listed in descending order of customer ID? | customers_and_addresses | select t0.customer_id as c1, t0.address_id, t1.customer_name 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 where t2.order_date >= '2018-02-24 13:18:49' and t2.order_status like 'Deliv%' order by c1 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_addresses",
"sql": "select t0.customer_id as c1, t0.address_id, t1.customer_name 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 where t2.order_date >= '2018-02-24 13... | {
"index": 2847,
"split": "train"
} | |
What are the titles and IDs of items that have at least one review with a rating higher than 6 and also have an item ID of 3 or greater? | epinions_1 | select anon_1.c0, anon_1.c1 from (select t0.title as c0, t0.i_id as c1 from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.rating > 6 intersect select t0.title as c0, t0.i_id as c1 from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.i_id >= 3) as anon_1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.title as c0, t0.i_id as c1 from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.rating > 6 intersect select t0.title as c0, t0.i_id as c1 from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.i_... | {
"index": 2502,
"split": "train"
} | |
What are the number of games played and the student IDs for students who played video games that are either multiplayer online or are walking games? | game_1 | select t0.gamesplayed, t0.stuid from sportsinfo as t0 join student as t1 on t0.stuid = t1.stuid join plays_games as t2 on t1.stuid = t2.stuid join video_games as t3 on t2.gameid = t3.gameid where t3.gtype like '%ultiplayer onli%' or t3.gtype like 'Walking%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.gamesplayed, t0.stuid from sportsinfo as t0 join student as t1 on t0.stuid = t1.stuid join plays_games as t2 on t1.stuid = t2.stuid join video_games as t3 on t2.gameid = t3.gameid where t3.gtype like '%ultiplayer onli%' or t3.gtype like 'Walking%'"
},... | {
"index": 2509,
"split": "train"
} | |
What are the region codes and names for all regions, including those affected by storms with damages of 10.75 million USD or less? | storm_record | select anon_1.c1, anon_1.c0 from (select region_code as c1, region_name as c0 from region union select t0.region_code as c1, t0.region_name as c0 from region as t0 join affected_region as t1 on t0.region_id = t1.region_id join storm as t2 on t1.storm_id = t2.storm_id where t2.damage_millions_usd <= 10.75) 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": "storm_record",
"sql": "select anon_1.c1, anon_1.c0 from (select region_code as c1, region_name as c0 from region union select t0.region_code as c1, t0.region_name as c0 from region as t0 join affected_region as t1 on t0.region_id = t1.region_id join storm as t2 on t1.storm_id = t... | {
"index": 2105,
"split": "train"
} | |
How many days have passed between the Date Valid To and the Date Valid From for the card with a number ending in 48237? | customers_card_transactions | select julianday(t1.c2) - julianday(t0.c0) from (select date_valid_to as c2 from customers_cards) as t1, (select date_valid_from as c0 from customers_cards where card_number like '%48237%' and card_number like '%48237%') 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_card_transactions",
"sql": "select julianday(t1.c2) - julianday(t0.c0) from (select date_valid_to as c2 from customers_cards) as t1, (select date_valid_from as c0 from customers_cards where card_number like '%48237%' and card_number like '%48237%') as t0"
},
"style"... | {
"index": 3696,
"split": "train"
} | |
For each job listed in the Person table, how many different jobs are there, how many genders are represented, and how many people are in each job? | network_2 | select job as c3, count(distinct (job)), count(gender), count(*) from person group by 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": "network_2",
"sql": "select job as c3, count(distinct (job)), count(gender), count(*) from person group by c3"
},
"style": "rule"
} | {
"index": 2279,
"split": "train"
} | |
What is the average invoice number for refund transactions made by account number 12? | customers_and_invoices | select t0.c1 from (select avg(t1.invoice_number) as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 12 and t1.transaction_type = 'Refund' group by t0.account_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select t0.c1 from (select avg(t1.invoice_number) as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 12 and t1.transaction_type = 'Refund' group by t0.account_id) as t0"
},
"style"... | {
"index": 3854,
"split": "train"
} | |
Which colleges have players with IDs containing "1" and are also named starting with "Hofstra Un"? For each of these colleges, what are their full names? | baseball_1 | select t0.name_full as c0 from college as t0 join player_college as t1 on t0.college_id = t1.college_id where t1.player_id like '%1%' and t1.college_id in (select t0.college_id as c1 from college where c0 like 'Hofstra Un%') | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t0.name_full as c0 from college as t0 join player_college as t1 on t0.college_id = t1.college_id where t1.player_id like '%1%' and t1.college_id in (select t0.college_id as c1 from college where c0 like 'Hofstra Un%')"
},
"style": "rule"
} | {
"index": 1022,
"split": "train"
} | |
How many days have passed between the race time and June 24, 2001? | formula_1 | select julianday(t1.c0) - julianday(t0.c1) from (select time as c0 from races) as t1, (select date as c1 from races where c1 = '2001-06-24' and c1 = '2001-06-24') 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": "formula_1",
"sql": "select julianday(t1.c0) - julianday(t0.c1) from (select time as c0 from races) as t1, (select date as c1 from races where c1 = '2001-06-24' and c1 = '2001-06-24') as t0"
},
"style": "rule"
} | {
"index": 3714,
"split": "train"
} | |
Can you tell me the five departments whose buildings start with "Lambeau," along with the smallest number of credits for courses offered by each? Please order the departments alphabetically by their name.
---? | college_2 | select min(t0.credits), t1.building as c1 from course as t0 join department as t1 on t0.dept_name = t1.dept_name where c1 like 'Lambeau%' group by t1.dept_name order by t1.dept_name asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_2",
"sql": "select min(t0.credits), t1.building as c1 from course as t0 join department as t1 on t0.dept_name = t1.dept_name where c1 like 'Lambeau%' group by t1.dept_name order by t1.dept_name asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 1334,
"split": "train"
} | |
What are the ages of persons whose friends were from before year 6? | network_2 | select t0.age from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.year < 6 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "network_2",
"sql": "select t0.age from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.year < 6"
},
"style": "rule"
} | {
"index": 150,
"split": "train"
} | |
Which submissions, associated with the most common acceptance result, were not accepted at workshop 6? Show me their scores, colleges, and authors. | workshop_paper | select anon_1.c3, anon_1.c0, anon_1.c2 from (select t0.scores as c3, t0.college as c0, t0.author as c2 from submission as t0 join acceptance as t1 on t0.submission_id = t1.submission_id, (select result as c1 from acceptance group by c1 order by count(*) desc limit 1) as t1 where t1.result = t1.c1 except select t0.score... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "workshop_paper",
"sql": "select anon_1.c3, anon_1.c0, anon_1.c2 from (select t0.scores as c3, t0.college as c0, t0.author as c2 from submission as t0 join acceptance as t1 on t0.submission_id = t1.submission_id, (select result as c1 from acceptance group by c1 order by count(*) d... | {
"index": 1137,
"split": "train"
} | |
For each order item status, what is the number of items with that status, how many unique order items are there, and what is the total sum of their order IDs? | tracking_orders | select order_item_status as c0, count(order_item_status), count(distinct (order_item_id)), sum(order_id) from order_items group by c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select order_item_status as c0, count(order_item_status), count(distinct (order_item_id)), sum(order_id) from order_items group by c0"
},
"style": "rule"
} | {
"index": 2550,
"split": "train"
} | |
Is the train number for the train with ID 1 greater than 16526? | station_weather | select train_number > 16526 from train where id = 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "station_weather",
"sql": "select train_number > 16526 from train where id = 1"
},
"style": "rule"
} | {
"index": 3300,
"split": "train"
} | |
What is the percentage difference in user 1's followers at the timestamp 2018-03-12 02:30:30? | twitter_1 | select (t0.followers / cast(t0.followers as real) - 1) * 100 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.createdate = '2018-03-12 02:30:30' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.followers / cast(t0.followers as real) - 1) * 100 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.createdate = '2018-03-12 02:30:30'"
},
"style": "rule"
} | {
"index": 3431,
"split": "train"
} | |
Which banks have both customers from the state ending with "New York" and a branch ID of 2 or higher, and what are their total number of customers and city? | loan_1 | select anon_1.c0, anon_1.c1 from (select t0.no_of_customers as c0, t0.city as c1 from bank as t0 join customer as t1 on t0.branch_id = t1.branch_id where t1.state like '%New York' intersect select t0.no_of_customers as c0, t0.city as c1 from bank as t0 join customer as t1 on t0.branch_id = t1.branch_id where t1.branch_... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "loan_1",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.no_of_customers as c0, t0.city as c1 from bank as t0 join customer as t1 on t0.branch_id = t1.branch_id where t1.state like '%New York' intersect select t0.no_of_customers as c0, t0.city as c1 from bank as t0 join custo... | {
"index": 149,
"split": "train"
} | |
Is the birthday of player 6161 later than the birthday of player 6959? | soccer_1 | select t1.c1 > t0.c1 from (select birthday as c1 from player where id = 6161) as t1, (select birthday as c1 from player where id = 6959) 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": "soccer_1",
"sql": "select t1.c1 > t0.c1 from (select birthday as c1 from player where id = 6161) as t1, (select birthday as c1 from player where id = 6959) as t0"
},
"style": "rule"
} | {
"index": 3095,
"split": "train"
} | |
What is the total sum of the course ID for enrollments in course 4 made between October 23, 2017, and November 13, 2017? | e_learning | select t0.c2 from (select sum(t1.course_id) as c2 from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id where t0.course_id = 4 and t1.date_of_enrolment between '2017-10-23 08:23:22' and '2017-11-13 12:49:33' group by t0.course_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select t0.c2 from (select sum(t1.course_id) as c2 from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id where t0.course_id = 4 and t1.date_of_enrolment between '2017-10-23 08:23:22' and '2017-11-13 12:49:33' group by t0.course_... | {
"index": 3379,
"split": "train"
} | |
What are the status, order ID, order date, and order ID from order items for the first five orders that include products with IDs 4 or less, sorted by order ID? | tracking_orders | select t0.order_status, t0.order_id, t0.date_order_placed, t1.order_id as c1 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.product_id <= 4 order by c1 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select t0.order_status, t0.order_id, t0.date_order_placed, t1.order_id as c1 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.product_id <= 4 order by c1 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2397,
"split": "train"
} | |
Could you tell me the number of enrollments and the subject IDs for the subjects where the earliest student's ID is 8 or less? Please list the results ordered by subject ID and show only the bottom three entries. | e_learning | select count(t0.course_id), t2.subject_id as c1 from student_course_enrolment as t0 join courses as t1 on t0.course_id = t1.course_id join subjects as t2 on t1.subject_id = t2.subject_id group by c1 having min(t0.student_id) <= 8 order by c1 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select count(t0.course_id), t2.subject_id as c1 from student_course_enrolment as t0 join courses as t1 on t0.course_id = t1.course_id join subjects as t2 on t1.subject_id = t2.subject_id group by c1 having min(t0.student_id) <= 8 order by c1 asc nulls last li... | {
"index": 513,
"split": "train"
} | |
What are the IDs, cities, and names of up to five airports that have flights operated by the company with ID 2, sorted by airport ID? | flight_company | select t0.id as c1, t0.city, t0.name from airport as t0 join flight as t1 on t0.id = t1.airport_id where t1.company_id between 2 and 2 order by c1 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_company",
"sql": "select t0.id as c1, t0.city, t0.name from airport as t0 join flight as t1 on t0.id = t1.airport_id where t1.company_id between 2 and 2 order by c1 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2298,
"split": "train"
} | |
Which participant types and details are not associated with any events related to services whose type starts with "Proper"? | local_govt_in_alabama | select anon_1.c1, anon_1.c0 from (select participant_type_code as c1, participant_details as c0 from participants except select t0.participant_type_code as c1, t0.participant_details as c0 from participants as t0 join participants_in_events as t1 on t0.participant_id = t1.participant_id join events as t2 on t1.event_id... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_in_alabama",
"sql": "select anon_1.c1, anon_1.c0 from (select participant_type_code as c1, participant_details as c0 from participants except select t0.participant_type_code as c1, t0.participant_details as c0 from participants as t0 join participants_in_events as t1 o... | {
"index": 1937,
"split": "train"
} | |
What is the product with the highest product ID linked to the most frequent problem reported, among products with two or fewer issues of that problem, and what is the maximum staff ID who authorized closure for those problems? Also, order the results by the product's name alphabetically and show only the first such pro... | tracking_software_problems | select t0.product_id as c1, max(t1.closure_authorised_by_staff_id) from product as t0 join problems as t1 on t0.product_id = t1.product_id, (select problem_id as c0 from problems group by c0 order by count(*) desc limit 1) as t0 where t1.problem_id = t0.c0 group by c1 having count(*) <= 2 order by t0.product_name asc n... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 c1, max(t1.closure_authorised_by_staff_id) from product as t0 join problems as t1 on t0.product_id = t1.product_id, (select problem_id as c0 from problems group by c0 order by count(*) desc limit 1) as t0 where t1.probl... | {
"index": 746,
"split": "train"
} | |
Which account IDs have an account detail value of 1168.32, and what is the smallest statement ID associated with each of these accounts? | cre_Docs_and_Epenses | select account_id as c1, min(statement_id) from accounts where account_details = 1168.32 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": "cre_Docs_and_Epenses",
"sql": "select account_id as c1, min(statement_id) from accounts where account_details = 1168.32 group by c1"
},
"style": "rule"
} | {
"index": 1346,
"split": "train"
} | |
Who are the top three employees with the highest salaries among those who are certified with employee ID 142519864, and what are their names and IDs? | flight_1 | select t0.name, t0.eid from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 142519864 order by t0.salary desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_1",
"sql": "select t0.name, t0.eid from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 142519864 order by t0.salary desc limit 3"
},
"style": "rule"
} | {
"index": 2811,
"split": "train"
} | |
Which product names and product IDs have order quantities ending with the digit 9, and what is the total of their product IDs? | customers_and_invoices | select t0.product_name, t0.product_id as c2, sum(t1.product_id) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_quantity like '%9' group by c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select t0.product_name, t0.product_id as c2, sum(t1.product_id) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_quantity like '%9' group by c2"
},
"style": "rule"
} | {
"index": 2888,
"split": "train"
} | |
Who are the first five performers and their addresses, along with the corresponding store locations and their state or county, for stores whose marketing region code includes the letter "N", sorted alphabetically by performer name? | cre_Drama_Workshop_Groups | select t0.customer_name as c3, t0.address_id, t1.address_id, t1.state_county from performers as t0 join addresses as t1 on t0.address_id = t1.address_id join stores as t2 on t1.address_id = t2.address_id where t2.marketing_region_code like '%N%' 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": "cre_Drama_Workshop_Groups",
"sql": "select t0.customer_name as c3, t0.address_id, t1.address_id, t1.state_county from performers as t0 join addresses as t1 on t0.address_id = t1.address_id join stores as t2 on t1.address_id = t2.address_id where t2.marketing_region_code like '%N%... | {
"index": 2813,
"split": "train"
} | |
What is the difference between the highest grant ID associated with an application received on September 25, 1991, and the highest grant ID for an application received on May 23, 1986, with sent dates after June 6, 2000? | tracking_grants_for_research | select t1.c2 - t0.c2 from (select max(t1.grant_id) as c2 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'APP' and t1.response_received_date = '1991-09-25 10:38:24' group by t0.document_type_code) as t1, (select t0.document_type_code, max(t1.... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select t1.c2 - t0.c2 from (select max(t1.grant_id) as c2 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'APP' and t1.response_received_date = '1991-09-25 10:38:24... | {
"index": 3529,
"split": "train"
} | |
Can you list the first 10 student participation records—including activity ID, student ID, and activity ID again—where the activities are those that involve faculty members with actid 782? Please sort these records by activity ID in ascending order. | activity_1 | select t0.actid as c0, t0.stuid, t1.actid from participates_in as t0 join activity as t1 on t0.actid = t1.actid join faculty_participates_in as t2 on t1.actid = t2.actid where t2.actid = 782 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": "activity_1",
"sql": "select t0.actid as c0, t0.stuid, t1.actid from participates_in as t0 join activity as t1 on t0.actid = t1.actid join faculty_participates_in as t2 on t1.actid = t2.actid where t2.actid = 782 order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 1807,
"split": "train"
} | |
What are the resident IDs and service IDs for residents’ services where the associated item's status was recorded between April 2, 2016, and May 31, 2017? | local_govt_and_lot | select t0.resident_id, t0.service_id from residents_services as t0 join services as t1 on t0.service_id = t1.service_id join organizations as t2 on t1.organization_id = t2.organization_id join things as t3 on t2.organization_id = t3.organization_id join timed_status_of_things as t4 on t3.thing_id = t4.thing_id where t4... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.resident_id, t0.service_id from residents_services as t0 join services as t1 on t0.service_id = t1.service_id join organizations as t2 on t1.organization_id = t2.organization_id join things as t3 on t2.organization_id = t3.organization_id jo... | {
"index": 228,
"split": "train"
} | |
Which people's IDs, names, and heights belong to gymnasts who scored between 9.55 and 9.75 on the horizontal bar but did not score 9.412 or less on the floor exercise? | gymnast | select anon_1.c1, anon_1.c2, anon_1.c0 from (select t0.people_id as c1, t0.name as c2, t0.height as c0 from people as t0 join gymnast as t1 on t0.people_id = t1.gymnast_id where t1.horizontal_bar_points between 9.55 and 9.75 except select t0.people_id as c1, t0.name as c2, t0.height as c0 from people as t0 join gymnast... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "gymnast",
"sql": "select anon_1.c1, anon_1.c2, anon_1.c0 from (select t0.people_id as c1, t0.name as c2, t0.height as c0 from people as t0 join gymnast as t1 on t0.people_id = t1.gymnast_id where t1.horizontal_bar_points between 9.55 and 9.75 except select t0.people_id as c1, t0.... | {
"index": 2297,
"split": "train"
} | |
What are the cost, code, name of the procedure, and the physician's SSN for procedures trained by the most frequently affiliated physician who is not primarily affiliated? | hospital_1 | select t0.cost, t0.code, t0.name, t2.ssn from procedures as t0 join trained_in as t1 on t0.code = t1.treatment join physician as t2 on t1.physician = t2.employeeid join affiliated_with as t3 on t2.employeeid = t3.physician, (select physician as c2 from affiliated_with group by c2 order by count(*) desc limit 1) as t0 w... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.cost, t0.code, t0.name, t2.ssn from procedures as t0 join trained_in as t1 on t0.code = t1.treatment join physician as t2 on t1.physician = t2.employeeid join affiliated_with as t3 on t2.employeeid = t3.physician, (select physician as c2 from affili... | {
"index": 1823,
"split": "train"
} | |
What are the top three job titles along with their maximum salaries and the hire dates of employees working in departments located at any of the organization's locations, where the department manager's ID is 200 or higher? Please order the results alphabetically by job title, with null job titles appearing last. | hr_1 | select t0.job_title as c3, t0.max_salary, t1.hire_date from jobs as t0 join employees as t1 on t0.job_id = t1.job_id join departments as t2 on t1.department_id = t2.department_id where t2.location_id in (select locations.location_id as c2 from locations) and t2.manager_id >= 200 order by c3 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": "hr_1",
"sql": "select t0.job_title as c3, t0.max_salary, t1.hire_date from jobs as t0 join employees as t1 on t0.job_id = t1.job_id join departments as t2 on t1.department_id = t2.department_id where t2.location_id in (select locations.location_id as c2 from locations) and t2.man... | {
"index": 1967,
"split": "train"
} | |
What are the names, types, and IDs of games played by students whose majors are less than or equal to 600 or greater than or equal to 600? | game_1 | select t0.gname, t0.gtype, t1.gameid from video_games as t0 join plays_games as t1 on t0.gameid = t1.gameid join student as t2 on t1.stuid = t2.stuid where t2.major <= 600 or t2.major >= 600 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.gname, t0.gtype, t1.gameid from video_games as t0 join plays_games as t1 on t0.gameid = t1.gameid join student as t2 on t1.stuid = t2.stuid where t2.major <= 600 or t2.major >= 600"
},
"style": "rule"
} | {
"index": 382,
"split": "train"
} | |
Which countries have at least one city with "ki" in its name, and what are their names and IDs? | sakila_1 | select t0.country, t0.country_id as c0 from country as t0 join city as t1 on t0.country_id = t1.country_id where t1.city like '%ki%' 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": "sakila_1",
"sql": "select t0.country, t0.country_id as c0 from country as t0 join city as t1 on t0.country_id = t1.country_id where t1.city like '%ki%' group by c0 having count(*) >= 1"
},
"style": "rule"
} | {
"index": 1311,
"split": "train"
} | |
What are the first five hometowns that end with "mi" or "alleros," listed in alphabetical order? | gymnast | select hometown as c0 from people where c0 like '%mi' or c0 like '%alleros' 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": "gymnast",
"sql": "select hometown as c0 from people where c0 like '%mi' or c0 like '%alleros' order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 556,
"split": "train"
} | |
How many routes originate from the airport with the ID 4248? | flight_4 | select count(*) from routes where src_apid = 4248 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_4",
"sql": "select count(*) from routes where src_apid = 4248"
},
"style": "rule"
} | {
"index": 1994,
"split": "train"
} | |
Show the top 10 apartments with apartment type codes ending in "plex" that have the highest total sum of booking IDs, along with their building IDs and apartment IDs, ordered from highest to lowest total. | apartment_rentals | select sum(t0.apt_id) as c2, t1.building_id, t1.apt_id as c1 from apartment_bookings as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.apt_type_code like '%plex' group by c1 order by c2 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "apartment_rentals",
"sql": "select sum(t0.apt_id) as c2, t1.building_id, t1.apt_id as c1 from apartment_bookings as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.apt_type_code like '%plex' group by c1 order by c2 desc limit 10"
},
"style": "rule"
} | {
"index": 923,
"split": "train"
} | |
Among customers with custid 6, who are the top three with the most savings records, and what are their names, customer IDs, and the number of such records? | small_bank_1 | select t0.name, t0.custid as c0, count(*) as c2 from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.custid = 6 or t1.custid = 6 group by c0 order by c2 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "small_bank_1",
"sql": "select t0.name, t0.custid as c0, count(*) as c2 from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.custid = 6 or t1.custid = 6 group by c0 order by c2 desc limit 3"
},
"style": "rule"
} | {
"index": 1388,
"split": "train"
} | |
Where does the flight with ID 5 rank in the list of flights with pilots containing 'pson' when sorted by company ID in ascending order? | flight_company | select t1.c2, t1.c4 as c1 from (select row_number() over (order by company_id asc nulls last) as c2, id as c4 from flight where pilot like '%pson%') as t1 where c1 = 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_company",
"sql": "select t1.c2, t1.c4 as c1 from (select row_number() over (order by company_id asc nulls last) as c2, id as c4 from flight where pilot like '%pson%') as t1 where c1 = 5"
},
"style": "rule"
} | {
"index": 3487,
"split": "train"
} | |
Is the pages per minute color for product 3 less than that for product 1? | store_product | select t1.c1 < t0.c1 from (select pages_per_minute_color as c1 from product where product_id = 3) as t1, (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 t1.c1 < t0.c1 from (select pages_per_minute_color as c1 from product where product_id = 3) as t1, (select pages_per_minute_color as c1 from product where product_id = 1) as t0"
},
"style": "rule"
} | {
"index": 3577,
"split": "train"
} | |
What is the highest total pounds recorded for any purchase? | shop_membership | select total_pounds as c0 from purchase 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": "shop_membership",
"sql": "select total_pounds as c0 from purchase order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 2869,
"split": "train"
} | |
Which track was sold in invoice line number 788? | store_1 | select track_id from invoice_lines where id = 788 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select track_id from invoice_lines where id = 788"
},
"style": "rule"
} | {
"index": 3398,
"split": "train"
} | |
Looking at dorm number 110, what is the smallest amenity ID assigned to it, provided that this smallest amenity ID is less than 902? | dorm_1 | select dormid as c1, min(amenid) from has_amenity where c1 = 110 group by c1 having min(amenid) < 902 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": "dorm_1",
"sql": "select dormid as c1, min(amenid) from has_amenity where c1 = 110 group by c1 having min(amenid) < 902 order by c1 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 1986,
"split": "train"
} | |
Find the customer ID and name of the customer who has a checking account with custid 6. | small_bank_1 | select t0.custid, t0.name from accounts as t0 join checking as t1 on t0.custid = t1.custid where t1.custid = 6 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "small_bank_1",
"sql": "select t0.custid, t0.name from accounts as t0 join checking as t1 on t0.custid = t1.custid where t1.custid = 6"
},
"style": "rule"
} | {
"index": 2663,
"split": "train"
} | |
Which are the phone numbers and IDs of up to 10 suppliers who have at most 5 product sourcing records with total purchase values not exceeding 36,274.56, ordered by their supplier IDs? | department_store | select t0.supplier_phone, t0.supplier_id as c1 from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id where t1.total_value_purchased <= 36274.56 group by c1 having count(*) <= 5 order by c1 asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select t0.supplier_phone, t0.supplier_id as c1 from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id where t1.total_value_purchased <= 36274.56 group by c1 having count(*) <= 5 order by c1 asc nulls last limit 10"
},
"... | {
"index": 877,
"split": "train"
} | |
How many entries are there in the weekly weather data for Thursdays? | station_weather | select count(*) from weekly_weather where day_of_week = 'Thursday' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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(*) from weekly_weather where day_of_week = 'Thursday'"
},
"style": "rule"
} | {
"index": 1470,
"split": "train"
} | |
What are the Enzyme IDs, whether they are associated with porphyria, and the Medicine IDs for the FDA-approved medicines ending with "o" that have the most commonly occurring medicine name? | medicine_enzyme_interaction | select t0.id, t0.porphyria, t1.medicine_id 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, (select name as c3 from medicine group by c3 order by count(*) asc nulls last limit 1) as t0 where t2.fda_approved like '%o' and t2.name = 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": "medicine_enzyme_interaction",
"sql": "select t0.id, t0.porphyria, t1.medicine_id 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, (select name as c3 from medicine group by c3 order by count(*) asc null... | {
"index": 1009,
"split": "train"
} | |
Which names and countries are associated with either climbers or mountains in the database? | climbing | select anon_1.c0, anon_1.c2 from (select name as c0, country as c2 from climber union select name, country from mountain) 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": "climbing",
"sql": "select anon_1.c0, anon_1.c2 from (select name as c0, country as c2 from climber union select name, country from mountain) as anon_1"
},
"style": "rule"
} | {
"index": 1288,
"split": "train"
} | |
Which are the ten classes with the smallest maximum number of students enrolled, where the maximum enrollment for each class is exactly 324,257 students? | college_1 | select class_code as c0 from enroll group by c0 having max(stu_num) between 324257 and 324257 order by max(stu_num) asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_1",
"sql": "select class_code as c0 from enroll group by c0 having max(stu_num) between 324257 and 324257 order by max(stu_num) asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 2647,
"split": "train"
} | |
How many days passed between the opening date and the closing date for policies that were opened after January 8, 2017? | insurance_fnol | select julianday(t1.c0) - julianday(t0.c1) from (select date_closed as c0 from customers_policies where date_opened > '2017-01-08 00:00:00' and date_opened > '2017-01-08 00:00:00') as t1, (select date_opened as c1 from customers_policies) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_fnol",
"sql": "select julianday(t1.c0) - julianday(t0.c1) from (select date_closed as c0 from customers_policies where date_opened > '2017-01-08 00:00:00' and date_opened > '2017-01-08 00:00:00') as t1, (select date_opened as c1 from customers_policies) as t0"
},
"s... | {
"index": 3724,
"split": "train"
} | |
For the county named Castlegar, can you tell me the highest number of police officers, the average crime rate, and how many different law enforcement agencies are there in each public safety location? | county_public_safety | select location as c3, max(police_officers), avg(crime_rate), count(distinct (name)) from county_public_safety where name = 'Castlegar' group by 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": "county_public_safety",
"sql": "select location as c3, max(police_officers), avg(crime_rate), count(distinct (name)) from county_public_safety where name = 'Castlegar' group by c3"
},
"style": "rule"
} | {
"index": 1105,
"split": "train"
} | |
How many records are there in the database that do not have an ID of 9? | swimming | select count(*) from record where id != 9 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "swimming",
"sql": "select count(*) from record where id != 9"
},
"style": "rule"
} | {
"index": 1052,
"split": "train"
} | |
Show the elevation and names of airports that are connected through routes operated by airlines with names containing "Bal" or exactly "Ethiopian Airlines", sorted by elevation with any missing values at the end. | flight_4 | select t0.elevation as c1, t0.name from airports as t0 join routes as t1 on t0.apid = t1.src_apid join airlines as t2 on t1.alid = t2.alid where t2.name like '%Bal%' or t2.name = 'Ethiopian Airlines' order by c1 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": "flight_4",
"sql": "select t0.elevation as c1, t0.name from airports as t0 join routes as t1 on t0.apid = t1.src_apid join airlines as t2 on t1.alid = t2.alid where t2.name like '%Bal%' or t2.name = 'Ethiopian Airlines' order by c1 asc nulls last"
},
"style": "rule"
} | {
"index": 1160,
"split": "train"
} | |
What activity IDs is student 1030 participating in? | activity_1 | select actid from participates_in where stuid = 1030 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 actid from participates_in where stuid = 1030"
},
"style": "rule"
} | {
"index": 3352,
"split": "train"
} | |
Find the unit of measure and description for product categories that include products with a typical selling price of 17,595,111.4. | products_gen_characteristics | select t0.unit_of_measure, t0.product_category_description from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code where t1.typical_selling_price = 17595111.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": "products_gen_characteristics",
"sql": "select t0.unit_of_measure, t0.product_category_description from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code where t1.typical_selling_price = 17595111.4"
},
"style": "rule"
} | {
"index": 2455,
"split": "train"
} | |
What are the address IDs of the first five addresses that have the most common zip code and include the letter "i" in their address line? | behavior_monitoring | select count(t0.address_id) from student_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id, (select zip_postcode as c0 from addresses group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.zip_postcode = t0.c0 and t1.line_1 like '%i%' group by t1.address_id order by t1.address_id asc n... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(t0.address_id) from student_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id, (select zip_postcode as c0 from addresses group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.zip_postcode = t0.c0 and t1... | {
"index": 1599,
"split": "train"
} | |
What is the percentage change between the sum of customers' earliest booking IDs associated with payments made at 3:07 AM and those made at 3:51 PM on March 17, 2018? | products_for_hire | select (sum(t0.c1) / cast(sum(t1.c1) as real) - 1) * 100 from (select min(t1.booking_id) as c1 from customers as t0 join payments as t1 on t0.customer_id = t1.customer_id where t1.payment_date = '2018-03-17 15:51:52' group by t0.customer_id) as t0, (select t0.customer_id, min(t1.booking_id) as c1 from customers as t0 j... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_for_hire",
"sql": "select (sum(t0.c1) / cast(sum(t1.c1) as real) - 1) * 100 from (select min(t1.booking_id) as c1 from customers as t0 join payments as t1 on t0.customer_id = t1.customer_id where t1.payment_date = '2018-03-17 15:51:52' group by t0.customer_id) as t0, (se... | {
"index": 3041,
"split": "train"
} | |
Could you show me the identifier of the course ranked seventh in terms of total enrollments completed on or before March 14, 2018? | e_learning | select t1.c1, t1.c3 as c2 from (select row_number() over (order by t0.c4 desc) as c1, t0.c0 as c3 from (select t0.course_id as c0, sum(t1.course_id) as c4 from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id where t1.date_of_completion <= '2018-03-14 23:33:47' group by c0) as t0) as t1 ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select t1.c1, t1.c3 as c2 from (select row_number() over (order by t0.c4 desc) as c1, t0.c0 as c3 from (select t0.course_id as c0, sum(t1.course_id) as c4 from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id where t1.date_of_c... | {
"index": 3484,
"split": "train"
} | |
What are the gender, last name, city code, first name, and student ID of students either directly listed or living in dorms that have the amenity with ID 109? | dorm_1 | select anon_1.c0, anon_1.c4, anon_1.c1, anon_1.c3, anon_1.c2 from (select sex as c0, lname as c4, city_code as c1, fname as c3, stuid as c2 from student union select t0.sex as c0, t0.lname as c4, t0.city_code as c1, t0.fname as c3, t0.stuid as c2 from student as t0 join lives_in as t1 on t0.stuid = t1.stuid join dorm a... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "dorm_1",
"sql": "select anon_1.c0, anon_1.c4, anon_1.c1, anon_1.c3, anon_1.c2 from (select sex as c0, lname as c4, city_code as c1, fname as c3, stuid as c2 from student union select t0.sex as c0, t0.lname as c4, t0.city_code as c1, t0.fname as c3, t0.stuid as c2 from student as ... | {
"index": 595,
"split": "train"
} | |
What is the percentage change in the highest minimum investor ID across all transaction types between December 30, 1997, and January 28, 1981? | tracking_share_transactions | select (max(t0.c1) / cast(max(t1.c1) as real) - 1) * 100 from (select min(t1.investor_id) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.date_of_transaction = '1981-01-28 08:07:03' group by t0.transaction_type_code) as t0, (select t0.transa... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (max(t0.c1) / cast(max(t1.c1) as real) - 1) * 100 from (select min(t1.investor_id) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.date_of_transaction = '19... | {
"index": 3059,
"split": "train"
} | |
Can you list the company IDs for offices located in the building that has the fewest company offices, sorted by company ID? | company_office | select 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 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": "company_office",
"sql": "select 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 asc nulls last"
},
"style": "rule"
} | {
"index": 1701,
"split": "train"
} | |
Find the last names and student IDs of students who have not been involved in any incidents classified as Violence. | behavior_monitoring | select anon_1.c0, anon_1.c1 from (select last_name as c0, student_id as c1 from students except select t0.last_name as c0, t0.student_id as c1 from students as t0 join behavior_incident as t1 on t0.student_id = t1.student_id join ref_incident_type as t2 on t1.incident_type_code = t2.incident_type_code where t2.incident... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c1 from (select last_name as c0, student_id as c1 from students except select t0.last_name as c0, t0.student_id as c1 from students as t0 join behavior_incident as t1 on t0.student_id = t1.student_id join ref_incident_type as... | {
"index": 393,
"split": "train"
} | |
Find the five grape varieties along with their colors and sales volumes (cases) that come from the least common wine region or regions containing "royo Grande Valley", sorted by the fewest cases. | wine_1 | select t0.color, t0.grape, t1.cases as c0 from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation, (select appelation as c2 from appellations group by c2 order by count(*) asc nulls last limit 1) as t0 where t2.appelation = t0.c2 or t2.appelation like '%royo Gra... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "wine_1",
"sql": "select t0.color, t0.grape, t1.cases as c0 from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation, (select appelation as c2 from appellations group by c2 order by count(*) asc nulls last limit 1) as t0 whe... | {
"index": 431,
"split": "train"
} | |
Did customer 8 become a customer after customer 6? | customers_and_addresses | select t1.c2 > t0.c2 from (select date_became_customer as c2 from customers where customer_id = 8) as t1, (select date_became_customer as c2 from customers where customer_id = 6) 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 = 8) as t1, (select date_became_customer as c2 from customers where customer_id = 6) as t0"
},
"style": "rule"
} | {
"index": 3075,
"split": "train"
} | |
What are the three most recent dates when orders containing item 15 were placed? | tracking_orders | select t0.date_order_placed as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.order_item_id = 15 order by c0 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select t0.date_order_placed as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.order_item_id = 15 order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 1641,
"split": "train"
} | |
Was the percentage change in the complaint-related measure for product 118 on August 6, 1977, greater than the product’s own average on that day? | customer_complaints | select abs((t2.c4 / cast(t2.c4 as real) - 1) * 100) > t1.c1 from (select avg(t1.product_id) as c4 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.date_complaint_raised = '1977-08-06 00:31:19' group by t0.product_id) as t2, (select abs((sum(t0.c4) / cast(sum(t0... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select abs((t2.c4 / cast(t2.c4 as real) - 1) * 100) > t1.c1 from (select avg(t1.product_id) as c4 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.date_complaint_raised = '1977-08-06 00:31:19... | {
"index": 3440,
"split": "train"
} | |
What are the profits in billion dollars, sales in billion dollars, and the main industry for each company that owns gas stations opened on or before 2007? Include the station IDs for those stations. | gas_company | select t0.profits_billion, t0.sales_billion, t0.main_industry, t1.station_id from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id where t2.open_year <= 2007 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "gas_company",
"sql": "select t0.profits_billion, t0.sales_billion, t0.main_industry, t1.station_id from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id where t2.open_year <= 2007"
},
"style": "r... | {
"index": 2577,
"split": "train"
} | |
What are the unique combinations of train IDs and station IDs for the train stations? | train_station | select distinct train_id, station_id from train_station | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "train_station",
"sql": "select distinct train_id, station_id from train_station"
},
"style": "rule"
} | {
"index": 1953,
"split": "train"
} | |
How many events has the participant with ID 64 participated in? | local_govt_in_alabama | select count(*) from participants_in_events where participant_id = 64 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_in_alabama",
"sql": "select count(*) from participants_in_events where participant_id = 64"
},
"style": "rule"
} | {
"index": 1476,
"split": "train"
} | |
What are the names of the department store chains that have IDs less than 4 or are specifically the ones with IDs 2 and 3? | department_store | select t0.dept_store_chain_name from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id where t1.dept_store_chain_id < 4 or t1.dept_store_chain_id between 2 and 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": "department_store",
"sql": "select t0.dept_store_chain_name from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id where t1.dept_store_chain_id < 4 or t1.dept_store_chain_id between 2 and 3"
},
"style": "rule"
} | {
"index": 1175,
"split": "train"
} | |
What is the least common People ID for individuals whose names contain "ningh"? | perpetrator | select t0.c0 as c2, count(distinct (t0.c0)) as c1 from (select people_id as c0 from people where name like '%ningh%') as t0 group by c2 order by c1 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "perpetrator",
"sql": "select t0.c0 as c2, count(distinct (t0.c0)) as c1 from (select people_id as c0 from people where name like '%ningh%') as t0 group by c2 order by c1 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 3669,
"split": "train"
} | |
Which customers became customers between February 25, 2018, 1:15 PM and February 26, 2018, 11:57 AM, and what are their associated address IDs? Please list them starting from the customer with the highest ID. | customers_and_addresses | select t0.customer_id as c0, t0.address_id from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_became_customer between '2018-02-25 13:15:04' and '2018-02-26 11:57:47' order by c0 desc | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_addresses",
"sql": "select t0.customer_id as c0, t0.address_id from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_became_customer between '2018-02-25 13:15:04' and '2018-02-26 11:57:47' order by c0 desc"
},
"style... | {
"index": 578,
"split": "train"
} | |
Among all order item statuses, which one comes first alphabetically, and what is the total sum of Product IDs for that status? | tracking_orders | select sum(product_id) from order_items group by order_item_status order by order_item_status asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select sum(product_id) from order_items group by order_item_status order by order_item_status asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2230,
"split": "train"
} | |
Can you list the names and rankings of departments along with their department IDs where the department heads are older than 52 years? | department_management | select t0.name, t0.ranking, t1.department_id from department as t0 join management as t1 on t0.department_id = t1.department_id join head as t2 on t1.head_id = t2.head_id where t2.age > 52.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": "department_management",
"sql": "select t0.name, t0.ranking, t1.department_id from department as t0 join management as t1 on t0.department_id = t1.department_id join head as t2 on t1.head_id = t2.head_id where t2.age > 52.0"
},
"style": "rule"
} | {
"index": 239,
"split": "train"
} | |
How many days does it take for a student to complete a course after enrolling? | e_learning | select julianday(t1.c2) - julianday(t0.c1) from (select date_of_enrolment as c2 from student_course_enrolment) as t1, (select date_of_completion as c1 from student_course_enrolment where date_of_enrolment <= '2017-08-20 01:07:18' and date_of_enrolment <= '2017-08-20 01:07:18') 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_enrolment as c2 from student_course_enrolment) as t1, (select date_of_completion as c1 from student_course_enrolment where date_of_enrolment <= '2017-08-20 01:07:18' and date_of_enrolment <= '201... | {
"index": 3712,
"split": "train"
} | |
What is the smallest instructor ID among the advisors? | college_2 | select i_id as c0 from advisor order by c0 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_2",
"sql": "select i_id as c0 from advisor order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2286,
"split": "train"
} | |
What is the percentage change in the average customer ID among customers who placed orders on December 9, 1982, compared to those who ordered on January 18, 1976? | tracking_orders | select (avg(t0.c2) / cast(avg(t1.c2) as real) - 1) * 100 from (select avg(t1.customer_id) as c2 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t1.date_order_placed = '1982-12-09 09:42:23' group by t0.customer_id) as t0, (select t0.customer_id, avg(t1.customer_id) as c2 from customers as... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select (avg(t0.c2) / cast(avg(t1.c2) as real) - 1) * 100 from (select avg(t1.customer_id) as c2 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t1.date_order_placed = '1982-12-09 09:42:23' group by t0.customer_id) as t0, (... | {
"index": 3057,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.