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 |
|---|---|---|---|---|---|---|---|---|
What are the names, IDs of the enzymes, and the IDs of medicines that have interactions starting with "activi"? | medicine_enzyme_interaction | select t0.name, t0.id, t1.medicine_id from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.interaction_type like 'activi%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.name, t0.id, t1.medicine_id from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.interaction_type like 'activi%'"
},
"style": "rule"
} | {
"index": 2474,
"split": "train"
} | |
What is the start date when the customer with ID 14 had their highest recorded address ID in the address history? | customers_and_products_contacts | select t0.date_from, t0.address_id as c1 from customer_address_history as t0, (select max(address_id) as c2 from customer_address_history where customer_id = 14) as t1 where c1 = t1.c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_products_contacts",
"sql": "select t0.date_from, t0.address_id as c1 from customer_address_history as t0, (select max(address_id) as c2 from customer_address_history where customer_id = 14) as t1 where c1 = t1.c2"
},
"style": "rule"
} | {
"index": 3759,
"split": "train"
} | |
For the track with ID 3110, what are the names of up to three genres it belongs to, sorted in reverse alphabetical order? | store_1 | select t0.name as c0 from genres as t0 join tracks as t1 on t0.id = t1.genre_id where t1.id = 3110 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": "store_1",
"sql": "select t0.name as c0 from genres as t0 join tracks as t1 on t0.id = t1.genre_id where t1.id = 3110 order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 922,
"split": "train"
} | |
Did user 4's percentage change in followers at that specific moment exceed the smallest percentage change observed among other users with more than 23,927,492 followers at the same time? | twitter_1 | select t3.c1 > t1.c4 from (select abs((t0.followers / cast(t0.followers as real) - 1) * 100) as c1 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 4 and t1.createdate = '2018-03-12 02:30:30') as t3, (select abs((min(t0.followers) / cast(min(t0.followers) as real) - 1) * 100) as c4 from user... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "twitter_1",
"sql": "select t3.c1 > t1.c4 from (select abs((t0.followers / cast(t0.followers as real) - 1) * 100) as c1 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 4 and t1.createdate = '2018-03-12 02:30:30') as t3, (select abs((min(t0.followers) /... | {
"index": 3455,
"split": "train"
} | |
Can you show me all the details of perpetrators who have exactly 37 people injured? | perpetrator | select * from perpetrator where injured = 37 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "perpetrator",
"sql": "select * from perpetrator where injured = 37"
},
"style": "rule"
} | {
"index": 1440,
"split": "train"
} | |
What is the rank of the customer with the fifth highest savings balance when all savings balances are ordered from highest to lowest? | small_bank_1 | select t1.c4, t1.c2 as c3 from (select row_number() over (order by balance desc) as c4, custid as c2 from savings) 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": "small_bank_1",
"sql": "select t1.c4, t1.c2 as c3 from (select row_number() over (order by balance desc) as c4, custid as c2 from savings) as t1 where c3 = 5"
},
"style": "rule"
} | {
"index": 3500,
"split": "train"
} | |
Show the average lot ID, transaction date, and transaction ID for the most recent ten transactions where the transaction amount was either greater than 82,057.207 or at least 4.5263, ordered by transaction ID descending. | tracking_share_transactions | select avg(t0.lot_id), t1.date_of_transaction, t1.transaction_id as c1 from transactions_lots as t0 join transactions as t1 on t0.transaction_id = t1.transaction_id where t1.amount_of_transaction > 82057.207 or t1.amount_of_transaction >= 4.5263 group by c1 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": "tracking_share_transactions",
"sql": "select avg(t0.lot_id), t1.date_of_transaction, t1.transaction_id as c1 from transactions_lots as t0 join transactions as t1 on t0.transaction_id = t1.transaction_id where t1.amount_of_transaction > 82057.207 or t1.amount_of_transaction >= 4.5... | {
"index": 1555,
"split": "train"
} | |
What are the descriptions, reporter IDs, and problem IDs of issues, excluding those related to products with names ending in "itter"? | tracking_software_problems | select anon_1.c1, anon_1.c2, anon_1.c0 from (select problem_description as c1, reported_by_staff_id as c2, problem_id as c0 from problems except select t0.problem_description as c1, t0.reported_by_staff_id as c2, t0.problem_id as c0 from problems as t0 join product as t1 on t0.product_id = t1.product_id where t1.produc... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select anon_1.c1, anon_1.c2, anon_1.c0 from (select problem_description as c1, reported_by_staff_id as c2, problem_id as c0 from problems except select t0.problem_description as c1, t0.reported_by_staff_id as c2, t0.problem_id as c0 from probl... | {
"index": 863,
"split": "train"
} | |
What are the building and department name for the Psychology department? | college_2 | select t0.building, t0.dept_name from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.dept_name = 'Psychology' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_2",
"sql": "select t0.building, t0.dept_name from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.dept_name = 'Psychology'"
},
"style": "rule"
} | {
"index": 1708,
"split": "train"
} | |
How many days did employee 122 work in their most recent job? | hr_1 | select julianday(t1.c3) - julianday(t0.c1) from (select end_date as c3 from job_history where employee_id = 122 and employee_id = 122) as t1, (select start_date as c1 from job_history) 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": "hr_1",
"sql": "select julianday(t1.c3) - julianday(t0.c1) from (select end_date as c3 from job_history where employee_id = 122 and employee_id = 122) as t1, (select start_date as c1 from job_history) as t0"
},
"style": "rule"
} | {
"index": 3858,
"split": "train"
} | |
Show the locations and founding years of institutions that do not have a building named with "Hall". | protein_institute | select anon_1.c0, anon_1.c1 from (select location as c0, founded as c1 from institution except select t0.location as c0, t0.founded as c1 from institution as t0 join building as t1 on t0.building_id = t1.building_id where t1.name like '%Hall%') 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": "protein_institute",
"sql": "select anon_1.c0, anon_1.c1 from (select location as c0, founded as c1 from institution except select t0.location as c0, t0.founded as c1 from institution as t0 join building as t1 on t0.building_id = t1.building_id where t1.name like '%Hall%') as anon... | {
"index": 694,
"split": "train"
} | |
What are the customer’s name and ID, and how many savings account entries does the customer with custid 2 have? | small_bank_1 | select t0.name, t0.custid as c0, count(*) from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.custid = 2 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": "small_bank_1",
"sql": "select t0.name, t0.custid as c0, count(*) from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.custid = 2 group by c0"
},
"style": "rule"
} | {
"index": 401,
"split": "train"
} | |
Is the smallest shipment invoice number linked to invoice 15 greater than 5? | tracking_orders | select t0.c2 > 5 from (select min(t1.invoice_number) as c2 from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where t0.invoice_number = 15 group by t0.invoice_number) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select t0.c2 > 5 from (select min(t1.invoice_number) as c2 from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where t0.invoice_number = 15 group by t0.invoice_number) as t0"
},
"style": "rule"
} | {
"index": 3304,
"split": "train"
} | |
Which political parties are involved either in elections or are listed in the party information? | election | select anon_1.c0 from (select party as c0 from election union select party from party) 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": "election",
"sql": "select anon_1.c0 from (select party as c0 from election union select party from party) as anon_1"
},
"style": "rule"
} | {
"index": 681,
"split": "train"
} | |
What is the average part ID, along with the chargeable amount and part ID, for parts whose names start with "to" and have at least two associated fault reports? | assets_maintenance | select avg(t0.part_id), t1.chargeable_amount, t1.part_id as c2 from part_faults as t0 join parts as t1 on t0.part_id = t1.part_id where t1.part_name like 'to%' group by c2 having count(*) >= 2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "assets_maintenance",
"sql": "select avg(t0.part_id), t1.chargeable_amount, t1.part_id as c2 from part_faults as t0 join parts as t1 on t0.part_id = t1.part_id where t1.part_name like 'to%' group by c2 having count(*) >= 2"
},
"style": "rule"
} | {
"index": 2309,
"split": "train"
} | |
Can you list the names and descriptions of photos that are not associated with any tourist attractions in Cre Theme Park? | cre_Theme_park | select anon_1.c2, anon_1.c1 from (select name as c2, description as c1 from photos except select name, description from tourist_attractions) 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": "cre_Theme_park",
"sql": "select anon_1.c2, anon_1.c1 from (select name as c2, description as c1 from photos except select name, description from tourist_attractions) as anon_1"
},
"style": "rule"
} | {
"index": 2382,
"split": "train"
} | |
What are the last 10 product categories from mailshot campaigns when sorted in reverse alphabetical order? | customers_campaigns_ecommerce | select product_category as c0 from mailshot_campaigns 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": "customers_campaigns_ecommerce",
"sql": "select product_category as c0 from mailshot_campaigns order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 601,
"split": "train"
} | |
Is the highest product ID associated with product 117 less than 119? | customer_complaints | select t0.c0 < 119 from (select max(t1.product_id) as c0 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 117 group by t0.product_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select t0.c0 < 119 from (select max(t1.product_id) as c0 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 117 group by t0.product_id) as t0"
},
"style": "rule"
} | {
"index": 3990,
"split": "train"
} | |
What are the names, damages, and active dates of the three most recently active storms, listed from the newest to the oldest? | storm_record | select name, damage_millions_usd, dates_active as c0 from storm 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": "storm_record",
"sql": "select name, damage_millions_usd, dates_active as c0 from storm order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 489,
"split": "train"
} | |
Can you tell me the building manager and address of the building associated with apartments numbered 8 or 12, selecting the first one when the buildings are ordered by their description from Z to A? | apartment_rentals | select t0.building_manager, t0.building_address from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.apt_id = 8 or t1.apt_id = 12 order by t0.building_description 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": "apartment_rentals",
"sql": "select t0.building_manager, t0.building_address from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.apt_id = 8 or t1.apt_id = 12 order by t0.building_description desc limit 1"
},
"style": "rule"
} | {
"index": 95,
"split": "train"
} | |
For each film title, what is the total gross revenue in dollars, how many different directors have worked on it, and how many entries are there in the database? | film_rank | select title as c1, sum(gross_in_dollar), count(distinct (director)), count(*) from film 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": "film_rank",
"sql": "select title as c1, sum(gross_in_dollar), count(distinct (director)), count(*) from film group by c1"
},
"style": "rule"
} | {
"index": 1682,
"split": "train"
} | |
What is the difference between the number 113,509,913.48 and the average price range of hotels with a star rating of 2? | cre_Theme_park | select t0.c1 - 113509913.48 from (select avg(t1.price_range) as c1 from ref_hotel_star_ratings as t0 join hotels as t1 on t0.star_rating_code = t1.star_rating_code where t0.star_rating_code = 2 group by t0.star_rating_code) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Theme_park",
"sql": "select t0.c1 - 113509913.48 from (select avg(t1.price_range) as c1 from ref_hotel_star_ratings as t0 join hotels as t1 on t0.star_rating_code = t1.star_rating_code where t0.star_rating_code = 2 group by t0.star_rating_code) as t0"
},
"style": "rule"
} | {
"index": 3219,
"split": "train"
} | |
Which are the top 10 election dates with the highest total vote percentages from representatives who received more than 18.5% or at least 19.5% of votes, sorted from highest to lowest? | election_representative | select date as c1, sum(vote_percent) as c0 from election where vote_percent > 18.5 or vote_percent >= 19.5 group by c1 order by c0 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "election_representative",
"sql": "select date as c1, sum(vote_percent) as c0 from election where vote_percent > 18.5 or vote_percent >= 19.5 group by c1 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 1492,
"split": "train"
} | |
Which are the top three faculty members with the highest faculty IDs, whose first names are not used by any students, and whose ranks include the letter "f"? | college_3 | select facid as c1 from faculty where (not fname in (select fname as c0 from student)) and rank like '%f%' 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": "college_3",
"sql": "select facid as c1 from faculty where (not fname in (select fname as c0 from student)) and rank like '%f%' order by c1 desc limit 3"
},
"style": "rule"
} | {
"index": 770,
"split": "train"
} | |
How many days did employee 114 spend in their job, from start to end date? | hr_1 | select julianday(t1.c3) - julianday(t0.c1) from (select end_date as c3 from job_history) as t1, (select start_date as c1 from job_history where employee_id = 114 and employee_id = 114) 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": "hr_1",
"sql": "select julianday(t1.c3) - julianday(t0.c1) from (select end_date as c3 from job_history) as t1, (select start_date as c1 from job_history where employee_id = 114 and employee_id = 114) as t0"
},
"style": "rule"
} | {
"index": 3719,
"split": "train"
} | |
What are the names of the courses that the student with ID 121 is registered for? | student_assessment | select t0.course_name from courses as t0 join student_course_registrations as t1 on t0.course_id = t1.course_id where t1.student_id = 121 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "student_assessment",
"sql": "select t0.course_name from courses as t0 join student_course_registrations as t1 on t0.course_id = t1.course_id where t1.student_id = 121"
},
"style": "rule"
} | {
"index": 1735,
"split": "train"
} | |
How many different vehicle details are used, and how many vehicles are associated with lessons having IDs 1 or 8? | driving_school | select count(distinct (t0.vehicle_details)), count(t0.vehicle_id) from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id where t1.lesson_id = 1 or t1.lesson_id = 8 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select count(distinct (t0.vehicle_details)), count(t0.vehicle_id) from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id where t1.lesson_id = 1 or t1.lesson_id = 8"
},
"style": "rule"
} | {
"index": 2940,
"split": "train"
} | |
What are the email addresses of parties that have the party IDs 8 or 15? | e_government | select t0.party_email from parties as t0 join party_forms as t1 on t0.party_id = t1.party_id where t1.party_id = 8 or t1.party_id = 15 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_government",
"sql": "select t0.party_email from parties as t0 join party_forms as t1 on t0.party_id = t1.party_id where t1.party_id = 8 or t1.party_id = 15"
},
"style": "rule"
} | {
"index": 2873,
"split": "train"
} | |
How many days are there between an employee's birth date and their hire date? | store_1 | select julianday(t1.c3) - julianday(t0.c0) from (select birth_date as c3 from employees) as t1, (select hire_date as c0 from employees) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select julianday(t1.c3) - julianday(t0.c0) from (select birth_date as c3 from employees) as t1, (select hire_date as c0 from employees) as t0"
},
"style": "rule"
} | {
"index": 3739,
"split": "train"
} | |
Can you tell me the first three hotels' price ranges and their star rating codes where the star rating code ends with "1," sorted by the star rating code? | cre_Theme_park | select t0.price_range, t1.star_rating_code as c0 from hotels as t0 join ref_hotel_star_ratings as t1 on t0.star_rating_code = t1.star_rating_code where c0 like '%1' order by c0 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Theme_park",
"sql": "select t0.price_range, t1.star_rating_code as c0 from hotels as t0 join ref_hotel_star_ratings as t1 on t0.star_rating_code = t1.star_rating_code where c0 like '%1' order by c0 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 2046,
"split": "train"
} | |
What are the status, height, and ID of up to five buildings with building ID 7 that have fewer than three associated office locations, ordered by status from Z to A? | company_office | select t0.status as c2, t0.height, t0.id as c0 from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where t1.building_id = 7 group by c0 having count(*) < 3 order by c2 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "company_office",
"sql": "select t0.status as c2, t0.height, t0.id as c0 from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where t1.building_id = 7 group by c0 having count(*) < 3 order by c2 desc limit 5"
},
"style": "rule"
} | {
"index": 1694,
"split": "train"
} | |
What are the names and IDs of amenities available in the dorm that has the highest total of amenity IDs, as well as in dorm number 100, listed alphabetically by amenity name? | dorm_1 | select t0.amenity_name as c1 from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid, (select dormid as c0 from has_amenity group by c0 order by sum(amenid) desc limit 1) as t0 where t1.dormid = t0.c0 or t1.dormid = 100 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": "dorm_1",
"sql": "select t0.amenity_name as c1 from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid, (select dormid as c0 from has_amenity group by c0 order by sum(amenid) desc limit 1) as t0 where t1.dormid = t0.c0 or t1.dormid = 100 order by c1 asc nulls last"... | {
"index": 1169,
"split": "train"
} | |
How many days pass between the race date and the race start time when the race begins around 8 PM? | formula_1 | select julianday(t1.c0) - julianday(t0.c1) from (select time as c0 from races) as t1, (select date as c1 from races where time like '20:00:%' and time like '20:00:%') as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "formula_1",
"sql": "select julianday(t1.c0) - julianday(t0.c1) from (select time as c0 from races) as t1, (select date as c1 from races where time like '20:00:%' and time like '20:00:%') as t0"
},
"style": "rule"
} | {
"index": 3715,
"split": "train"
} | |
When was the latest date with the highest Day Number within the period from June 8, 2008, to November 26, 2010? | cre_Doc_Tracking_DB | select t0.calendar_date, t0.day_number as c1 from ref_calendar as t0, (select max(day_number) as c0 from ref_calendar where calendar_date between '2008-06-08 12:45:38' and '2010-11-26 19:22:50') as t1 where c1 = t1.c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Tracking_DB",
"sql": "select t0.calendar_date, t0.day_number as c1 from ref_calendar as t0, (select max(day_number) as c0 from ref_calendar where calendar_date between '2008-06-08 12:45:38' and '2010-11-26 19:22:50') as t1 where c1 = t1.c0"
},
"style": "rule"
} | {
"index": 3751,
"split": "train"
} | |
Find the lowest and highest prices in dollars for furniture made by the manufacturer with ID 4.? | manufacturer | select min(price_in_dollar), max(price_in_dollar) from furniture_manufacte where manufacturer_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": "manufacturer",
"sql": "select min(price_in_dollar), max(price_in_dollar) from furniture_manufacte where manufacturer_id = 4"
},
"style": "rule"
} | {
"index": 3644,
"split": "train"
} | |
What are the author IDs and first names of the authors who contributed to the paper with ID 205, excluding the author with ID 61? | icfp_1 | select anon_1.c1, anon_1.c0 from (select t0.authid as c1, t0.fname as c0 from authors as t0 join authorship as t1 on t0.authid = t1.authid where t1.paperid = 205 except select t0.authid as c1, t0.fname as c0 from authors as t0 join authorship as t1 on t0.authid = t1.authid where t1.authid = 61) 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": "icfp_1",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.authid as c1, t0.fname as c0 from authors as t0 join authorship as t1 on t0.authid = t1.authid where t1.paperid = 205 except select t0.authid as c1, t0.fname as c0 from authors as t0 join authorship as t1 on t0.authid =... | {
"index": 1703,
"split": "train"
} | |
Show the transaction type descriptions, their codes, and the share counts for transactions where the amount of transaction is at least 822.803. | tracking_share_transactions | select t0.transaction_type_description, t0.transaction_type_code, t1.share_count from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.amount_of_transaction >= 822.803 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.transaction_type_description, t0.transaction_type_code, t1.share_count from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.amount_of_transaction >= 822.803"
},
... | {
"index": 2598,
"split": "train"
} | |
Which companies have offices in buildings with IDs 2 or 5, and what are their IDs, market values in billions, sales in billions, and the building IDs where they are located? | company_office | select t0.id, t0.market_value_billion, t0.sales_billion, t1.building_id as c1 from companies as t0 join office_locations as t1 on t0.id = t1.company_id where c1 = 2 or c1 = 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "company_office",
"sql": "select t0.id, t0.market_value_billion, t0.sales_billion, t1.building_id as c1 from companies as t0 join office_locations as t1 on t0.id = t1.company_id where c1 = 2 or c1 = 5"
},
"style": "rule"
} | {
"index": 677,
"split": "train"
} | |
What is the payment method and birth date of the customer whose phone number ends with "-395-2411" or is exactly "206-054-0689x05861", and who made the smallest payment? | driving_school | select t0.payment_method_code, t1.date_of_birth from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.phone_number like '%-395-2411' or t1.phone_number = '206-054-0689x05861' order by t0.amount_payment 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": "driving_school",
"sql": "select t0.payment_method_code, t1.date_of_birth from customer_payments as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.phone_number like '%-395-2411' or t1.phone_number = '206-054-0689x05861' order by t0.amount_payment asc nulls las... | {
"index": 622,
"split": "train"
} | |
What is the numerical difference between the game where injury accident 11 occurred and the earliest game involving a player whose name starts with "Wesle"? | game_injury | select t2.c2 - t0.c1 from (select min(game_id) as c2 from injury_accident where player like 'Wesle%') as t2, (select game_id as c1 from injury_accident where id = 11) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "game_injury",
"sql": "select t2.c2 - t0.c1 from (select min(game_id) as c2 from injury_accident where player like 'Wesle%') as t2, (select game_id as c1 from injury_accident where id = 11) as t0"
},
"style": "rule"
} | {
"index": 3194,
"split": "train"
} | |
Which customers have both policies that were opened on or after April 12, 2016, and policies that were closed on or after March 8, 2018? Please provide their names and customer IDs. | insurance_fnol | select anon_1.c0, anon_1.c1 from (select t0.customer_name as c0, t0.customer_id as c1 from customers as t0 join customers_policies as t1 on t0.customer_id = t1.customer_id where t1.date_opened >= '2016-04-12 00:00:00' intersect select t0.customer_name as c0, t0.customer_id as c1 from customers as t0 join customers_poli... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_fnol",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.customer_name as c0, t0.customer_id as c1 from customers as t0 join customers_policies as t1 on t0.customer_id = t1.customer_id where t1.date_opened >= '2016-04-12 00:00:00' intersect select t0.customer_name as ... | {
"index": 2477,
"split": "train"
} | |
What is the value of the smallest customer ID for customer 6 minus 4? | department_store | select t0.c1 - 4 from (select min(t1.customer_id) as c1 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 6 group by t0.customer_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select t0.c1 - 4 from (select min(t1.customer_id) as c1 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 6 group by t0.customer_id) as t0"
},
"style": "rule"
} | {
"index": 3229,
"split": "train"
} | |
What is the sum of customer IDs for each card, and which card has the lowest card ID? | customers_card_transactions | select sum(customer_id) from customers_cards group by card_id order by card_id asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select sum(customer_id) from customers_cards group by card_id order by card_id asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 1483,
"split": "train"
} | |
Which customers have council tax records linked through cross-references, and for each, what are their details, IDs, and the count of unique council tax cross-reference identifiers associated with them? | local_govt_mdm | select t0.cmi_details, t0.master_customer_id as c1, count(distinct (t2.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 join council_tax as t2 on t1.cmi_cross_ref_id = t2.cmi_cross_ref_id 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": "local_govt_mdm",
"sql": "select t0.cmi_details, t0.master_customer_id as c1, count(distinct (t2.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 join council_tax as t2 on t1.cmi_cross_ref_id = t2.... | {
"index": 2261,
"split": "train"
} | |
Is the percentage change in the minimum grant ID for 'APP' documents sent on January 23, 2004, compared to August 23, 1979, greater than the percentage change in the number of documents with descriptions starting with "Initial Appl%" sent on those same dates? | tracking_grants_for_research | select t5.c1 > t2.c0 from (select abs((t3.c3 / cast(t4.c3 as real) - 1) * 100) as c1 from (select min(t1.grant_id) as c3 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'APP' and t1.sent_date = '2004-01-23 11:57:08' group by t0.document_type_... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select t5.c1 > t2.c0 from (select abs((t3.c3 / cast(t4.c3 as real) - 1) * 100) as c1 from (select min(t1.grant_id) as c3 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_c... | {
"index": 3447,
"split": "train"
} | |
Show the rank of the tweet with ID 7 when all tweets are ordered by user ID in ascending order.? | twitter_1 | select t1.c0, t1.c1 as c4 from (select row_number() over (order by uid asc nulls last) as c0, id as c1 from tweets) as t1 where c4 = 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": "twitter_1",
"sql": "select t1.c0, t1.c1 as c4 from (select row_number() over (order by uid asc nulls last) as c0, id as c1 from tweets) as t1 where c4 = 7"
},
"style": "rule"
} | {
"index": 3511,
"split": "train"
} | |
Which allergy type has the highest number of unique allergies, and among all types, which one comes last alphabetically? | allergy_1 | select allergytype as c0, count(distinct (allergy)) from allergy_type group by c0 order by c0 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "allergy_1",
"sql": "select allergytype as c0, count(distinct (allergy)) from allergy_type group by c0 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 385,
"split": "train"
} | |
What is the average track ID for track 508 across all invoices with IDs less than 255? | store_1 | select t0.c2 from (select avg(t1.track_id) as c2 from tracks as t0 join invoice_lines as t1 on t0.id = t1.track_id where t0.id = 508 and t1.invoice_id < 255 group by t0.id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select t0.c2 from (select avg(t1.track_id) as c2 from tracks as t0 join invoice_lines as t1 on t0.id = t1.track_id where t0.id = 508 and t1.invoice_id < 255 group by t0.id) as t0"
},
"style": "rule"
} | {
"index": 3399,
"split": "train"
} | |
Which are the ten cell mobile phone numbers of customers who made payments between 5,475.26 and 6,970.98, listed in descending order? | driving_school | select t0.cell_mobile_phone_number as c0 from customers as t0 join customer_payments as t1 on t0.customer_id = t1.customer_id where t1.amount_payment between 5475.26 and 6970.98 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": "driving_school",
"sql": "select t0.cell_mobile_phone_number as c0 from customers as t0 join customer_payments as t1 on t0.customer_id = t1.customer_id where t1.amount_payment between 5475.26 and 6970.98 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 1995,
"split": "train"
} | |
Which five student addresses have the highest monthly rental amounts for students involved in the most common incident type or incident types related to "isturban," sorted by student ID in descending order? | behavior_monitoring | select t0.student_id as c1, t0.monthly_rental from student_addresses as t0 join students as t1 on t0.student_id = t1.student_id join behavior_incident as t2 on t1.student_id = t2.student_id join ref_incident_type as t3 on t2.incident_type_code = t3.incident_type_code, (select incident_type_description as c0 from ref_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": "behavior_monitoring",
"sql": "select t0.student_id as c1, t0.monthly_rental from student_addresses as t0 join students as t1 on t0.student_id = t1.student_id join behavior_incident as t2 on t1.student_id = t2.student_id join ref_incident_type as t3 on t2.incident_type_code = t3.i... | {
"index": 2715,
"split": "train"
} | |
Who are the youngest three students who visited restaurants located at the most frequently visited address? List their age, last name, city code, and student ID. | restaurant_1 | select t0.age as c3, t0.lname, t0.city_code, t1.stuid from student as t0 join visits_restaurant as t1 on t0.stuid = t1.stuid join restaurant as t2 on t1.resid = t2.resid, (select address as c1 from restaurant group by c1 order by count(*) asc nulls last limit 1) as t0 where t2.address = t0.c1 order by c3 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": "restaurant_1",
"sql": "select t0.age as c3, t0.lname, t0.city_code, t1.stuid from student as t0 join visits_restaurant as t1 on t0.stuid = t1.stuid join restaurant as t2 on t1.resid = t2.resid, (select address as c1 from restaurant group by c1 order by count(*) asc nulls last lim... | {
"index": 2050,
"split": "train"
} | |
What are the organizer, open date, church ID, year, and female ID for the wedding involving the person with ID 2 that has the lowest female ID? | wedding | select t0.organized_by, t0.open_date, t0.church_id, t1.year, t1.female_id as c1 from church as t0 join wedding as t1 on t0.church_id = t1.church_id join people as t2 on t1.female_id = t2.people_id where t2.people_id = 2 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": "wedding",
"sql": "select t0.organized_by, t0.open_date, t0.church_id, t1.year, t1.female_id as c1 from church as t0 join wedding as t1 on t0.church_id = t1.church_id join people as t2 on t1.female_id = t2.people_id where t2.people_id = 2 order by c1 asc nulls last limit 1"
},
... | {
"index": 893,
"split": "train"
} | |
What are the top 3 genres by name in reverse alphabetical order, and what is the average unit price of the track with ID 1682 in each of those genres? | store_1 | select t0.id as c0, avg(t1.unit_price) from genres as t0 join tracks as t1 on t0.id = t1.genre_id where t1.id = 1682 group by c0 order by t0.name 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": "store_1",
"sql": "select t0.id as c0, avg(t1.unit_price) from genres as t0 join tracks as t1 on t0.id = t1.genre_id where t1.id = 1682 group by c0 order by t0.name desc limit 3"
},
"style": "rule"
} | {
"index": 1355,
"split": "train"
} | |
What is the number of days that passed between when a claim was made and when it was settled for all claims with a settlement amount of at least 1189? | insurance_policies | select julianday(t1.c3) - julianday(t0.c0) from (select date_claim_settled as c3 from claims where amount_settled >= 1189 and amount_settled >= 1189) as t1, (select date_claim_made as c0 from claims) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_policies",
"sql": "select julianday(t1.c3) - julianday(t0.c0) from (select date_claim_settled as c3 from claims where amount_settled >= 1189 and amount_settled >= 1189) as t1, (select date_claim_made as c0 from claims) as t0"
},
"style": "rule"
} | {
"index": 3981,
"split": "train"
} | |
What is the job title and the name of the friend for the individual whose friendship lasted for more than 10 years, with the highest-ranked job in reverse alphabetical order? | network_2 | select t0.job as c1, t1.name from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.year > 10 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": "network_2",
"sql": "select t0.job as c1, t1.name from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.year > 10 order by c1 desc limit 1"
},
"style": "rule"
} | {
"index": 1338,
"split": "train"
} | |
Can you tell me the assigned-to staff IDs and staff IDs for staff members named Kenyatta Weber or whose last names contain the letter "r"? | tracking_software_problems | select t0.assigned_to_staff_id, t1.staff_id from problem_log as t0 join staff as t1 on t0.assigned_to_staff_id = t1.staff_id where t1.staff_first_name = 'Kenyatta' and t1.staff_last_name = 'Weber' or t1.staff_last_name like '%r%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t0.assigned_to_staff_id, t1.staff_id from problem_log as t0 join staff as t1 on t0.assigned_to_staff_id = t1.staff_id where t1.staff_first_name = 'Kenyatta' and t1.staff_last_name = 'Weber' or t1.staff_last_name like '%r%'"
},
"styl... | {
"index": 567,
"split": "train"
} | |
Find the names, ages, and political parties of the top three drivers who are assigned to the school with ID 7, listed in reverse alphabetical order by their names. | school_bus | select t0.name as c0, t0.age, t0.party from driver as t0 join school_bus as t1 on t0.driver_id = t1.driver_id join school as t2 on t1.school_id = t2.school_id where t2.school_id = 7 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": "school_bus",
"sql": "select t0.name as c0, t0.age, t0.party from driver as t0 join school_bus as t1 on t0.driver_id = t1.driver_id join school as t2 on t1.school_id = t2.school_id where t2.school_id = 7 order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 744,
"split": "train"
} | |
Find the 200-meter and 300-meter times, IDs, and names of swimmers who have participated in events held at stadiums located in a city that includes "Petersbur" in its name. | swimming | select anon_1.c1, anon_1.c0, anon_1.c3, anon_1.c2 from (select meter_200 as c1, id as c0, meter_300 as c3, name as c2 from swimmer intersect select t0.meter_200 as c1, t0.id as c0, t0.meter_300 as c3, t0.name as c2 from swimmer as t0 join record as t1 on t0.id = t1.swimmer_id join event as t2 on t1.event_id = t2.id joi... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "swimming",
"sql": "select anon_1.c1, anon_1.c0, anon_1.c3, anon_1.c2 from (select meter_200 as c1, id as c0, meter_300 as c3, name as c2 from swimmer intersect select t0.meter_200 as c1, t0.id as c0, t0.meter_300 as c3, t0.name as c2 from swimmer as t0 join record as t1 on t0.id ... | {
"index": 334,
"split": "train"
} | |
For each premise detail, how many premises are there, and how many different types of premises does it include? | customers_campaigns_ecommerce | select premise_details as c1, count(premise_id), count(distinct (premises_type)) from premises 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": "customers_campaigns_ecommerce",
"sql": "select premise_details as c1, count(premise_id), count(distinct (premises_type)) from premises group by c1"
},
"style": "rule"
} | {
"index": 2134,
"split": "train"
} | |
Can you list the draft numbers, copy numbers, and document IDs from the circulation history records, excluding those entries where the employee involved has a role description ending with "ditor"? | cre_Doc_Control_Systems | select anon_1.c2, anon_1.c1, anon_1.c0 from (select draft_number as c2, copy_number as c1, document_id as c0 from circulation_history except select t0.draft_number as c2, t0.copy_number as c1, t0.document_id as c0 from circulation_history as t0 join employees as t1 on t0.employee_id = t1.employee_id join roles as t2 on... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Control_Systems",
"sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select draft_number as c2, copy_number as c1, document_id as c0 from circulation_history except select t0.draft_number as c2, t0.copy_number as c1, t0.document_id as c0 from circulation_history as t0 j... | {
"index": 1524,
"split": "train"
} | |
Is the mountain ID of the photo with ID 3 less than the total number of photos in the database? | mountain_photos | select t2.c1 < t1.c3 from (select mountain_id as c1 from photos where id = 3) as t2, (select count(mountain_id) as c3 from photos) as t1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "mountain_photos",
"sql": "select t2.c1 < t1.c3 from (select mountain_id as c1 from photos where id = 3) as t2, (select count(mountain_id) as c3 from photos) as t1"
},
"style": "rule"
} | {
"index": 3317,
"split": "train"
} | |
Can you tell me each company's ID and the number of profit entries recorded for it? | company_office | select id as c0, count(profits_billion) from companies 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": "company_office",
"sql": "select id as c0, count(profits_billion) from companies group by c0"
},
"style": "rule"
} | {
"index": 1275,
"split": "train"
} | |
How many days passed between the order date and the actual delivery date for the relevant orders? | cre_Drama_Workshop_Groups | select julianday(t1.c3) - julianday(t0.c1) from (select order_date as c3 from customer_orders) as t1, (select actual_delivery_date as c1 from customer_orders where order_date <= '1988-11-13 15:42:13' and order_date <= '1988-11-13 15:42:13') 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.c3) - julianday(t0.c1) from (select order_date as c3 from customer_orders) as t1, (select actual_delivery_date as c1 from customer_orders where order_date <= '1988-11-13 15:42:13' and order_date <= '1988-11-13 15:42:13') as ... | {
"index": 3686,
"split": "train"
} | |
How does the accelerator-browser pair that has both identifiers equal to 1 rank in the list ordered by most recent compatibility year? | browser_web | select t1.c3, t1.c1 as c8, t1.c7 as c4 from (select row_number() over (order by compatible_since_year desc) as c3, accelerator_id as c1, browser_id as c7 from accelerator_compatible_browser) as t1 where c8 = 1 and 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": "browser_web",
"sql": "select t1.c3, t1.c1 as c8, t1.c7 as c4 from (select row_number() over (order by compatible_since_year desc) as c3, accelerator_id as c1, browser_id as c7 from accelerator_compatible_browser) as t1 where c8 = 1 and c4 = 1"
},
"style": "rule"
} | {
"index": 3865,
"split": "train"
} | |
Which are the three performers with the highest names in reverse alphabetical order, along with their phone numbers, address IDs, and the county and state of their addresses, who are associated with customers having either the least common email address among those living at address IDs less than or equal to 19 or exac... | cre_Drama_Workshop_Groups | select t0.customer_name as c0, t0.customer_phone, t0.address_id, t1.state_county from performers as t0 join addresses as t1 on t0.address_id = t1.address_id join customers as t2 on t1.address_id = t2.address_id, (select customer_email_address as c1 from customers where address_id <= 19 or address_id = 180 group by c1 o... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Drama_Workshop_Groups",
"sql": "select t0.customer_name as c0, t0.customer_phone, t0.address_id, t1.state_county from performers as t0 join addresses as t1 on t0.address_id = t1.address_id join customers as t2 on t1.address_id = t2.address_id, (select customer_email_address a... | {
"index": 2484,
"split": "train"
} | |
Which are the lowest ten member levels along with their member IDs, where these members made purchases at the most popular branch (the one with the highest number of registrations) located on roads containing "e"? | shop_membership | select t0.level as c1, t0.member_id, t1.member_id from member as t0 join purchase as t1 on t0.member_id = t1.member_id join membership_register_branch as t2 on t0.member_id = t2.member_id join branch as t3 on t2.branch_id = t3.branch_id, (select name as c2 from branch group by c2 order by count(*) asc nulls last limit ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "shop_membership",
"sql": "select t0.level as c1, t0.member_id, t1.member_id from member as t0 join purchase as t1 on t0.member_id = t1.member_id join membership_register_branch as t2 on t0.member_id = t2.member_id join branch as t3 on t2.branch_id = t3.branch_id, (select name as ... | {
"index": 2889,
"split": "train"
} | |
What are the apartment numbers of the first three apartments that have facilities starting with "Swimming", sorted in order of their apartment numbers? | apartment_rentals | select t0.apt_number as c0 from apartments as t0 join apartment_facilities as t1 on t0.apt_id = t1.apt_id where t1.facility_code like 'Swimming%' order by c0 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "apartment_rentals",
"sql": "select t0.apt_number as c0 from apartments as t0 join apartment_facilities as t1 on t0.apt_id = t1.apt_id where t1.facility_code like 'Swimming%' order by c0 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 51,
"split": "train"
} | |
Which submissions for the workshop with ID 3 have been accepted, and what are the college, scores, submission ID, and workshop ID associated with those acceptances? Show me one such record. | workshop_paper | select t0.college, t0.scores, t1.submission_id, t1.workshop_id as c2 from submission as t0 join acceptance as t1 on t0.submission_id = t1.submission_id join workshop as t2 on t1.workshop_id = t2.workshop_id where t2.workshop_id = 3 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": "workshop_paper",
"sql": "select t0.college, t0.scores, t1.submission_id, t1.workshop_id as c2 from submission as t0 join acceptance as t1 on t0.submission_id = t1.submission_id join workshop as t2 on t1.workshop_id = t2.workshop_id where t2.workshop_id = 3 order by c2 asc nulls l... | {
"index": 1265,
"split": "train"
} | |
What is the percentage difference of the lowest average customer ID among all drama workshop groups, based on bookings made exactly on October 11, 1991, at 5:24 PM, considering only customer IDs less than 938? | cre_Drama_Workshop_Groups | select (min(t0.c0) / cast(min(t0.c0) as real) - 1) * 100 from (select avg(t1.customer_id) as c0 from drama_workshop_groups as t0 join bookings as t1 on t0.workshop_group_id = t1.workshop_group_id where t1.order_date = '1991-10-11 17:24:15' and t1.customer_id < 938 group by t0.workshop_group_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": "cre_Drama_Workshop_Groups",
"sql": "select (min(t0.c0) / cast(min(t0.c0) as real) - 1) * 100 from (select avg(t1.customer_id) as c0 from drama_workshop_groups as t0 join bookings as t1 on t0.workshop_group_id = t1.workshop_group_id where t1.order_date = '1991-10-11 17:24:15' and ... | {
"index": 3014,
"split": "train"
} | |
Find the IDs, review counts, and titles of the first five items whose titles include the letter "e", sorted by their item ID. | epinions_1 | select sum(t0.i_id), count(*), t1.title as c0 from review as t0 join item as t1 on t0.i_id = t1.i_id where c0 like '%e%' group by t1.i_id order by t1.i_id asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select sum(t0.i_id), count(*), t1.title as c0 from review as t0 join item as t1 on t0.i_id = t1.i_id where c0 like '%e%' group by t1.i_id order by t1.i_id asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2938,
"split": "train"
} | |
What is the minimum card ID associated with account 15, minus 3? | customers_card_transactions | select t0.c0 - 3 from (select min(t1.card_id) as c0 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 15 group by t0.account_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select t0.c0 - 3 from (select min(t1.card_id) as c0 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 15 group by t0.account_id) as t0"
},
"style": "rule"
} | {
"index": 3228,
"split": "train"
} | |
What is the change in the average staff IDs involved in customer 114's complaints between the complaint made in 1973 and the complaint made in 2006? | customer_complaints | select t1.c1 - t0.c1 from (select avg(t1.staff_id) as c1 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 114 and t1.date_complaint_raised = '1973-02-10 22:55:56' group by t0.customer_id) as t1, (select t0.customer_id, avg(t1.staff_id) as c1 from customers as t0 join ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 avg(t1.staff_id) as c1 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 114 and t1.date_complaint_raised = '1973-02-10 22:55:56' group by t0.customer_id) as t1, (se... | {
"index": 3518,
"split": "train"
} | |
Which building has apartments with the most rooms, and among those, what is the building manager and short name of the building that comes last in reverse alphabetical order? Show only this one building. | apartment_rentals | select t0.building_manager, t0.building_short_name as c0 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id, (select room_count as c1 from apartments group by c1 order by max(building_id) desc limit 1) as t0 where t1.room_count = t0.c1 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": "apartment_rentals",
"sql": "select t0.building_manager, t0.building_short_name as c0 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id, (select room_count as c1 from apartments group by c1 order by max(building_id) desc limit 1) as t0 where t... | {
"index": 2018,
"split": "train"
} | |
What are the first 10 product names, sorted alphabetically, that have issues reported by staff members with IDs of 13 or less? | tracking_software_problems | select t0.product_name as c0 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t1.reported_by_staff_id <= 13 order by c0 asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t0.product_name as c0 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t1.reported_by_staff_id <= 13 order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 1117,
"split": "train"
} | |
What are the ACC regular season scores, total home games, and total games played for the first five basketball matches, sorted by the total number of games in ascending order? | university_basketball | select acc_regular_season, all_home, all_games as c2 from basketball_match order by c2 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "university_basketball",
"sql": "select acc_regular_season, all_home, all_games as c2 from basketball_match order by c2 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 1222,
"split": "train"
} | |
Which participants are involved in events with participant id 26 but not with participant id 37? For these participants, what are their participant type codes, details, and ids? | local_govt_in_alabama | select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.participant_type_code as c2, t0.participant_details as c1, t0.participant_id as c0 from participants as t0 join participants_in_events as t1 on t0.participant_id = t1.participant_id where t1.participant_id = 26 except select t0.participant_type_code as c2, t0.parti... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_in_alabama",
"sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.participant_type_code as c2, t0.participant_details as c1, t0.participant_id as c0 from participants as t0 join participants_in_events as t1 on t0.participant_id = t1.participant_id where t1.pa... | {
"index": 1138,
"split": "train"
} | |
Is the latitude of station 58 lower than the average latitude of all stations that are exactly at latitude 37.794231? | bike_1 | select t2.c3 < t1.c0 from (select lat as c3 from station where id = 58) as t2, (select avg(lat) as c0 from station where lat = 37.794230999999996) as t1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "bike_1",
"sql": "select t2.c3 < t1.c0 from (select lat as c3 from station where id = 58) as t2, (select avg(lat) as c0 from station where lat = 37.794230999999996) as t1"
},
"style": "rule"
} | {
"index": 3310,
"split": "train"
} | |
What is the title and minimum artist ID of the album that comes last alphabetically among those with a minimum artist ID of at least 230? | chinook_1 | select title as c0, min(artistid) from album group by c0 having min(artistid) >= 230 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": "chinook_1",
"sql": "select title as c0, min(artistid) from album group by c0 having min(artistid) >= 230 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 461,
"split": "train"
} | |
How many more (or fewer) unique documents are associated with functional area 9 compared to functional area 1? | document_management | select t1.c1 - t0.c1 from (select count(distinct (t1.document_code)) as c1 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t0.functional_area_code = 1 group by t0.functional_area_code) as t1, (select t0.functional_area_code, count(distinct (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": "document_management",
"sql": "select t1.c1 - t0.c1 from (select count(distinct (t1.document_code)) as c1 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t0.functional_area_code = 1 group by t0.functional_... | {
"index": 3602,
"split": "train"
} | |
What is the publication year of the book club with ID 4? | culture_company | select year from book_club where book_club_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": "culture_company",
"sql": "select year from book_club where book_club_id = 4"
},
"style": "rule"
} | {
"index": 3366,
"split": "train"
} | |
Which ten cities appear first when sorting the city names alphabetically? | city_record | select city as c0 from city order by c0 asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "city_record",
"sql": "select city as c0 from city order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 1580,
"split": "train"
} | |
Show the scholarship status and the number of unique games played for students with IDs less than 1033. | game_1 | select onscholarship as c0, count(distinct (gamesplayed)) from sportsinfo where stuid <= 1001 or stuid < 1033 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": "game_1",
"sql": "select onscholarship as c0, count(distinct (gamesplayed)) from sportsinfo where stuid <= 1001 or stuid < 1033 group by c0"
},
"style": "rule"
} | {
"index": 1325,
"split": "train"
} | |
For each team, what are the values of L, So, and Year, and what is the total number of home games with at least 33 games played in that year? | baseball_1 | select t0.l, t0.so, t0.year as c3, sum(t1.games) from team as t0 join home_game as t1 on t0.team_id = t1.team_id where t1.games >= 33 group by c3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select t0.l, t0.so, t0.year as c3, sum(t1.games) from team as t0 join home_game as t1 on t0.team_id = t1.team_id where t1.games >= 33 group by c3"
},
"style": "rule"
} | {
"index": 202,
"split": "train"
} | |
What are the Product IDs, other item details, order quantities, and order IDs for order items that involve the product 'photo', excluding those with product IDs that include '18'? | cre_Drama_Workshop_Groups | select anon_1.c0, anon_1.c3, anon_1.c2, anon_1.c1 from (select t0.product_id as c0, t0.other_item_details as c3, t0.order_quantity as c2, t0.order_id as c1 from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_name = 'photo' except select t0.product_id as c0, t0.other_item_details... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Drama_Workshop_Groups",
"sql": "select anon_1.c0, anon_1.c3, anon_1.c2, anon_1.c1 from (select t0.product_id as c0, t0.other_item_details as c3, t0.order_quantity as c2, t0.order_id as c1 from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.pro... | {
"index": 1312,
"split": "train"
} | |
What are the most recent five gas stations' opening years and station IDs, along with the associated company IDs and station IDs from the station-company pairs linked to companies with market values between 294.7 and 407.4? | gas_company | select t0.open_year as c2, t0.station_id, t1.company_id, t1.station_id from gas_station as t0 join station_company as t1 on t0.station_id = t1.station_id join company as t2 on t1.company_id = t2.company_id where t2.market_value between 294.7 and 407.4 order by c2 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "gas_company",
"sql": "select t0.open_year as c2, t0.station_id, t1.company_id, t1.station_id from gas_station as t0 join station_company as t1 on t0.station_id = t1.station_id join company as t2 on t1.company_id = t2.company_id where t2.market_value between 294.7 and 407.4 order ... | {
"index": 1577,
"split": "train"
} | |
? | swimming | select t0.opening_year, t0.capacity, t2.id from stadium as t0 join event as t1 on t0.id = t1.stadium_id join record as t2 on t1.id = t2.event_id join swimmer as t3 on t2.swimmer_id = t3.id where t3.meter_100 < 57.34 or t3.meter_100 > 57.35 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t0.opening_year, t0.capacity, t2.id from stadium as t0 join event as t1 on t0.id = t1.stadium_id join record as t2 on t1.id = t2.event_id join swimmer as t3 on t2.swimmer_id = t3.id where t3.meter_100 < 57.34 or t3.meter_100 > 57.35"
},
"style": "rul... | {
"index": 1793,
"split": "train"
} | |
What are the names of airports and their average 'y' value for airports located in countries that contain the phrase "s an" or end with "us", with the results grouped by airport name? | flight_4 | select name as c0, avg(y) from airports where country like '%s an%' or country like '%us' 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": "flight_4",
"sql": "select name as c0, avg(y) from airports where country like '%s an%' or country like '%us' group by c0"
},
"style": "rule"
} | {
"index": 1135,
"split": "train"
} | |
What is the percentage change in the highest project ID assigned to researchers with project IDs up to 11 from March 19, 2002, to June 9, 1993? | tracking_grants_for_research | select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select max(t1.project_id) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'researcher' and t1.date_to = '1993-06-09 12:44:28' and t1.project_id <= 11 group by t0.role_code) as t0, (select t0.role_code, max(t1.... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select max(t1.project_id) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'researcher' and t1.date_to = '1993-06-09 12:44:28' and ... | {
"index": 3424,
"split": "train"
} | |
Can you tell me the data types, IDs, and names of the first three attribute definitions that either have an ID of 1 or are not associated with any catalog additional attributes, ordered by attribute data type? | product_catalog | select attribute_data_type as c0, attribute_id as c2, attribute_name from attribute_definitions where c2 = 1 or (not c2 in (select c2 as c1 from catalog_contents_additional_attributes)) order by c0 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "product_catalog",
"sql": "select attribute_data_type as c0, attribute_id as c2, attribute_name from attribute_definitions where c2 = 1 or (not c2 in (select c2 as c1 from catalog_contents_additional_attributes)) order by c0 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 73,
"split": "train"
} | |
Which individuals have a clean jerk of 175 or less and a people ID between 3 and 6? What are their IDs and birth dates? | body_builder | select anon_1.c0, anon_1.c1 from (select t0.people_id as c0, t0.birth_date as c1 from people as t0 join body_builder as t1 on t0.people_id = t1.people_id where t1.clean_jerk <= 175.0 intersect select t0.people_id as c0, t0.birth_date as c1 from people as t0 join body_builder as t1 on t0.people_id = t1.people_id where t... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "body_builder",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.people_id as c0, t0.birth_date as c1 from people as t0 join body_builder as t1 on t0.people_id = t1.people_id where t1.clean_jerk <= 175.0 intersect select t0.people_id as c0, t0.birth_date as c1 from people as t0... | {
"index": 2700,
"split": "train"
} | |
Find the customer IDs and order IDs for customers with ID 2 or 7, sorted by customer ID. | customers_and_invoices | select t0.customer_id as c1, t0.order_id from orders as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.customer_id = 2 or t1.customer_id = 7 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": "customers_and_invoices",
"sql": "select t0.customer_id as c1, t0.order_id from orders as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.customer_id = 2 or t1.customer_id = 7 order by c1 asc nulls last"
},
"style": "rule"
} | {
"index": 184,
"split": "train"
} | |
Find the login names of the first five course authors and tutors who have created a course with the description "data structure," sorted alphabetically by their login name. | e_learning | select t0.login_name as c0 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_description = 'data structure' 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": "e_learning",
"sql": "select t0.login_name as c0 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_description = 'data structure' order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2633,
"split": "train"
} | |
What are the last names, phone numbers, and first names of staff members, along with the complaint status codes, for complaints about products priced at $23.35 or more? | customer_complaints | select t0.last_name, t0.phone_number, t0.first_name, t1.complaint_status_code from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id join products as t2 on t1.product_id = t2.product_id where t2.product_price >= 23.35 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select t0.last_name, t0.phone_number, t0.first_name, t1.complaint_status_code from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id join products as t2 on t1.product_id = t2.product_id where t2.product_price >= 23.35"
},
"style": "r... | {
"index": 522,
"split": "train"
} | |
Which hosts' nationality, ID, age, and name are listed, excluding those who attended parties with more than four hosts? | party_host | select anon_1.c2, anon_1.c0, anon_1.c3, anon_1.c1 from (select nationality as c2, host_id as c0, age as c3, name as c1 from host except select t0.nationality as c2, t0.host_id as c0, t0.age as c3, t0.name as c1 from host as t0 join party_host as t1 on t0.host_id = t1.host_id join party as t2 on t1.party_id = t2.party_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": "party_host",
"sql": "select anon_1.c2, anon_1.c0, anon_1.c3, anon_1.c1 from (select nationality as c2, host_id as c0, age as c3, name as c1 from host except select t0.nationality as c2, t0.host_id as c0, t0.age as c3, t0.name as c1 from host as t0 join party_host as t1 on t0.host... | {
"index": 1805,
"split": "train"
} | |
What is the percentage change in the number of unique documents marked as done that were received on September 26, 1983, at 09:32:56 compared to another point in time? | cre_Doc_Control_Systems | select (t0.c1 / cast(t0.c1 as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c1 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t0.document_status_code = 'done' and t1.receipt_date = '1983-09-26 09:32:56' group by t0.document_status_code)... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Control_Systems",
"sql": "select (t0.c1 / cast(t0.c1 as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c1 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t0.document_status_code = 'done' and... | {
"index": 3410,
"split": "train"
} | |
Which regions were affected by storm number 4 but not by the region with ID 2? | storm_record | select anon_1.c1, anon_1.c0 from (select t0.region_id as c1, t0.region_name as c0 from region as t0 join affected_region as t1 on t0.region_id = t1.region_id where t1.storm_id = 4 except select t0.region_id as c1, t0.region_name as c0 from region as t0 join affected_region as t1 on t0.region_id = t1.region_id where 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": "storm_record",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.region_id as c1, t0.region_name as c0 from region as t0 join affected_region as t1 on t0.region_id = t1.region_id where t1.storm_id = 4 except select t0.region_id as c1, t0.region_name as c0 from region as t0 join... | {
"index": 666,
"split": "train"
} | |
Can you specify the overall range between the smallest and largest total compatible since years across all browsers? | browser_web | select min(t0.c3), max(t0.c3) from (select sum(t1.compatible_since_year) as c3 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id group by t0.id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "browser_web",
"sql": "select min(t0.c3), max(t0.c3) from (select sum(t1.compatible_since_year) as c3 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id group by t0.id) as t0"
},
"style": "rule"
} | {
"index": 3635,
"split": "train"
} | |
What is the smallest transaction amount, along with the customer ID and account ID, for accounts belonging to the customer with the highest customer ID among those with customer ID 9 or greater? | customers_and_invoices | select min(t0.transaction_amount), t1.customer_id as c1, t1.account_id as c2 from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id, (select max(customer_id) as c3 from accounts where customer_id = 9 or customer_id >= 8) as t0 where c1 = t0.c3 group by c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select min(t0.transaction_amount), t1.customer_id as c1, t1.account_id as c2 from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id, (select max(customer_id) as c3 from accounts where customer_id = 9 or customer_id ... | {
"index": 1721,
"split": "train"
} | |
When was the most recent address ID recorded in the customer's address history? | customers_and_products_contacts | select t0.date_to, t0.address_id as c0 from customer_address_history as t0, (select max(address_id) as c1 from customer_address_history) as t1 where c0 = 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": "customers_and_products_contacts",
"sql": "select t0.date_to, t0.address_id as c0 from customer_address_history as t0, (select max(address_id) as c1 from customer_address_history) as t1 where c0 = t1.c1"
},
"style": "rule"
} | {
"index": 3758,
"split": "train"
} | |
Which five cities have the lowest Black population percentages, and what are their names? | county_public_safety | select black as c0, name from city 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": "county_public_safety",
"sql": "select black as c0, name from city order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2856,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.