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 |
|---|---|---|---|---|---|---|---|---|
List the names, maximum wind speeds, storm IDs, death tolls, and damages in millions of USD for all storms, including those that affected regions with names ending in " Republic. | storm_record | select anon_1.c3, anon_1.c1, anon_1.c0, anon_1.c2, anon_1.c4 from (select name as c3, max_speed as c1, storm_id as c0, number_deaths as c2, damage_millions_usd as c4 from storm union select t0.name as c3, t0.max_speed as c1, t0.storm_id as c0, t0.number_deaths as c2, t0.damage_millions_usd as c4 from storm as t0 join 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": "storm_record",
"sql": "select anon_1.c3, anon_1.c1, anon_1.c0, anon_1.c2, anon_1.c4 from (select name as c3, max_speed as c1, storm_id as c0, number_deaths as c2, damage_millions_usd as c4 from storm union select t0.name as c3, t0.max_speed as c1, t0.storm_id as c0, t0.number_dea... | {
"index": 2227,
"split": "train"
} | |
Can you tell me the top 5 film market estimation types and their highest market IDs, where each type's maximum market ID is either between 1 and 2, and the estimated market value is either very high (at least 80,000) or very low (16 or less), sorted alphabetically by type? | film_rank | select type as c1, max(market_id) from film_market_estimation where low_estimate >= 80000.0 or low_estimate <= 16.0 group by c1 having max(market_id) between 1 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": "film_rank",
"sql": "select type as c1, max(market_id) from film_market_estimation where low_estimate >= 80000.0 or low_estimate <= 16.0 group by c1 having max(market_id) between 1 and 2 order by c1 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 1053,
"split": "train"
} | |
How many architects are there in the database? | architecture | select count(*) from architect | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "architecture",
"sql": "select count(*) from architect"
},
"style": "rule"
} | {
"index": 852,
"split": "train"
} | |
For each home team that played at stadiums with IDs up to 8 and has an ID of 1, what are the latest 10 seasons they played in, listed in reverse alphabetical order by team name? | game_injury | select max(season) from game where stadium_id <= 8 and id = 1 group by home_team order by home_team 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": "game_injury",
"sql": "select max(season) from game where stadium_id <= 8 and id = 1 group by home_team order by home_team desc limit 10"
},
"style": "rule"
} | {
"index": 1241,
"split": "train"
} | |
Which are the latest 10 assets that have exactly one part associated with them? For each, list the asset ID and confirm that it has only one related part. | assets_maintenance | select asset_id as c0, count(part_id) from asset_parts group by c0 having count(part_id) = 1 order by c0 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "assets_maintenance",
"sql": "select asset_id as c0, count(part_id) from asset_parts group by c0 having count(part_id) = 1 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 2527,
"split": "train"
} | |
Is there a record for the student with stuid 1009, and if so, what is their stuid? | allergy_1 | select stuid as c0 from has_allergy where c0 = 1009 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": "allergy_1",
"sql": "select stuid as c0 from has_allergy where c0 = 1009 order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2332,
"split": "train"
} | |
For the country or countries linked to the team that appears most often in the match seasons, what are their native languages, capitals, country IDs, and what is the team name along with the draft pick number during those seasons? | match_season | select t0.official_native_language, t0.capital, t0.country_id, t1.team, t1.draft_pick_number from country as t0 join match_season as t1 on t0.country_id = t1.country join team as t2 on t1.team = t2.team_id, (select name as c5 from team group by c5 order by count(*) asc nulls last limit 1) as t0 where t2.name = t0.c5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "match_season",
"sql": "select t0.official_native_language, t0.capital, t0.country_id, t1.team, t1.draft_pick_number from country as t0 join match_season as t1 on t0.country_id = t1.country join team as t2 on t1.team = t2.team_id, (select name as c5 from team group by c5 order by ... | {
"index": 376,
"split": "train"
} | |
What is the number of days between the date a document arrived at location x and the date it was moved out of that location? | cre_Doc_Tracking_DB | select julianday(t1.c0) - julianday(t0.c2) from (select date_in_location_from as c0 from document_locations where location_code = 'x' and location_code = 'x') as t1, (select date_in_locaton_to as c2 from document_locations) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Tracking_DB",
"sql": "select julianday(t1.c0) - julianday(t0.c2) from (select date_in_location_from as c0 from document_locations where location_code = 'x' and location_code = 'x') as t1, (select date_in_locaton_to as c2 from document_locations) as t0"
},
"style": "ru... | {
"index": 3976,
"split": "train"
} | |
How many days are there between each customer's date of birth and the date they became a customer? | driving_school | select julianday(t1.c1) - julianday(t0.c0) from (select date_became_customer as c1 from customers) as t1, (select date_of_birth as c0 from customers) 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": "driving_school",
"sql": "select julianday(t1.c1) - julianday(t0.c0) from (select date_became_customer as c1 from customers) as t1, (select date_of_birth as c0 from customers) as t0"
},
"style": "rule"
} | {
"index": 3913,
"split": "train"
} | |
What are the gradepoints and lettergrades for students who are either older than the oldest student or as old as the youngest student, arranged in alphabetical order of their lettergrades? | college_3 | select t0.gradepoint, t0.lettergrade as c0 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade join student as t2 on t1.stuid = t2.stuid, (select max(age) as c2 from student) as t1, (select min(age) as c1 from student) as t0 where t2.age > t1.c2 or t2.age = t0.c1 order by c0 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": "college_3",
"sql": "select t0.gradepoint, t0.lettergrade as c0 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade join student as t2 on t1.stuid = t2.stuid, (select max(age) as c2 from student) as t1, (select min(age) as c1 from student) as t0 where t2... | {
"index": 1881,
"split": "train"
} | |
For players who are either 78 inches tall or between 68 and 73 inches tall, what are the average year they appeared as All-Stars, their birth country, and their player ID? | baseball_1 | select avg(t0.year), t1.birth_country, t1.player_id as c2 from all_star as t0 join player as t1 on t0.player_id = t1.player_id where t1.height = 78 or t1.height between 68 and 73 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": "baseball_1",
"sql": "select avg(t0.year), t1.birth_country, t1.player_id as c2 from all_star as t0 join player as t1 on t0.player_id = t1.player_id where t1.height = 78 or t1.height between 68 and 73 group by c2"
},
"style": "rule"
} | {
"index": 251,
"split": "train"
} | |
What are the top 10 target users trusted by user 1, including how many trust relationships they have, the total trust score assigned to them, and their user names and IDs, for those with fewer than 5 trust links from user 1, ordered by their user IDs? | epinions_1 | select count(t0.target_u_id), sum(t0.trust), t1.name, t1.u_id as c3 from trust as t0 join useracct as t1 on t0.source_u_id = t1.u_id where c3 = 1 group by c3 having count(*) < 5 order by c3 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": "epinions_1",
"sql": "select count(t0.target_u_id), sum(t0.trust), t1.name, t1.u_id as c3 from trust as t0 join useracct as t1 on t0.source_u_id = t1.u_id where c3 = 1 group by c3 having count(*) < 5 order by c3 desc limit 10"
},
"style": "rule"
} | {
"index": 1593,
"split": "train"
} | |
Find the 300-meter times and IDs of swimmers who either participated in the event with ID 1 or set records in events held in years ending with the digit 6. | swimming | select anon_1.c0, anon_1.c1 from (select t0.meter_300 as c0, t0.id as c1 from swimmer as t0 join record as t1 on t0.id = t1.swimmer_id join event as t2 on t1.event_id = t2.id where t2.id = 1 union select t0.meter_300 as c0, t0.id as c1 from swimmer as t0 join record as t1 on t0.id = t1.swimmer_id join event as t2 on 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": "swimming",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.meter_300 as c0, t0.id as c1 from swimmer as t0 join record as t1 on t0.id = t1.swimmer_id join event as t2 on t1.event_id = t2.id where t2.id = 1 union select t0.meter_300 as c0, t0.id as c1 from swimmer as t0 join r... | {
"index": 1982,
"split": "train"
} | |
How many years after 1883 was the most recently founded institution in building 0? | protein_institute | select t0.c1 - 1883.0 from (select max(t1.founded) as c1 from building as t0 join institution as t1 on t0.building_id = t1.building_id where t0.building_id = 0 group by t0.building_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": "protein_institute",
"sql": "select t0.c1 - 1883.0 from (select max(t1.founded) as c1 from building as t0 join institution as t1 on t0.building_id = t1.building_id where t0.building_id = 0 group by t0.building_id) as t0"
},
"style": "rule"
} | {
"index": 3249,
"split": "train"
} | |
Show the details of the top 5 trains—their names, services, and departure times—along with the station ID of stations they serve, where the stations have between 3.018 and 3.022 annual interchanges, ordered by station ID from highest to lowest. | train_station | select t0.name, t0.service, t0.time, t1.station_id as c3 from train as t0 join train_station as t1 on t0.train_id = t1.train_id join station as t2 on t1.station_id = t2.station_id where t2.annual_interchanges between 3.018 and 3.022 order by c3 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": "train_station",
"sql": "select t0.name, t0.service, t0.time, t1.station_id as c3 from train as t0 join train_station as t1 on t0.train_id = t1.train_id join station as t2 on t1.station_id = t2.station_id where t2.annual_interchanges between 3.018 and 3.022 order by c3 desc limit ... | {
"index": 1508,
"split": "train"
} | |
Find the titles and IDs of the top 10 items, along with the total of their review ratings, for reviews made by users with IDs greater than 1 and items with IDs of 7 or higher, sorted in reverse alphabetical order by item title. | epinions_1 | select t0.title as c1, t0.i_id as c2, sum(t1.rating) from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.u_id > 1 and t1.i_id >= 7 group by c2 order by c1 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select t0.title as c1, t0.i_id as c2, sum(t1.rating) from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.u_id > 1 and t1.i_id >= 7 group by c2 order by c1 desc limit 10"
},
"style": "rule"
} | {
"index": 532,
"split": "train"
} | |
Which customer IDs have transactions that include the word "men" or end with "nt," and what are their associated card IDs? Please list the customer IDs in descending order. | customers_card_transactions | select t0.customer_id as c0 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.transaction_type like '%men%' or t1.transaction_type like '%nt' 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_card_transactions",
"sql": "select t0.customer_id as c0 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t1.transaction_type like '%men%' or t1.transaction_type like '%nt' order by c0 desc"
},
"style": "rule"
} | {
"index": 2701,
"split": "train"
} | |
Can you show me all the temperature records where the December temperature is exactly 26.7? | city_record | select * from temperature where dec = 26.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": "city_record",
"sql": "select * from temperature where dec = 26.7"
},
"style": "rule"
} | {
"index": 772,
"split": "train"
} | |
For each bank branch, what are the top 10 branches based on the highest number of customers, including the total number of rows and the number of unique cities associated with each branch? | loan_1 | select branch_id as c1, count(*), count(distinct (city)) from bank group by c1 order by max(no_of_customers) 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": "loan_1",
"sql": "select branch_id as c1, count(*), count(distinct (city)) from bank group by c1 order by max(no_of_customers) desc limit 10"
},
"style": "rule"
} | {
"index": 2899,
"split": "train"
} | |
Which unique protein names are associated with their institution IDs? | protein_institute | select distinct protein_name, institution_id from protein | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "protein_institute",
"sql": "select distinct protein_name, institution_id from protein"
},
"style": "rule"
} | {
"index": 1979,
"split": "train"
} | |
How many days passed between the order date and the actual delivery date for order number 8? | cre_Drama_Workshop_Groups | select julianday(t1.c1) - julianday(t0.c3) from (select actual_delivery_date as c1 from customer_orders where order_id = 8 and order_id = 8) as t1, (select order_date as c3 from customer_orders) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Drama_Workshop_Groups",
"sql": "select julianday(t1.c1) - julianday(t0.c3) from (select actual_delivery_date as c1 from customer_orders where order_id = 8 and order_id = 8) as t1, (select order_date as c3 from customer_orders) as t0"
},
"style": "rule"
} | {
"index": 3685,
"split": "train"
} | |
How many injury accidents have been recorded in the database? | game_injury | select count(*) from injury_accident | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "game_injury",
"sql": "select count(*) from injury_accident"
},
"style": "rule"
} | {
"index": 1357,
"split": "train"
} | |
Does the total altitude of flights at airport 8 exceed the total altitude of flights at airport 4 where the pilot's name begins with "Thomps"? | flight_company | select t1.c1 > t0.c1 from (select sum(t1.altitude) as c1 from airport as t0 join flight as t1 on t0.id = t1.airport_id where t0.id = 4 and t1.pilot like 'Thomps%' group by t0.id) as t1, (select t0.id, sum(t1.altitude) as c1 from airport as t0 join flight as t1 on t0.id = t1.airport_id where t0.id = 8 group by t0.id) 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": "flight_company",
"sql": "select t1.c1 > t0.c1 from (select sum(t1.altitude) as c1 from airport as t0 join flight as t1 on t0.id = t1.airport_id where t0.id = 4 and t1.pilot like 'Thomps%' group by t0.id) as t1, (select t0.id, sum(t1.altitude) as c1 from airport as t0 join flight ... | {
"index": 3548,
"split": "train"
} | |
Which premise is ranked fifth based on the descending average of its premise ID among premises whose type ends with 'e'? | customers_campaigns_ecommerce | select t1.c0, t1.c1 as c3 from (select row_number() over (order by t0.c5 desc) as c0, t0.c4 as c1 from (select t0.premise_id as c4, avg(t1.premise_id) as c5 from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id where t0.premises_type like '%e' group by c4) as t0) as t1 where c3 = 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_campaigns_ecommerce",
"sql": "select t1.c0, t1.c1 as c3 from (select row_number() over (order by t0.c5 desc) as c0, t0.c4 as c1 from (select t0.premise_id as c4, avg(t1.premise_id) as c5 from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id ... | {
"index": 3477,
"split": "train"
} | |
What are the top five job titles along with their maximum and minimum salaries, for jobs that are either in the department with the fewest employees or in departments that do not include employees earning between 11,500 and 24,000 with last names starting with "K," ordered by job title from Z to A? | hr_1 | select t0.job_title as c3, t0.max_salary, t0.min_salary 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, (select department_id as c4 from departments group by c4 order by count(*) asc nulls last limit 1) as t1 where t2.department_id = t1.c4 or ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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, t0.min_salary 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, (select department_id as c4 from departments group by c4 order by count(*) asc nulls... | {
"index": 895,
"split": "train"
} | |
Which journalist, with the highest ID among those who reported on events attended by at least the average number of spectators, has their name, nationality, age, the type of work they performed in the report, and their journalist ID? | news_report | select t0.name, t0.nationality, t0.age, t1.work_type, t1.journalist_id as c1 from journalist as t0 join news_report as t1 on t0.journalist_id = t1.journalist_id join event as t2 on t1.event_id = t2.event_id, (select avg(event_attendance) as c0 from event) as t0 where t2.event_attendance >= t0.c0 order by c1 desc limit ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "news_report",
"sql": "select t0.name, t0.nationality, t0.age, t1.work_type, t1.journalist_id as c1 from journalist as t0 join news_report as t1 on t0.journalist_id = t1.journalist_id join event as t2 on t1.event_id = t2.event_id, (select avg(event_attendance) as c0 from event) as... | {
"index": 1094,
"split": "train"
} | |
What is the percentage increase or decrease in the total supportrepid amount for all customers between February 26, 2010, and February 9, 2010? | chinook_1 | select (sum(t0.c2) / cast(sum(t1.c2) as real) - 1) * 100 from (select t0.supportrepid as c2 from customer as t0 join invoice as t1 on t0.customerid = t1.customerid where t1.invoicedate = '2010-02-09 00:00:00') as t0, (select t0.supportrepid as c2, t0.customerid from customer as t0 join invoice as t1 on t0.customerid = ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "chinook_1",
"sql": "select (sum(t0.c2) / cast(sum(t1.c2) as real) - 1) * 100 from (select t0.supportrepid as c2 from customer as t0 join invoice as t1 on t0.customerid = t1.customerid where t1.invoicedate = '2010-02-09 00:00:00') as t0, (select t0.supportrepid as c2, t0.customeri... | {
"index": 3007,
"split": "train"
} | |
For each gymnast whose total points are below 57.398, what is the lowest floor exercise score, with the results ordered by their gymnast ID? | gymnast | select min(floor_exercise_points) from gymnast where total_points < 57.398 group by gymnast_id order by gymnast_id 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": "gymnast",
"sql": "select min(floor_exercise_points) from gymnast where total_points < 57.398 group by gymnast_id order by gymnast_id asc nulls last"
},
"style": "rule"
} | {
"index": 2423,
"split": "train"
} | |
For each customer who has fewer than 925 invoice line items, what is the highest invoice ID they have, and which country are they from? | store_1 | select max(t0.invoice_id), t2.country from invoice_lines as t0 join invoices as t1 on t0.invoice_id = t1.id join customers as t2 on t1.customer_id = t2.id group by t2.id having count(*) < 925 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 max(t0.invoice_id), t2.country from invoice_lines as t0 join invoices as t1 on t0.invoice_id = t1.id join customers as t2 on t1.customer_id = t2.id group by t2.id having count(*) < 925"
},
"style": "rule"
} | {
"index": 139,
"split": "train"
} | |
Who is the oldest player attending a school in a division that starts with "Division," and what is their age? | school_player | select t0.player, t0.age as c1 from player as t0 join school as t1 on t0.school_id = t1.school_id join school_details as t2 on t1.school_id = t2.school_id where t2.division like 'Division%' order by c1 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "school_player",
"sql": "select t0.player, t0.age as c1 from player as t0 join school as t1 on t0.school_id = t1.school_id join school_details as t2 on t1.school_id = t2.school_id where t2.division like 'Division%' order by c1 desc limit 1"
},
"style": "rule"
} | {
"index": 2242,
"split": "train"
} | |
What are the names and IDs of each artist, along with the average track ID of their songs and the number of unique invoices that include their tracks? | store_1 | select t0.name, t0.id as c0, avg(t3.track_id), count(distinct (t3.invoice_id)) from artists as t0 join albums as t1 on t0.id = t1.artist_id join tracks as t2 on t1.id = t2.album_id join invoice_lines as t3 on t2.id = t3.track_id group by c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select t0.name, t0.id as c0, avg(t3.track_id), count(distinct (t3.invoice_id)) from artists as t0 join albums as t1 on t0.id = t1.artist_id join tracks as t2 on t1.id = t2.album_id join invoice_lines as t3 on t2.id = t3.track_id group by c0"
},
"style": "rul... | {
"index": 1615,
"split": "train"
} | |
Which matches are both hosted in cities whose names end with "6" and have competitions that either end with "tion" or start with "Fri"? For these matches, what are the competitions and dates? | city_record | select anon_1.c0, anon_1.c1 from (select t0.competition as c0, t0.date as c1 from match as t0 join hosting_city as t1 on t0.match_id = t1.match_id where t1.match_id in (select match_id from match where c0 like '%tion' or c0 like 'Fri%') intersect select t0.competition as c0, t0.date as c1 from match as t0 join hosting_... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "city_record",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.competition as c0, t0.date as c1 from match as t0 join hosting_city as t1 on t0.match_id = t1.match_id where t1.match_id in (select match_id from match where c0 like '%tion' or c0 like 'Fri%') intersect select t0.c... | {
"index": 1407,
"split": "train"
} | |
How many friendships does each person from a city ending with "y" have, and what is their name? | network_2 | select count(*), t0.name as c1 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.city like '%y' 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": "network_2",
"sql": "select count(*), t0.name as c1 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.city like '%y' group by c1"
},
"style": "rule"
} | {
"index": 2336,
"split": "train"
} | |
Which last names have a maximum major value between 50 and 520, among students who are either between 16 and 20 years old or at least 26 years old? And what are those last names along with their respective maximum major values? | voter_2 | select lname as c1, max(major) from student where age between 16 and 20 or age >= 26 group by c1 having max(major) between 50 and 520 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "voter_2",
"sql": "select lname as c1, max(major) from student where age between 16 and 20 or age >= 26 group by c1 having max(major) between 50 and 520"
},
"style": "rule"
} | {
"index": 2186,
"split": "train"
} | |
Which photo color has the fewest photos named "wolfs," with at most four such photos, and what is that count? | mountain_photos | select color as c0, count(name) as c1 from photos where name = 'wolfs' group by c0 having count(*) <= 4 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": "mountain_photos",
"sql": "select color as c0, count(name) as c1 from photos where name = 'wolfs' group by c0 having count(*) <= 4 order by c1 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 1639,
"split": "train"
} | |
What are the first three transaction types for financial transactions involving accounts with IDs less than or equal to 1 or greater than or equal to 4, ordered by account ID? | customers_card_transactions | select transaction_type from financial_transactions where account_id <= 1 or account_id >= 4 order by account_id asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select transaction_type from financial_transactions where account_id <= 1 or account_id >= 4 order by account_id asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 2774,
"split": "train"
} | |
Can you tell me the highest (last in reverse alphabetical order) form type code for the form with ID 5? | e_government | select t0.form_type_code as c0 from forms as t0 join party_forms as t1 on t0.form_id = t1.form_id where t1.form_id = 5 order by c0 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_government",
"sql": "select t0.form_type_code as c0 from forms as t0 join party_forms as t1 on t0.form_id = t1.form_id where t1.form_id = 5 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 600,
"split": "train"
} | |
For each staff member whose last name starts with "Boe," what is their last name, how many first names they have, how many unique phone numbers are associated with them, and how many complaints or records are linked to them? | customer_complaints | select last_name as c0, count(first_name), count(distinct (phone_number)), count(*) from staff where c0 like 'Boe%' 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": "customer_complaints",
"sql": "select last_name as c0, count(first_name), count(distinct (phone_number)), count(*) from staff where c0 like 'Boe%' group by c0"
},
"style": "rule"
} | {
"index": 76,
"split": "train"
} | |
Can you tell me the IDs and names of playlists along with their track IDs for media types that either end with "G-4 video file" or have names containing "urchase"? | store_1 | select t0.id, t0.name, t1.track_id from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id join tracks as t2 on t1.track_id = t2.id join media_types as t3 on t2.media_type_id = t3.id where t3.name like '%G-4 video file' or t3.name like '%urchase%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select t0.id, t0.name, t1.track_id from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id join tracks as t2 on t1.track_id = t2.id join media_types as t3 on t2.media_type_id = t3.id where t3.name like '%G-4 video file' or t3.name like '%urchas... | {
"index": 2315,
"split": "train"
} | |
Can you tell me the details of the first class, sorted by course code, that is taught by an employee belonging to a department where the employee number is less than 209? Specifically, I want to know the class code, classroom, and course code. | college_1 | select t0.class_code, t0.class_room, t0.crs_code as c2 from class as t0 join employee as t1 on t0.prof_num = t1.emp_num join department as t2 on t1.emp_num = t2.emp_num where t2.emp_num < 209 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": "college_1",
"sql": "select t0.class_code, t0.class_room, t0.crs_code as c2 from class as t0 join employee as t1 on t0.prof_num = t1.emp_num join department as t2 on t1.emp_num = t2.emp_num where t2.emp_num < 209 order by c2 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2225,
"split": "train"
} | |
How many employees have birth dates that are different from June 20, 1941? | company_1 | select count(*) from employee where bdate != '1941-06-20' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(*) from employee where bdate != '1941-06-20'"
},
"style": "rule"
} | {
"index": 1597,
"split": "train"
} | |
Is the year of the book club with ID 5 later than the year of the book club with ID 12? | culture_company | select t1.c2 > t0.c2 from (select year as c2 from book_club where book_club_id = 12) as t1, (select year as c2 from book_club where book_club_id = 5) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "culture_company",
"sql": "select t1.c2 > t0.c2 from (select year as c2 from book_club where book_club_id = 12) as t1, (select year as c2 from book_club where book_club_id = 5) as t0"
},
"style": "rule"
} | {
"index": 3541,
"split": "train"
} | |
Can you tell me the top 5 pairs of department store chain IDs and store IDs where the store ID is 2 or less, sorted by the store ID in descending order? | department_store | select t0.dept_store_chain_id, t1.dept_store_chain_id as c1 from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id where c1 <= 2 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": "department_store",
"sql": "select t0.dept_store_chain_id, t1.dept_store_chain_id as c1 from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id where c1 <= 2 order by c1 desc limit 5"
},
"style": "rule"
} | {
"index": 2246,
"split": "train"
} | |
Which are the top three book clubs linked to the movie 'Battlefield Earth', listing their authors or editors, categories, and book club IDs, sorted by the highest book club IDs? | culture_company | select t0.author_or_editor, t0.category, t0.book_club_id as c1 from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id join movie as t2 on t1.movie_id = t2.movie_id where t2.title = 'Battlefield Earth' order by c1 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "culture_company",
"sql": "select t0.author_or_editor, t0.category, t0.book_club_id as c1 from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id join movie as t2 on t1.movie_id = t2.movie_id where t2.title = 'Battlefield Earth' order by c1 desc limit ... | {
"index": 2776,
"split": "train"
} | |
List the unique school IDs that have received endowment contributions. | school_finance | select distinct school_id from endowment | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_finance",
"sql": "select distinct school_id from endowment"
},
"style": "rule"
} | {
"index": 976,
"split": "train"
} | |
Which account IDs have invoices dated on March 15, 2018, at 9:38:49 AM, or on any earlier date before March 16, 2018, at 9:57:43 PM? | customers_and_invoices | select t0.account_id from financial_transactions as t0 join invoices as t1 on t0.invoice_number = t1.invoice_number where t1.invoice_date = '2018-03-15 09:38:49' or t1.invoice_date < '2018-03-16 21:57:43' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.account_id from financial_transactions as t0 join invoices as t1 on t0.invoice_number = t1.invoice_number where t1.invoice_date = '2018-03-15 09:38:49' or t1.invoice_date < '2018-03-16 21:57:43'"
},
"style": "rule"
} | {
"index": 2884,
"split": "train"
} | |
What are the five grape types and their colors from wines in appellations that end with "nds," sorted in reverse alphabetical order by grape name? | wine_1 | select t0.grape as c1, t0.color from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.appelation like '%nds' 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": "wine_1",
"sql": "select t0.grape as c1, t0.color from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.appelation like '%nds' order by c1 desc limit 5"
},
"style": "rule"
} | {
"index": 1384,
"split": "train"
} | |
Who are the three customers with the lowest total support representative IDs, grouped by their first names? | chinook_1 | select firstname as c0, sum(supportrepid) as c1 from customer group by c0 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": "chinook_1",
"sql": "select firstname as c0, sum(supportrepid) as c1 from customer group by c0 order by c1 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 2602,
"split": "train"
} | |
What is the total sum of ratings for the artist named Shrikanta? | music_1 | select t0.c0 from (select sum(t1.rating) as c0 from artist as t0 join song as t1 on t0.artist_name = t1.artist_name where t0.artist_name = 'Shrikanta' group by t0.artist_name) 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": "music_1",
"sql": "select t0.c0 from (select sum(t1.rating) as c0 from artist as t0 join song as t1 on t0.artist_name = t1.artist_name where t0.artist_name = 'Shrikanta' group by t0.artist_name) as t0"
},
"style": "rule"
} | {
"index": 3388,
"split": "train"
} | |
Did customer 11's address history start before customer 2's address history? | customers_and_products_contacts | select t1.c0 < t0.c0 from (select date_from as c0 from customer_address_history where customer_id = 11) as t1, (select date_from as c0 from customer_address_history where customer_id = 2) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_products_contacts",
"sql": "select t1.c0 < t0.c0 from (select date_from as c0 from customer_address_history where customer_id = 11) as t1, (select date_from as c0 from customer_address_history where customer_id = 2) as t0"
},
"style": "rule"
} | {
"index": 3126,
"split": "train"
} | |
What are the headquarters and industry for companies that have offices in building 8 or building 6? | company_office | select t0.headquarters, t0.industry from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.building_id = 8 or t1.building_id = 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": "company_office",
"sql": "select t0.headquarters, t0.industry from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.building_id = 8 or t1.building_id = 6"
},
"style": "rule"
} | {
"index": 1658,
"split": "train"
} | |
Which college IDs that start with "lewcl" should be listed in order based on their college ID? | baseball_1 | select t0.college_id as c0 from college as t0 join player_college as t1 on t0.college_id = t1.college_id where t1.college_id like 'lewcl%' order by c0 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": "baseball_1",
"sql": "select t0.college_id as c0 from college as t0 join player_college as t1 on t0.college_id = t1.college_id where t1.college_id like 'lewcl%' order by c0 asc nulls last"
},
"style": "rule"
} | {
"index": 1465,
"split": "train"
} | |
What are the different game categories and the number of schools involved in each for basketball matches, considering only the categories with less than two schools participating, and sorted by the number of schools? | university_basketball | select all_games as c0, count(distinct (school_id)) as c1 from basketball_match group by c0 having count(distinct (school_id)) < 2 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": "university_basketball",
"sql": "select all_games as c0, count(distinct (school_id)) as c1 from basketball_match group by c0 having count(distinct (school_id)) < 2 order by c1 asc nulls last"
},
"style": "rule"
} | {
"index": 533,
"split": "train"
} | |
Which catalog has the highest catalog level number among those published by entities ending with " store" or starting with "Koepp-Rutherford handmade chocol," and what is its catalog level number and catalog ID? | product_catalog | select t0.catalog_level_number as c0, t0.catalog_id from catalog_structure as t0 join catalogs as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_publisher like '%store' or t1.catalog_publisher like 'Koepp-Rutherford handmade chocol%' 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": "product_catalog",
"sql": "select t0.catalog_level_number as c0, t0.catalog_id from catalog_structure as t0 join catalogs as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_publisher like '%store' or t1.catalog_publisher like 'Koepp-Rutherford handmade chocol%' order by c0 de... | {
"index": 1773,
"split": "train"
} | |
Can you list the names, heights in feet, and number of floors of buildings that are associated with institutions founded between 1881 and 1884, but exclude those buildings whose IDs end with "7"? | protein_institute | select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.name as c0, t0.height_feet as c1, t0.floors as c2 from building as t0 join institution as t1 on t0.building_id = t1.building_id where t1.founded between 1881.0 and 1884.0 except select t0.name as c0, t0.height_feet as c1, t0.floors as c2 from building as t0 join in... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "protein_institute",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.name as c0, t0.height_feet as c1, t0.floors as c2 from building as t0 join institution as t1 on t0.building_id = t1.building_id where t1.founded between 1881.0 and 1884.0 except select t0.name as c... | {
"index": 995,
"split": "train"
} | |
What is the release date of the song(s) that have the highest rating among all songs with a file ID of 5 or more? | music_1 | select t0.releasedate, t0.rating as c3 from song as t0, (select max(rating) as c1 from song where f_id >= 5) as t1 where c3 = t1.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "music_1",
"sql": "select t0.releasedate, t0.rating as c3 from song as t0, (select max(rating) as c1 from song where f_id >= 5) as t1 where c3 = t1.c1"
},
"style": "rule"
} | {
"index": 3788,
"split": "train"
} | |
Can you determine the numerical difference between the smallest complaint customer ID for customer 116 (considering only complaints about products with ID up to 120) and the smallest complaint customer ID for customer 114? | customer_complaints | select t1.c1 - t0.c1 from (select min(t1.customer_id) as c1 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 114 group by t0.customer_id) as t1, (select t0.customer_id, min(t1.customer_id) as c1 from customers as t0 join complaints as t1 on t0.customer_id = t1.custome... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select t1.c1 - t0.c1 from (select min(t1.customer_id) as c1 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 114 group by t0.customer_id) as t1, (select t0.customer_id, min(t1.customer_id) as c1 fro... | {
"index": 3594,
"split": "train"
} | |
Which are the bottom three coaches in terms of their rank and club ID, along with their coach IDs, for players who either reside in the location with the lowest total votes or live in an area containing "kbank"? The results should be sorted by coach ID.
This version clarifies the focus on the bottom three coaches base... | riding_club | select t0.rank, t0.club_id, t1.coach_id as c0 from coach as t0 join player_coach as t1 on t0.coach_id = t1.coach_id join player as t2 on t1.player_id = t2.player_id, (select residence as c1 from player group by c1 order by sum(votes) asc nulls last limit 1) as t0 where t2.residence = t0.c1 or t2.residence like '%kbank%... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "riding_club",
"sql": "select t0.rank, t0.club_id, t1.coach_id as c0 from coach as t0 join player_coach as t1 on t0.coach_id = t1.coach_id join player as t2 on t1.player_id = t2.player_id, (select residence as c1 from player group by c1 order by sum(votes) asc nulls last limit 1) ... | {
"index": 2590,
"split": "train"
} | |
How many endowment contributions have an amount exactly equal to 8.53? | school_finance | select count(*) from endowment where amount = 8.53 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_finance",
"sql": "select count(*) from endowment where amount = 8.53"
},
"style": "rule"
} | {
"index": 2553,
"split": "train"
} | |
Which university nickname has the earliest founding year before 1866? | university_basketball | select nickname as c0 from university group by c0 having min(founded) < 1866.0 order by min(founded) 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": "university_basketball",
"sql": "select nickname as c0 from university group by c0 having min(founded) < 1866.0 order by min(founded) asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 1272,
"split": "train"
} | |
List the street addresses and building IDs of institutions founded between 1890 and 1998, sorted by the institution names, with any missing institution names appearing last. | protein_institute | select t0.street_address, t0.building_id from building as t0 join institution as t1 on t0.building_id = t1.building_id where t1.founded between 1890.0 and 1998.0 order by t1.institution 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": "protein_institute",
"sql": "select t0.street_address, t0.building_id from building as t0 join institution as t1 on t0.building_id = t1.building_id where t1.founded between 1890.0 and 1998.0 order by t1.institution asc nulls last"
},
"style": "rule"
} | {
"index": 2963,
"split": "train"
} | |
Among the fault reports with ID 12, which fault requires the most skills to fix? Please provide the fault ID and the number of skills needed. | assets_maintenance | select t0.part_fault_id as c0 from part_faults as t0 join skills_required_to_fix as t1 on t0.part_fault_id = t1.part_fault_id where c0 = 12 group by c0 order by count(t1.skill_id) 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": "assets_maintenance",
"sql": "select t0.part_fault_id as c0 from part_faults as t0 join skills_required_to_fix as t1 on t0.part_fault_id = t1.part_fault_id where c0 = 12 group by c0 order by count(t1.skill_id) desc limit 1"
},
"style": "rule"
} | {
"index": 848,
"split": "train"
} | |
Who are the staff members assigned on March 25th, 2018 at 9:53 AM, and what are their genders, IDs, and names? Please list them in reverse alphabetical order by staff name.
---
This version clarifies the date and time context, specifies that we're asking about staff assigned at that exact moment, and describes the so... | department_store | select t0.staff_gender, t0.staff_id as c0, t0.staff_name as c1 from staff as t0 join staff_department_assignments as t1 on t0.staff_id = t1.staff_id where t1.staff_id in (select c0 as c0 from staff) and t1.date_assigned_to = '2018-03-25 09:53:37' order by c1 desc | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select t0.staff_gender, t0.staff_id as c0, t0.staff_name as c1 from staff as t0 join staff_department_assignments as t1 on t0.staff_id = t1.staff_id where t1.staff_id in (select c0 as c0 from staff) and t1.date_assigned_to = '2018-03-25 09:53:37' order ... | {
"index": 1859,
"split": "train"
} | |
What are the first five results for musicals named "Chicago" or starting with "Rent," listed in alphabetical order by their result, placing any NULL results at the end? | musical | select result as c0 from musical where name = 'Chicago' or name like 'Rent%' 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": "musical",
"sql": "select result as c0 from musical where name = 'Chicago' or name like 'Rent%' order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2429,
"split": "train"
} | |
What are the address IDs and details for addresses associated with suppliers who have purchased products with a total value less than 99,049.01, sorted in reverse alphabetical order of the address details? | department_store | select t0.address_id, t0.address_details as c0 from addresses as t0 join supplier_addresses as t1 on t0.address_id = t1.address_id join suppliers as t2 on t1.supplier_id = t2.supplier_id join product_suppliers as t3 on t2.supplier_id = t3.supplier_id where t3.total_value_purchased < 99049.01 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": "department_store",
"sql": "select t0.address_id, t0.address_details as c0 from addresses as t0 join supplier_addresses as t1 on t0.address_id = t1.address_id join suppliers as t2 on t1.supplier_id = t2.supplier_id join product_suppliers as t3 on t2.supplier_id = t3.supplier_id wh... | {
"index": 657,
"split": "train"
} | |
What are the campus, year, and campus fee for campuses with discipline enrollments in discipline 6 at campus ID 16? | csu_1 | select t0.campus, t0.year, t0.campusfee from csu_fees as t0 join campuses as t1 on t0.campus = t1.id join discipline_enrollments as t2 on t1.id = t2.campus where t2.campus = 16 and t2.discipline = 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": "csu_1",
"sql": "select t0.campus, t0.year, t0.campusfee from csu_fees as t0 join campuses as t1 on t0.campus = t1.id join discipline_enrollments as t2 on t1.id = t2.campus where t2.campus = 16 and t2.discipline = 6"
},
"style": "rule"
} | {
"index": 2950,
"split": "train"
} | |
Can you tell me the levels and ages of all the managers? | railway | select level, age from manager | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "railway",
"sql": "select level, age from manager"
},
"style": "rule"
} | {
"index": 2683,
"split": "train"
} | |
Which are the most recent ten appointments attended by nurses on call with blockcode 3, including the physician's name, patient's name, and appointment start time? | hospital_1 | select t0.physician, t0.patient, t0.start as c2 from appointment as t0 join nurse as t1 on t0.prepnurse = t1.employeeid join on_call as t2 on t1.employeeid = t2.nurse where t2.blockcode = 3 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": "hospital_1",
"sql": "select t0.physician, t0.patient, t0.start as c2 from appointment as t0 join nurse as t1 on t0.prepnurse = t1.employeeid join on_call as t2 on t1.employeeid = t2.nurse where t2.blockcode = 3 order by c2 desc limit 10"
},
"style": "rule"
} | {
"index": 774,
"split": "train"
} | |
Which team names and team IDs are not associated with match seasons where the country's capital is Jakarta? | match_season | select anon_1.c1, anon_1.c0 from (select name as c1, team_id as c0 from team except select t0.name as c1, t0.team_id as c0 from team as t0 join match_season as t1 on t0.team_id = t1.team join country as t2 on t1.country = t2.country_id where t2.capital = 'Jakarta') 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": "match_season",
"sql": "select anon_1.c1, anon_1.c0 from (select name as c1, team_id as c0 from team except select t0.name as c1, t0.team_id as c0 from team as t0 join match_season as t1 on t0.team_id = t1.team join country as t2 on t1.country = t2.country_id where t2.capital = 'J... | {
"index": 530,
"split": "train"
} | |
Did student 2 take their test after student 16? | e_learning | select t1.c2 > t0.c2 from (select date_test_taken as c2 from student_tests_taken where registration_id = 2) as t1, (select date_test_taken as c2 from student_tests_taken where registration_id = 16) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select t1.c2 > t0.c2 from (select date_test_taken as c2 from student_tests_taken where registration_id = 2) as t1, (select date_test_taken as c2 from student_tests_taken where registration_id = 16) as t0"
},
"style": "rule"
} | {
"index": 3087,
"split": "train"
} | |
Which city IDs and their June temperatures have July temperatures of at least 20.6 degrees? | city_record | select city_id, jun from temperature where jul >= 20.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": "city_record",
"sql": "select city_id, jun from temperature where jul >= 20.6"
},
"style": "rule"
} | {
"index": 2524,
"split": "train"
} | |
How many office locations does the company with ID 5 have? | company_office | select count(*) from office_locations where company_id = 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "company_office",
"sql": "select count(*) from office_locations where company_id = 5"
},
"style": "rule"
} | {
"index": 2942,
"split": "train"
} | |
Which customers and their orders include products with IDs between 10 and 14, but do not have an invoice numbered 4? | customers_and_invoices | select anon_1.c1, anon_1.c0 from (select t0.customer_id as c1, t0.order_id as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.product_id between 10 and 14 except select t0.customer_id as c1, t0.order_id as c0 from orders as t0 join invoices as t1 on t0.order_id = t1.order_id where t1.i... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.customer_id as c1, t0.order_id as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.product_id between 10 and 14 except select t0.customer_id as c1, t0.order_id as c0 from... | {
"index": 2966,
"split": "train"
} | |
What is the average maximum aperture of the camera lenses, the number of unique camera lenses used, and the number of distinct camera lenses photographed on mountains with IDs of 20 or less? Please sort the results by the average maximum aperture in descending order. | mountain_photos | select avg(t0.max_aperture) as c0, count(distinct (t0.id)), count(distinct (t1.camera_lens_id)) from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t1.mountain_id <= 20 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": "mountain_photos",
"sql": "select avg(t0.max_aperture) as c0, count(distinct (t0.id)), count(distinct (t1.camera_lens_id)) from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t1.mountain_id <= 20 order by c0 desc"
},
"style": "rule"
} | {
"index": 2507,
"split": "train"
} | |
Which teams, that include a player named An Jae-Sung but do not have any players with a team number greater than 2, their Team IDs and Names? | match_season | select anon_1.c0, anon_1.c1 from (select t0.team_id as c0, t0.name as c1 from team as t0 join player as t1 on t0.team_id = t1.team where t1.player = 'An Jae-Sung' except select t0.team_id as c0, t0.name as c1 from team as t0 join player as t1 on t0.team_id = t1.team where t1.team > 2) 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": "match_season",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.team_id as c0, t0.name as c1 from team as t0 join player as t1 on t0.team_id = t1.team where t1.player = 'An Jae-Sung' except select t0.team_id as c0, t0.name as c1 from team as t0 join player as t1 on t0.team_id ... | {
"index": 2622,
"split": "train"
} | |
Show me the five investors with the smallest investor IDs who have made transactions of at least 302,507.6996 or more than 207,484,122.2796, ordered by their investor IDs, with any null IDs coming last. | tracking_share_transactions | select t0.investor_id as c0 from investors as t0 join transactions as t1 on t0.investor_id = t1.investor_id where t1.amount_of_transaction >= 302507.6996 or t1.amount_of_transaction > 207484122.2796 order by c0 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select t0.investor_id as c0 from investors as t0 join transactions as t1 on t0.investor_id = t1.investor_id where t1.amount_of_transaction >= 302507.6996 or t1.amount_of_transaction > 207484122.2796 order by c0 asc nulls last limit 5"
},
... | {
"index": 504,
"split": "train"
} | |
Can you tell me the details and IDs of the five museums that have been visited by visitors whose information includes the letter "e" or ends with "Marisol," listing the museums in reverse alphabetical order of their details? | cre_Theme_park | select t0.museum_details as c1, t0.museum_id from museums as t0 join tourist_attractions as t1 on t0.museum_id = t1.tourist_attraction_id join visits as t2 on t1.tourist_attraction_id = t2.tourist_attraction_id join visitors as t3 on t2.tourist_id = t3.tourist_id where t3.tourist_details like '%e%' or t3.tourist_detail... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.museum_details as c1, t0.museum_id from museums as t0 join tourist_attractions as t1 on t0.museum_id = t1.tourist_attraction_id join visits as t2 on t1.tourist_attraction_id = t2.tourist_attraction_id join visitors as t3 on t2.tourist_id = t3.to... | {
"index": 1897,
"split": "train"
} | |
How many years earlier did Dan become friends with his earliest friend compared to ten years ago? | network_2 | select t0.c0 - 10 from (select min(t1.year) as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.name = 'Dan' group by t0.name) 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": "network_2",
"sql": "select t0.c0 - 10 from (select min(t1.year) as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.name = 'Dan' group by t0.name) as t0"
},
"style": "rule"
} | {
"index": 3935,
"split": "train"
} | |
Can you identify the studios, directors, and gross earnings of films that have market estimates of at least 3000 dollars, but do not have any estimated market data from before 1944? | film_rank | select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.studio as c2, t0.director as c0, t0.gross_in_dollar as c1 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id where t1.low_estimate >= 3000.0 except select t0.studio as c2, t0.director as c0, t0.gross_in_dollar as c1 from film as t0 join fi... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "film_rank",
"sql": "select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.studio as c2, t0.director as c0, t0.gross_in_dollar as c1 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id where t1.low_estimate >= 3000.0 except select t0.studio as c2, t0.dire... | {
"index": 1767,
"split": "train"
} | |
For catalog with ID 6, is the date of its latest revision earlier than its own recorded date? | product_catalog | select date_of_latest_revision < date_of_latest_revision from catalogs where catalog_id = 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": "product_catalog",
"sql": "select date_of_latest_revision < date_of_latest_revision from catalogs where catalog_id = 6"
},
"style": "rule"
} | {
"index": 3137,
"split": "train"
} | |
How does the total number of friendship years for Bob compare to the total friendship years for Dan (only counting friendships after year 5)? | network_2 | select t1.c0 - t0.c0 from (select sum(t1.year) as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.name = 'Bob' group by t0.name) as t1, (select t0.name, sum(t1.year) as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.name = 'Dan' and t1.year > 5 group by t0.name... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "network_2",
"sql": "select t1.c0 - t0.c0 from (select sum(t1.year) as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.name = 'Bob' group by t0.name) as t1, (select t0.name, sum(t1.year) as c0 from person as t0 join personfriend as t1 on t0.name = t1.f... | {
"index": 3616,
"split": "train"
} | |
What are the gender, address ID, and teacher ID of the teacher whose teacher ID is 1? | behavior_monitoring | select gender, address_id, teacher_id as c2 from teachers where c2 = 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": "behavior_monitoring",
"sql": "select gender, address_id, teacher_id as c2 from teachers where c2 = 1"
},
"style": "rule"
} | {
"index": 1188,
"split": "train"
} | |
How much has the number of unique customers, based on their average customer ID on specific dates, changed between orders made on March 16th and March 18th, 2018? Specifically, what's the percentage increase or decrease in the count of these distinct customer averages from the first date to the second? | department_store | select (count(distinct (t0.c0)) / cast(count(distinct (t1.c0)) as real) - 1) * 100 from (select avg(t1.customer_id) as c0 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t1.order_date = '2018-03-16 22:42:46' group by t0.customer_id) as t0, (select t0.customer_id, avg(t1.customer... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select (count(distinct (t0.c0)) / cast(count(distinct (t1.c0)) as real) - 1) * 100 from (select avg(t1.customer_id) as c0 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t1.order_date = '2018-03-16 22:42:46' grou... | {
"index": 3029,
"split": "train"
} | |
Can you list the five films with the titles that come last alphabetically, including their gross revenue and market estimates (both low and high), for markets that have exactly 700 cities? | film_rank | select t0.title as c0, t0.gross_in_dollar, t1.low_estimate, t1.high_estimate from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id join market as t2 on t1.market_id = t2.market_id where t2.number_cities = 700 order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "film_rank",
"sql": "select t0.title as c0, t0.gross_in_dollar, t1.low_estimate, t1.high_estimate from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id join market as t2 on t1.market_id = t2.market_id where t2.number_cities = 700 order by c0 desc limit 5"
... | {
"index": 497,
"split": "train"
} | |
Which faculty members participate in which activities, along with activity IDs and names, that are attended by students whose advisors have IDs of 8918 or higher? | activity_1 | select t0.actid, t0.facid, t1.actid, t1.activity_name from faculty_participates_in as t0 join activity as t1 on t0.actid = t1.actid join participates_in as t2 on t1.actid = t2.actid join student as t3 on t2.stuid = t3.stuid where t3.advisor >= 8918 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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, t0.facid, t1.actid, t1.activity_name from faculty_participates_in as t0 join activity as t1 on t0.actid = t1.actid join participates_in as t2 on t1.actid = t2.actid join student as t3 on t2.stuid = t3.stuid where t3.advisor >= 8918"
},
"s... | {
"index": 1949,
"split": "train"
} | |
Can you tell me the customer details, their master customer IDs, and cross-reference IDs for customers with IDs of 1, 2, or 3? | local_govt_mdm | select t0.cmi_details, t0.master_customer_id, t1.cmi_cross_ref_id from customer_master_index as t0 join cmi_cross_references as t1 on t0.master_customer_id = t1.master_customer_id where t1.master_customer_id <= 3 or t1.master_customer_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": "local_govt_mdm",
"sql": "select t0.cmi_details, t0.master_customer_id, t1.cmi_cross_ref_id from customer_master_index as t0 join cmi_cross_references as t1 on t0.master_customer_id = t1.master_customer_id where t1.master_customer_id <= 3 or t1.master_customer_id >= 1"
},
"sty... | {
"index": 1472,
"split": "train"
} | |
List the host, attendance, and performance ID for performances that are not the ones where the member with the most appearances participated. | performance_attendance | select anon_1.c3, anon_1.c1, anon_1.c0 from (select host as c3, attendance as c1, performance_id as c0 from performance except select t0.host as c3, t0.attendance as c1, t0.performance_id as c0 from performance as t0 join member_attendance as t1 on t0.performance_id = t1.performance_id join member as t2 on t1.member_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": "performance_attendance",
"sql": "select anon_1.c3, anon_1.c1, anon_1.c0 from (select host as c3, attendance as c1, performance_id as c0 from performance except select t0.host as c3, t0.attendance as c1, t0.performance_id as c0 from performance as t0 join member_attendance as t1 o... | {
"index": 2809,
"split": "train"
} | |
Which chromosomes and OMIM identifiers are associated with the enzymes that interact with the medicine having ID 3 and also have enzyme ID 4? | medicine_enzyme_interaction | select t0.chromosome, t0.omim from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.medicine_id = 3 and t1.enzyme_id = 4 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "medicine_enzyme_interaction",
"sql": "select t0.chromosome, t0.omim from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.medicine_id = 3 and t1.enzyme_id = 4"
},
"style": "rule"
} | {
"index": 572,
"split": "train"
} | |
what are the number of years each driver has been working with school number 1 and their driver ids? | school_bus | select years_working, driver_id from school_bus where school_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": "school_bus",
"sql": "select years_working, driver_id from school_bus where school_id = 1"
},
"style": "rule"
} | {
"index": 968,
"split": "train"
} | |
Which colleges are associated with players who received awards on or before 1992, and what are their IDs and full names? | baseball_1 | select t0.college_id, t0.name_full from college as t0 join player_college as t1 on t0.college_id = t1.college_id join player as t2 on t1.player_id = t2.player_id join player_award as t3 on t2.player_id = t3.player_id where t3.year <= 1992 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.college_id, t0.name_full from college as t0 join player_college as t1 on t0.college_id = t1.college_id join player as t2 on t1.player_id = t2.player_id join player_award as t3 on t2.player_id = t3.player_id where t3.year <= 1992"
},
"style": "ru... | {
"index": 1078,
"split": "train"
} | |
What are the train and station IDs for the top three routes with weekly weather data showing low temperatures below 50, ordered by train ID from newest to oldest? | station_weather | select t0.train_id as c0, t0.station_id from route as t0 join station as t1 on t0.station_id = t1.id join weekly_weather as t2 on t1.id = t2.station_id where t2.low_temperature < 50 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": "station_weather",
"sql": "select t0.train_id as c0, t0.station_id from route as t0 join station as t1 on t0.station_id = t1.id join weekly_weather as t2 on t1.id = t2.station_id where t2.low_temperature < 50 order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 2759,
"split": "train"
} | |
List the member IDs, roles, and names for all members, excluding those who participated in performances that took place in months or days starting with 'F'. | performance_attendance | select anon_1.c2, anon_1.c0, anon_1.c1 from (select member_id as c2, role as c0, name as c1 from member except select t0.member_id as c2, t0.role as c0, t0.name as c1 from member as t0 join member_attendance as t1 on t0.member_id = t1.member_id join performance as t2 on t1.performance_id = t2.performance_id where t2.da... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "performance_attendance",
"sql": "select anon_1.c2, anon_1.c0, anon_1.c1 from (select member_id as c2, role as c0, name as c1 from member except select t0.member_id as c2, t0.role as c0, t0.name as c1 from member as t0 join member_attendance as t1 on t0.member_id = t1.member_id jo... | {
"index": 1672,
"split": "train"
} | |
Which building names and heights are associated with the institution that has the highest total founded year, and that also house an institution of the most common type among those with IDs ending in "0"? | protein_institute | select anon_1.c0, anon_1.c2 from (select t0.name as c0, t0.height_feet as c2 from building as t0 join institution as t1 on t0.building_id = t1.building_id, (select institution_id as c3 from institution group by c3 order by sum(founded) desc limit 1) as t2 where t1.institution_id = t2.c3 intersect select t0.name as c0, ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "protein_institute",
"sql": "select anon_1.c0, anon_1.c2 from (select t0.name as c0, t0.height_feet as c2 from building as t0 join institution as t1 on t0.building_id = t1.building_id, (select institution_id as c3 from institution group by c3 order by sum(founded) desc limit 1) as... | {
"index": 1077,
"split": "train"
} | |
What are the five most recent UK VAT numbers and their formation dates for organizations that have had contact with the individual with ID 7, ordered from the newest to the oldest? | e_government | select t0.uk_vat_number, t0.date_formed as c0 from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where t1.individual_id = 7 order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_government",
"sql": "select t0.uk_vat_number, t0.date_formed as c0 from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where t1.individual_id = 7 order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 1068,
"split": "train"
} | |
Which staff members, including their names, genders, and IDs, have recorded faults and are associated with staff ID 5, along with the average staff ID of those who recorded the faults? | assets_maintenance | select t0.staff_name, t0.gender, t0.staff_id as c0, avg(t1.recorded_by_staff_id) from staff as t0 join fault_log as t1 on t0.staff_id = t1.recorded_by_staff_id where t1.recorded_by_staff_id = 5 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": "assets_maintenance",
"sql": "select t0.staff_name, t0.gender, t0.staff_id as c0, avg(t1.recorded_by_staff_id) from staff as t0 join fault_log as t1 on t0.staff_id = t1.recorded_by_staff_id where t1.recorded_by_staff_id = 5 group by c0"
},
"style": "rule"
} | {
"index": 1129,
"split": "train"
} | |
For the product with ID 117, has the percentage increase in the total staff members involved in complaints from 1973 to 2007 been greater than the percentage change in the number of unique staff members involved during the same period? | customer_complaints | select t5.c4 > t2.c3 from (select abs((t3.c1 / cast(t4.c1 as real) - 1) * 100) as c4 from (select sum(t1.staff_id) as c1 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 117 and t1.date_complaint_raised = '2007-10-14 21:50:43' group by t0.product_id) as t3, (select sum(t1... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select t5.c4 > t2.c3 from (select abs((t3.c1 / cast(t4.c1 as real) - 1) * 100) as c4 from (select sum(t1.staff_id) as c1 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 117 and t1.date_complaint_raised... | {
"index": 3955,
"split": "train"
} | |
Show me the product that ranks first based on the highest maximum booked amount among products with fewer than three bookings.? | products_for_hire | select t1.c5, t1.c3 as c4 from (select row_number() over (order by t0.c0 desc) as c5, t0.c1 as c3 from (select t0.product_id as c1, max(t1.booked_amount) as c0 from products_for_hire as t0 join products_booked as t1 on t0.product_id = t1.product_id where t1.booked_count < 3 group by c1) as t0) as t1 where c4 = 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_for_hire",
"sql": "select t1.c5, t1.c3 as c4 from (select row_number() over (order by t0.c0 desc) as c5, t0.c1 as c3 from (select t0.product_id as c1, max(t1.booked_amount) as c0 from products_for_hire as t0 join products_booked as t1 on t0.product_id = t1.product_id whe... | {
"index": 3911,
"split": "train"
} | |
Which countries are associated with either songs or artists in the database? | music_1 | select anon_1.c0 from (select country as c0 from song union select country from artist) as anon_1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "music_1",
"sql": "select anon_1.c0 from (select country as c0 from song union select country from artist) as anon_1"
},
"style": "rule"
} | {
"index": 1733,
"split": "train"
} | |
What is the most recent transaction details, including other account details, account name, account ID, and transaction amount, for debit cards, sorted by the other account details in reverse alphabetical order? | customers_card_transactions | select t0.other_account_details as c3, t0.account_name, t0.account_id, t1.transaction_amount from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id join customers_cards as t2 on t1.card_id = t2.card_id where t2.card_type_code = 'Debit' 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": "customers_card_transactions",
"sql": "select t0.other_account_details as c3, t0.account_name, t0.account_id, t1.transaction_amount from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id join customers_cards as t2 on t1.card_id = t2.card_id where t2... | {
"index": 1002,
"split": "train"
} | |
What is the percentage change in the number of unique address IDs (based on their average value) for addresses with customer address histories ending on March 10, 2018, compared to those ending on March 11, 2018? | customers_and_products_contacts | select (count(distinct (t0.c0)) / cast(count(distinct (t1.c0)) as real) - 1) * 100 from (select avg(t1.address_id) as c0 from addresses as t0 join customer_address_history as t1 on t0.address_id = t1.address_id where t1.date_to = '2018-03-10 00:47:18' group by t0.address_id) as t0, (select t0.address_id, avg(t1.address... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_products_contacts",
"sql": "select (count(distinct (t0.c0)) / cast(count(distinct (t1.c0)) as real) - 1) * 100 from (select avg(t1.address_id) as c0 from addresses as t0 join customer_address_history as t1 on t0.address_id = t1.address_id where t1.date_to = '2018-03... | {
"index": 3027,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.