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 |
|---|---|---|---|---|---|---|---|---|
Did customer 5 become a customer before customer 11? | customer_deliveries | select t1.c2 < t0.c2 from (select date_became_customer as c2 from customers where customer_id = 5) as t1, (select date_became_customer as c2 from customers where customer_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": "customer_deliveries",
"sql": "select t1.c2 < t0.c2 from (select date_became_customer as c2 from customers where customer_id = 5) as t1, (select date_became_customer as c2 from customers where customer_id = 11) as t0"
},
"style": "rule"
} | {
"index": 3120,
"split": "train"
} | |
What is the grape, its color, the winery, and the number of cases for the most common appellation area ending with "unty" or named "Fiddletown"? | wine_1 | select t0.grape as c4, t0.color, t1.winery, t1.cases from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation, (select area as c2 from appellations where appelation like '%unty' or appelation = 'Fiddletown' group by c2 order by count(*) desc limit 1) as t0 where ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "wine_1",
"sql": "select t0.grape as c4, t0.color, t1.winery, t1.cases from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation, (select area as c2 from appellations where appelation like '%unty' or appelation = 'Fiddletown'... | {
"index": 392,
"split": "train"
} | |
What is the OMIM ranking of the second enzyme with a product ending in "linogen" when the enzymes are ordered descendingly by OMIM number? | medicine_enzyme_interaction | select t1.c4, t1.c1 as c5 from (select row_number() over (order by omim desc) as c4, id as c1 from enzyme where product like '%linogen') as t1 where c5 = 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": "medicine_enzyme_interaction",
"sql": "select t1.c4, t1.c1 as c5 from (select row_number() over (order by omim desc) as c4, id as c1 from enzyme where product like '%linogen') as t1 where c5 = 2"
},
"style": "rule"
} | {
"index": 3491,
"split": "train"
} | |
Which product names and IDs are associated with problems that were closed by staff members whose last names include "k", along with the descriptions of those problems? | tracking_software_problems | select t0.product_name, t0.product_id, t1.problem_description from product as t0 join problems as t1 on t0.product_id = t1.product_id join staff as t2 on t1.closure_authorised_by_staff_id = t2.staff_id where t2.staff_last_name like '%k%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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, t0.product_id, t1.problem_description from product as t0 join problems as t1 on t0.product_id = t1.product_id join staff as t2 on t1.closure_authorised_by_staff_id = t2.staff_id where t2.staff_last_name like '%k%'"
},... | {
"index": 1020,
"split": "train"
} | |
What are the top 10 values for Invested amount, Total Budget Percent Budgeted, and Location for schools with endowments of at least 9.05 and school IDs less than or equal to 2, sorted by location in reverse alphabetical order? | school_finance | select t0.invested, t0.total_budget_percent_budgeted, t1.location as c1 from budget as t0 join school as t1 on t0.school_id = t1.school_id join endowment as t2 on t1.school_id = t2.school_id where t2.amount >= 9.05 and t2.school_id <= 2 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": "school_finance",
"sql": "select t0.invested, t0.total_budget_percent_budgeted, t1.location as c1 from budget as t0 join school as t1 on t0.school_id = t1.school_id join endowment as t2 on t1.school_id = t2.school_id where t2.amount >= 9.05 and t2.school_id <= 2 order by c1 desc l... | {
"index": 964,
"split": "train"
} | |
Which destination airport has the lowest average destination airport ID, when grouping routes by destination airport and ordering alphabetically (with nulls last), and what is that average? | flight_4 | select avg(dst_apid) from routes group by dst_ap order by dst_ap 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": "flight_4",
"sql": "select avg(dst_apid) from routes group by dst_ap order by dst_ap asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2321,
"split": "train"
} | |
Who are the top 10 governors and comptrollers from parties where the lieutenant governor's name ends with "e," ordered by the most recent election year? | election | select governor, comptroller from party where lieutenant_governor like '%e' order by year 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",
"sql": "select governor, comptroller from party where lieutenant_governor like '%e' order by year desc limit 10"
},
"style": "rule"
} | {
"index": 1089,
"split": "train"
} | |
Is the attribute ID linked to catalog entry 6 greater than the attribute ID linked to catalog entry 1? | product_catalog | select t1.c1 > t0.c1 from (select attribute_id as c1 from catalog_contents_additional_attributes where catalog_entry_id = 1) as t1, (select attribute_id as c1 from catalog_contents_additional_attributes where catalog_entry_id = 6) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "product_catalog",
"sql": "select t1.c1 > t0.c1 from (select attribute_id as c1 from catalog_contents_additional_attributes where catalog_entry_id = 1) as t1, (select attribute_id as c1 from catalog_contents_additional_attributes where catalog_entry_id = 6) as t0"
},
"style": ... | {
"index": 3552,
"split": "train"
} | |
For each aircraft ID with a model starting with "Advantage (Low", how many records are there, and how many different fleet series are associated with it? | pilot_record | select aircraft_id as c1, count(*), count(distinct (fleet_series)) from aircraft where model like 'Advantage (Low %' 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": "pilot_record",
"sql": "select aircraft_id as c1, count(*), count(distinct (fleet_series)) from aircraft where model like 'Advantage (Low %' group by c1"
},
"style": "rule"
} | {
"index": 561,
"split": "train"
} | |
Is the highest artist ID associated with artist 59's albums greater than 58? | store_1 | select t0.c2 > 58 from (select max(t1.artist_id) as c2 from artists as t0 join albums as t1 on t0.id = t1.artist_id where t0.id = 59 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 > 58 from (select max(t1.artist_id) as c2 from artists as t0 join albums as t1 on t0.id = t1.artist_id where t0.id = 59 group by t0.id) as t0"
},
"style": "rule"
} | {
"index": 3301,
"split": "train"
} | |
For each course with an ID of 13 or 4, what are the course IDs and the smallest author ID associated with each? | e_learning | select course_id as c1, min(author_id) from courses where c1 = 13 or c1 = 4 group by c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select course_id as c1, min(author_id) from courses where c1 = 13 or c1 = 4 group by c1"
},
"style": "rule"
} | {
"index": 2060,
"split": "train"
} | |
What are the apartment numbers and their highest bedroom counts for apartments that have "4" in their number or start with "Apt.", grouped by the apartment number? | apartment_rentals | select apt_number as c1, max(bedroom_count) from apartments where c1 like '%4%' or c1 like 'Apt.%' 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": "apartment_rentals",
"sql": "select apt_number as c1, max(bedroom_count) from apartments where c1 like '%4%' or c1 like 'Apt.%' group by c1"
},
"style": "rule"
} | {
"index": 2302,
"split": "train"
} | |
What is the highest book ID and the average price for each publication publisher? | book_2 | select publisher as c1, max(book_id), avg(price) from publication 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": "book_2",
"sql": "select publisher as c1, max(book_id), avg(price) from publication group by c1"
},
"style": "rule"
} | {
"index": 1471,
"split": "train"
} | |
Which artists have gender, name, and country details, and are associated with genres that have a perfect rating of 9? | music_1 | select t0.gender, t0.artist_name, t0.country from artist as t0 join song as t1 on t0.artist_name = t1.artist_name join genre as t2 on t1.genre_is = t2.g_name where t2.rating = 9 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "music_1",
"sql": "select t0.gender, t0.artist_name, t0.country from artist as t0 join song as t1 on t0.artist_name = t1.artist_name join genre as t2 on t1.genre_is = t2.g_name where t2.rating = 9"
},
"style": "rule"
} | {
"index": 1287,
"split": "train"
} | |
Which are the first five customer IDs where the customer ID is either 996 or 256, ordered alphabetically by customer name? | insurance_fnol | select customer_id as c0 from customers where c0 = 996 or c0 = 256 order by customer_name asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_fnol",
"sql": "select customer_id as c0 from customers where c0 = 996 or c0 = 256 order by customer_name asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2714,
"split": "train"
} | |
What are the product IDs and corresponding order IDs for the bottom three products that are either linked to order item ID 14 or to the most frequently ordered item? Please list them sorted by product ID. | tracking_orders | select t0.product_id as c2, t1.order_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id, (select order_item_id as c1 from order_items group by c1 order by count(*) desc limit 1) as t0 where t1.order_item_id = 14 or t1.order_item_id = t0.c1 order by c2 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select t0.product_id as c2, t1.order_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id, (select order_item_id as c1 from order_items group by c1 order by count(*) desc limit 1) as t0 where t1.order_item_id = 14 or t1.order_it... | {
"index": 1640,
"split": "train"
} | |
For each user whose name contains "e" or "y", what is the smallest target user ID they trust, along with their own user ID? | epinions_1 | select min(t0.target_u_id), t1.u_id as c0 from trust as t0 join useracct as t1 on t0.source_u_id = t1.u_id where t1.name like '%e%' or t1.name like '%y%' 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": "epinions_1",
"sql": "select min(t0.target_u_id), t1.u_id as c0 from trust as t0 join useracct as t1 on t0.source_u_id = t1.u_id where t1.name like '%e%' or t1.name like '%y%' group by c0"
},
"style": "rule"
} | {
"index": 2969,
"split": "train"
} | |
What is the smallest and largest total sum of student IDs for students who enrolled between July 15, 2017, and December 4, 2017? | e_learning | select min(t0.c0), max(t0.c0) from (select sum(t1.student_id) as c0 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_enrolment between '2017-07-15 12:48:43' and '2017-12-04 12:16:10' group by t0.student_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select min(t0.c0), max(t0.c0) from (select sum(t1.student_id) as c0 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_enrolment between '2017-07-15 12:48:43' and '2017-12-04 12:16:10' group by t0.student... | {
"index": 3640,
"split": "train"
} | |
What is the position of hotel 421 in the list of hotels priced at or above 17,012.68, sorted from most expensive to least expensive? | cre_Theme_park | select t1.c2, t1.c5 as c0 from (select row_number() over (order by price_range desc) as c2, hotel_id as c5 from hotels where price_range >= 17012.682586009) as t1 where c0 = 421 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t1.c2, t1.c5 as c0 from (select row_number() over (order by price_range desc) as c2, hotel_id as c5 from hotels where price_range >= 17012.682586009) as t1 where c0 = 421"
},
"style": "rule"
} | {
"index": 3470,
"split": "train"
} | |
Find out which days of the week have 12 or fewer wind speed measurements recorded, and how many measurements there are for each of those days. | station_weather | select day_of_week as c0, count(wind_speed_mph) from weekly_weather group by c0 having count(wind_speed_mph) <= 12 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "station_weather",
"sql": "select day_of_week as c0, count(wind_speed_mph) from weekly_weather group by c0 having count(wind_speed_mph) <= 12"
},
"style": "rule"
} | {
"index": 369,
"split": "train"
} | |
Which five camera lenses with focal lengths between 19 and 75 millimeters have been used to take the most photos, and how many photos were taken with each? | mountain_photos | select count(t0.camera_lens_id), t1.id as c0 from photos as t0 join camera_lens as t1 on t0.camera_lens_id = t1.id where t1.focal_length_mm between 19.0 and 75.0 group by c0 order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "mountain_photos",
"sql": "select count(t0.camera_lens_id), t1.id as c0 from photos as t0 join camera_lens as t1 on t0.camera_lens_id = t1.id where t1.focal_length_mm between 19.0 and 75.0 group by c0 order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 201,
"split": "train"
} | |
Which station with a latitude of at least 37.798522 or 37.795392 has the fewest bikes available? | bike_1 | select t0.bikes_available, t0.station_id from status as t0 join station as t1 on t0.station_id = t1.id where t1.lat >= 37.798522 or t1.lat >= 37.795392 order by t1.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": "bike_1",
"sql": "select t0.bikes_available, t0.station_id from status as t0 join station as t1 on t0.station_id = t1.id where t1.lat >= 37.798522 or t1.lat >= 37.795392 order by t1.id asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 119,
"split": "train"
} | |
Can you list the names and IDs of the top five activities, sorted in reverse alphabetical order by activity name, where the activity ID is either 778 or between 770 and 780, and that have at least three faculty members participating? | activity_1 | select t0.activity_name as c0, t0.actid as c1 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.actid = 778 or t1.actid between 770 and 780 group by c1 having count(*) >= 3 order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "activity_1",
"sql": "select t0.activity_name as c0, t0.actid as c1 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.actid = 778 or t1.actid between 770 and 780 group by c1 having count(*) >= 3 order by c0 desc limit 5"
},
"style": "rule"
... | {
"index": 827,
"split": "train"
} | |
What are the grade point and letter grade details for students whose city code includes the letter "A"? | college_3 | select t0.gradepoint, t0.lettergrade from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade join student as t2 on t1.stuid = t2.stuid where t2.city_code like '%A%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_3",
"sql": "select t0.gradepoint, t0.lettergrade from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade join student as t2 on t1.stuid = t2.stuid where t2.city_code like '%A%'"
},
"style": "rule"
} | {
"index": 1199,
"split": "train"
} | |
Which organizations have services with details that contain "atis" or start with "Sat," and what are their details, parent organization IDs, organization IDs, and the total sum of their associated organization IDs? | local_govt_and_lot | select t0.organization_details, t0.parent_organization_id, t0.organization_id as c2, sum(t1.organization_id) from organizations as t0 join services as t1 on t0.organization_id = t1.organization_id where t1.service_details like '%atis%' or t1.service_details like 'Sat%' 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": "local_govt_and_lot",
"sql": "select t0.organization_details, t0.parent_organization_id, t0.organization_id as c2, sum(t1.organization_id) from organizations as t0 join services as t1 on t0.organization_id = t1.organization_id where t1.service_details like '%atis%' or t1.service_d... | {
"index": 662,
"split": "train"
} | |
What are the first five organization types associated with the organization that has an ID of 11, ordered alphabetically by organization type? | tracking_grants_for_research | select t0.organisation_type as c1, t1.organisation_id as c0 from organisation_types as t0 join organisations as t1 on t0.organisation_type = t1.organisation_type where c0 = 11 order by c1 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select t0.organisation_type as c1, t1.organisation_id as c0 from organisation_types as t0 join organisations as t1 on t0.organisation_type = t1.organisation_type where c0 = 11 order by c1 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 1073,
"split": "train"
} | |
Which Employer Organization IDs, staff details, and project IDs are associated with research outcomes that have the most common outcome description? | tracking_grants_for_research | select t0.employer_organisation_id, t0.staff_details, t3.project_id from research_staff as t0 join organisations as t1 on t0.employer_organisation_id = t1.organisation_id join projects as t2 on t1.organisation_id = t2.organisation_id join project_outcomes as t3 on t2.project_id = t3.project_id join research_outcomes as... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select t0.employer_organisation_id, t0.staff_details, t3.project_id from research_staff as t0 join organisations as t1 on t0.employer_organisation_id = t1.organisation_id join projects as t2 on t1.organisation_id = t2.organisation_id join pr... | {
"index": 816,
"split": "train"
} | |
What are the address, short name, and ID of buildings that have fewer than three apartments of type starting with "Stud" and with apartment ID 6? | apartment_rentals | select t0.building_address, t0.building_short_name, t0.building_id as c1 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.apt_type_code like 'Stud%' and t1.apt_id = 6 group by c1 having count(*) < 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.building_address, t0.building_short_name, t0.building_id as c1 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.apt_type_code like 'Stud%' and t1.apt_id = 6 group by c1 having count(*) < 3"
},... | {
"index": 2376,
"split": "train"
} | |
Can you show me the rank of camera lens number 7 when ordering all lenses by their average mountain ID (for mountains with IDs greater than 1), sorted from highest to lowest? | mountain_photos | select t1.c2, t1.c5 as c4 from (select row_number() over (order by t0.c0 desc) as c2, t0.c3 as c5 from (select t0.id as c3, avg(t1.mountain_id) as c0 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t1.mountain_id > 1 group by c3) as t0) 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": "mountain_photos",
"sql": "select t1.c2, t1.c5 as c4 from (select row_number() over (order by t0.c0 desc) as c2, t0.c3 as c5 from (select t0.id as c3, avg(t1.mountain_id) as c0 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t1.mountain_id > 1 group by ... | {
"index": 3492,
"split": "train"
} | |
Which five address pairs from the Addresses and Supplier_Addresses tables involve address ID 11, listed in order from highest to lowest address ID? | department_store | select t0.address_id, t1.address_id as c0 from addresses as t0 join supplier_addresses as t1 on t0.address_id = t1.address_id where c0 = 11 order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select t0.address_id, t1.address_id as c0 from addresses as t0 join supplier_addresses as t1 on t0.address_id = t1.address_id where c0 = 11 order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 580,
"split": "train"
} | |
When did the student with registration ID 8 and the highest student ID enroll in the course? | e_learning | select t0.date_of_enrolment, t0.student_id as c2 from student_course_enrolment as t0, (select max(student_id) as c1 from student_course_enrolment where registration_id = 8) as t1 where c2 = 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": "e_learning",
"sql": "select t0.date_of_enrolment, t0.student_id as c2 from student_course_enrolment as t0, (select max(student_id) as c1 from student_course_enrolment where registration_id = 8) as t1 where c2 = t1.c1"
},
"style": "rule"
} | {
"index": 3768,
"split": "train"
} | |
What are the three smallest counts of unique product type codes and unique product prices for product ID 14 supplied by supplier 1, when ordered by the number of different total amounts purchased? | department_store | select count(distinct (t0.product_type_code)), count(distinct (t0.product_price)) from products as t0 join product_suppliers as t1 on t0.product_id = t1.product_id where t1.product_id = 14 and t1.supplier_id = 1 order by count(distinct (t1.total_amount_purchased)) 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": "department_store",
"sql": "select count(distinct (t0.product_type_code)), count(distinct (t0.product_price)) from products as t0 join product_suppliers as t1 on t0.product_id = t1.product_id where t1.product_id = 14 and t1.supplier_id = 1 order by count(distinct (t1.total_amount_... | {
"index": 710,
"split": "train"
} | |
What is the average checking balance among accounts that have a balance of 7000? | small_bank_1 | select avg(balance) from checking where balance = 7000.0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "small_bank_1",
"sql": "select avg(balance) from checking where balance = 7000.0"
},
"style": "rule"
} | {
"index": 826,
"split": "train"
} | |
How much did the total number of customer complaints for product ID 118 change in percentage terms between February 10, 1973, and October 14, 2007? | customer_complaints | select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select sum(t1.customer_id) as c1 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.date_complaint_raised = '1973-02-10 22:55:56' group by t0.product_id) as t0, (select t0.product_id, sum(t1.customer_id) as 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": "customer_complaints",
"sql": "select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select sum(t1.customer_id) as c1 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.date_complaint_raised = '1973-02-10 22:55:56' group by t... | {
"index": 3826,
"split": "train"
} | |
Who are the users being followed by user 7 or user 5, and what are their partition IDs, emails, and user IDs? | twitter_1 | select t0.partitionid, t0.email from user_profiles as t0 join follows as t1 on t0.uid = t1.f2 where t1.f1 = 7 or t1.f1 = 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "twitter_1",
"sql": "select t0.partitionid, t0.email from user_profiles as t0 join follows as t1 on t0.uid = t1.f2 where t1.f1 = 7 or t1.f1 = 5"
},
"style": "rule"
} | {
"index": 686,
"split": "train"
} | |
Show the first names and IDs of guests with guest IDs 4 or 12, listing the top 5 guests who have booked the highest number of different apartments.
---? | apartment_rentals | select t0.guest_first_name, t0.guest_id as c1 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where c1 = 12 or c1 = 4 group by c1 order by count(distinct (t1.apt_id)) desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "apartment_rentals",
"sql": "select t0.guest_first_name, t0.guest_id as c1 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where c1 = 12 or c1 = 4 group by c1 order by count(distinct (t1.apt_id)) desc limit 5"
},
"style": "rule"
} | {
"index": 2092,
"split": "train"
} | |
For users with user IDs 1 or 4, what are their names and how many times do their user IDs appear in the user account table? | epinions_1 | select name as c0, count(u_id) from useracct where u_id = 4 or u_id = 1 group by c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select name as c0, count(u_id) from useracct where u_id = 4 or u_id = 1 group by c0"
},
"style": "rule"
} | {
"index": 1406,
"split": "train"
} | |
What are the five games with the lowest number of scores? | game_injury | select count(score) as c0 from game 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": "game_injury",
"sql": "select count(score) as c0 from game order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2465,
"split": "train"
} | |
What is the percentage change in the highest address ID less than 11 associated with customer addresses between the orders placed at 04:39:50 and 06:25:41 on March 23, 2018? | customers_and_addresses | select (max(t0.c1) / cast(max(t1.c1) as real) - 1) * 100 from (select t0.address_id as c1 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id where t2.order_date = '2018-03-23 06:25:41' and c1 < 11) as t0, (select t0.address... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_addresses",
"sql": "select (max(t0.c1) / cast(max(t1.c1) as real) - 1) * 100 from (select t0.address_id as c1 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id where t2... | {
"index": 3023,
"split": "train"
} | |
What are the descriptions and codes of document structures, along with the number of distinct access counts, for documents that have been accessed fewer than 2910 times? | document_management | select t0.document_structure_description, t0.document_structure_code as c1, count(distinct (t1.access_count)) from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code where t1.access_count < 2910 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": "document_management",
"sql": "select t0.document_structure_description, t0.document_structure_code as c1, count(distinct (t1.access_count)) from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code where t1.access_count < 2910 ... | {
"index": 1696,
"split": "train"
} | |
How many times has player with ID 10 been associated with a coach? | riding_club | select player_id as c0 from player_coach where c0 = 10 group by c0 order by count(player_id) desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "riding_club",
"sql": "select player_id as c0 from player_coach where c0 = 10 group by c0 order by count(player_id) desc limit 1"
},
"style": "rule"
} | {
"index": 1226,
"split": "train"
} | |
Which stadium has the fewest entries in the database, and how many home games does it have? | game_injury | select t0.home_games from stadium as t0, (select id as c1 from stadium group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.id = t0.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "game_injury",
"sql": "select t0.home_games from stadium as t0, (select id as c1 from stadium group by c1 order by count(*) asc nulls last limit 1) as t0 where t0.id = t0.c1"
},
"style": "rule"
} | {
"index": 2144,
"split": "train"
} | |
Is the dorm ID for student 1001 less than 117? | dorm_1 | select dormid < 117 from lives_in where stuid = 1001 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "dorm_1",
"sql": "select dormid < 117 from lives_in where stuid = 1001"
},
"style": "rule"
} | {
"index": 3338,
"split": "train"
} | |
What is the percentage change in the highest property ID for customer 16 on March 27, 2015, within property IDs 120 to 879? | local_govt_and_lot | select (t0.c1 / cast(t0.c1 as real) - 1) * 100 from (select max(t1.property_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00' and t1.property_id between 120 and 879 group by t0.customer_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_and_lot",
"sql": "select (t0.c1 / cast(t0.c1 as real) - 1) * 100 from (select max(t1.property_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00' and t1.prop... | {
"index": 3418,
"split": "train"
} | |
Show the name, member ID, and role of members who participated in performances held at the Verizon Center. | performance_attendance | select t0.name, t0.member_id, t0.role from member as t0 join member_attendance as t1 on t0.member_id = t1.member_id join performance as t2 on t1.performance_id = t2.performance_id where t2.location = 'Verizon Center' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "performance_attendance",
"sql": "select t0.name, t0.member_id, t0.role from member as t0 join member_attendance as t1 on t0.member_id = t1.member_id join performance as t2 on t1.performance_id = t2.performance_id where t2.location = 'Verizon Center'"
},
"style": "rule"
} | {
"index": 737,
"split": "train"
} | |
Which course and department names are associated with departments that have a budget of exactly 255,041.46 or at least 734,550.70? Among these, what is the first such course and department when sorted alphabetically by department name? | college_2 | select t0.course_id, t0.dept_name, t1.dept_name as c1 from course as t0 join department as t1 on t0.dept_name = t1.dept_name where t1.budget = 255041.46 or t1.budget >= 734550.7 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": "college_2",
"sql": "select t0.course_id, t0.dept_name, t1.dept_name as c1 from course as t0 join department as t1 on t0.dept_name = t1.dept_name where t1.budget = 255041.46 or t1.budget >= 734550.7 order by c1 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2576,
"split": "train"
} | |
What are the weeks on top, issue date, artist ID, song, and volume ID for both all volume entries and those linked to the artist Triumfall? | music_4 | select anon_1.c2, anon_1.c0, anon_1.c4, anon_1.c3, anon_1.c1 from (select weeks_on_top as c2, issue_date as c0, artist_id as c4, song as c3, volume_id as c1 from volume union select t0.weeks_on_top as c2, t0.issue_date as c0, t0.artist_id as c4, t0.song as c3, t0.volume_id as c1 from volume as t0 join artist as t1 on 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": "music_4",
"sql": "select anon_1.c2, anon_1.c0, anon_1.c4, anon_1.c3, anon_1.c1 from (select weeks_on_top as c2, issue_date as c0, artist_id as c4, song as c3, volume_id as c1 from volume union select t0.weeks_on_top as c2, t0.issue_date as c0, t0.artist_id as c4, t0.song as c3, t... | {
"index": 2396,
"split": "train"
} | |
For each staff member whose phone number ends with "(383)553-1035x20399," what is the smallest product ID associated with their complaints, and what are their email address and staff ID? Please list the results in order of staff ID. | customer_complaints | select min(t0.product_id), t1.email_address, t1.staff_id as c1 from complaints as t0 join staff as t1 on t0.staff_id = t1.staff_id where t1.phone_number like '%(383)553-1035x20399' group by c1 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": "customer_complaints",
"sql": "select min(t0.product_id), t1.email_address, t1.staff_id as c1 from complaints as t0 join staff as t1 on t0.staff_id = t1.staff_id where t1.phone_number like '%(383)553-1035x20399' group by c1 order by c1 asc nulls last"
},
"style": "rule"
} | {
"index": 1582,
"split": "train"
} | |
Show the name, artwork ID, type, and nomination festival ID for artworks nominated at the festival with the smallest audience attendance. | entertainment_awards | select t0.name, t0.artwork_id, t0.type, t1.festival_id from artwork as t0 join nomination as t1 on t0.artwork_id = t1.artwork_id join festival_detail as t2 on t1.festival_id = t2.festival_id, (select min(num_of_audience) as c1 from festival_detail) as t0 where t2.num_of_audience = t0.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "entertainment_awards",
"sql": "select t0.name, t0.artwork_id, t0.type, t1.festival_id from artwork as t0 join nomination as t1 on t0.artwork_id = t1.artwork_id join festival_detail as t2 on t1.festival_id = t2.festival_id, (select min(num_of_audience) as c1 from festival_detail) ... | {
"index": 253,
"split": "train"
} | |
How many unique regions have codes starting with "AF" or exactly "AL," and among those, which region has the fewest entries? | storm_record | select count(distinct (region_code)) from region where region_code like 'AF%' or region_code = 'AL' order by count(*) 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": "storm_record",
"sql": "select count(distinct (region_code)) from region where region_code like 'AF%' or region_code = 'AL' order by count(*) asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 1572,
"split": "train"
} | |
What is the release date of the song(s) that have the highest rating among all songs with a file ID of 5 or more? | music_1 | select t0.releasedate, t0.rating as c3 from song as t0, (select max(rating) as c1 from song where f_id >= 5) as t1 where c3 = t1.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "music_1",
"sql": "select t0.releasedate, t0.rating as c3 from song as t0, (select max(rating) as c1 from song where f_id >= 5) as t1 where c3 = t1.c1"
},
"style": "rule"
} | {
"index": 3830,
"split": "train"
} | |
Show the rank, name, and the year they joined the pilot program for all pilots, including those who have flown aircraft with a fleet series that ends with '6'. | pilot_record | select anon_1.c0, anon_1.c1, anon_1.c2 from (select rank as c0, pilot_name as c1, join_year as c2 from pilot union select t0.rank as c0, t0.pilot_name as c1, t0.join_year as c2 from pilot as t0 join pilot_record as t1 on t0.pilot_id = t1.pilot_id join aircraft as t2 on t1.aircraft_id = t2.aircraft_id where t2.fleet_ser... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "pilot_record",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select rank as c0, pilot_name as c1, join_year as c2 from pilot union select t0.rank as c0, t0.pilot_name as c1, t0.join_year as c2 from pilot as t0 join pilot_record as t1 on t0.pilot_id = t1.pilot_id join aircr... | {
"index": 2868,
"split": "train"
} | |
Looking at the furniture items produced by manufacturers who opened between 1980 and 2000, or specifically in 1991, what are the top five most expensive pieces? Please include each furniture's ID, the number of components it has, and its price in dollars, sorted from the most expensive to the least. | manufacturer | select t0.num_of_component, t0.furniture_id, t1.furniture_id, t1.price_in_dollar as c0 from furniture as t0 join furniture_manufacte as t1 on t0.furniture_id = t1.furniture_id join manufacturer as t2 on t1.manufacturer_id = t2.manufacturer_id where t2.open_year between 1980.0 and 2000.0 or t2.open_year = 1991.0 order b... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t0.num_of_component, t0.furniture_id, t1.furniture_id, t1.price_in_dollar as c0 from furniture as t0 join furniture_manufacte as t1 on t0.furniture_id = t1.furniture_id join manufacturer as t2 on t1.manufacturer_id = t2.manufacturer_id where t2.open_... | {
"index": 2075,
"split": "train"
} | |
Which Party and Region IDs belong to parties whose region label starts with "Parlopho" and also have the region label exactly equal to "Parlophone"? | party_people | select anon_1.c0, anon_1.c1 from (select t0.party_id as c0, t0.region_id as c1 from party as t0 join region as t1 on t0.region_id = t1.region_id where t1.label like 'Parlopho%' intersect select t0.party_id as c0, t0.region_id as c1 from party as t0 join region as t1 on t0.region_id = t1.region_id where t1.label = 'Parl... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_people",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.party_id as c0, t0.region_id as c1 from party as t0 join region as t1 on t0.region_id = t1.region_id where t1.label like 'Parlopho%' intersect select t0.party_id as c0, t0.region_id as c1 from party as t0 join reg... | {
"index": 1292,
"split": "train"
} | |
Which three musicals with the lowest IDs have total years summed to at least 1986? | musical | select sum(year) from musical group by musical_id having sum(year) >= 1986 order by musical_id asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "musical",
"sql": "select sum(year) from musical group by musical_id having sum(year) >= 1986 order by musical_id asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 1227,
"split": "train"
} | |
What are the job IDs, job titles, and maximum salaries, along with the salaries and employee IDs of employees who work in departments whose names start with "Cont" or contain "ing"? | hr_1 | select t0.job_id, t0.job_title, t0.max_salary, t1.salary, t1.employee_id from jobs as t0 join employees as t1 on t0.job_id = t1.job_id join departments as t2 on t1.department_id = t2.department_id where t2.department_name like 'Cont%' or t2.department_name like '%ing%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "hr_1",
"sql": "select t0.job_id, t0.job_title, t0.max_salary, t1.salary, t1.employee_id from jobs as t0 join employees as t1 on t0.job_id = t1.job_id join departments as t2 on t1.department_id = t2.department_id where t2.department_name like 'Cont%' or t2.department_name like '%i... | {
"index": 157,
"split": "train"
} | |
Which flights, operated by aircraft named either ending with "Piper Archer III" or starting with "Boeing 7," have their arrival dates and destinations? | flight_1 | select t0.arrival_date, t0.destination from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.name like '%Piper Archer III' or t1.name like 'Boeing 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": "flight_1",
"sql": "select t0.arrival_date, t0.destination from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.name like '%Piper Archer III' or t1.name like 'Boeing 7%'"
},
"style": "rule"
} | {
"index": 42,
"split": "train"
} | |
What is the average low temperature at station 2 on weeks when the wind speed is at least 8 miles per hour? | station_weather | select t0.c2 from (select avg(t1.low_temperature) as c2 from station as t0 join weekly_weather as t1 on t0.id = t1.station_id where t0.id = 2 and t1.wind_speed_mph >= 8 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": "station_weather",
"sql": "select t0.c2 from (select avg(t1.low_temperature) as c2 from station as t0 join weekly_weather as t1 on t0.id = t1.station_id where t0.id = 2 and t1.wind_speed_mph >= 8 group by t0.id) as t0"
},
"style": "rule"
} | {
"index": 3397,
"split": "train"
} | |
For each main industry, how many different sales amounts in billions are associated with companies? | gas_company | select main_industry as c0, count(distinct (sales_billion)) from company 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": "gas_company",
"sql": "select main_industry as c0, count(distinct (sales_billion)) from company group by c0"
},
"style": "rule"
} | {
"index": 709,
"split": "train"
} | |
What was the most recent date and its corresponding day number in the calendar on or after January 1st, 1995 at 3:52 AM? | cre_Doc_Tracking_DB | select t0.calendar_date, t0.day_number as c2 from ref_calendar as t0, (select max(day_number) as c0 from ref_calendar where calendar_date >= '1995-01-01 03:52:11') as t1 where c2 = 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 c2 from ref_calendar as t0, (select max(day_number) as c0 from ref_calendar where calendar_date >= '1995-01-01 03:52:11') as t1 where c2 = t1.c0"
},
"style": "rule"
} | {
"index": 3750,
"split": "train"
} | |
Who are the top 10 individuals, by most recent average friendship year, among the friends of the person who has the fewest total different years of friendship? | network_2 | select t0.age, t0.name as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend, (select name as c1 from personfriend group by c1 order by count(distinct (year)) asc nulls last limit 1) as t0 where t1.name = t0.c1 group by c0 order by avg(t1.year) 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": "network_2",
"sql": "select t0.age, t0.name as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend, (select name as c1 from personfriend group by c1 order by count(distinct (year)) asc nulls last limit 1) as t0 where t1.name = t0.c1 group by c0 order by avg(t1.year... | {
"index": 1154,
"split": "train"
} | |
What is the difference between the smallest tweet user ID for user 4 and the number 3? | twitter_1 | select t0.c0 - 3 from (select min(t1.uid) as c0 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 4 group by t0.uid) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "twitter_1",
"sql": "select t0.c0 - 3 from (select min(t1.uid) as c0 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 4 group by t0.uid) as t0"
},
"style": "rule"
} | {
"index": 3261,
"split": "train"
} | |
Return the list of storm IDs along with the highest number of affected cities in their affected regions, considering only those regions that are either not in regions with code 'AG' or are region 12. | storm_record | select storm_id as c0, max(number_city_affected) from affected_region where (not region_id in (select region_id as c1 from region where region_code = 'AG')) or region_id = 12 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": "storm_record",
"sql": "select storm_id as c0, max(number_city_affected) from affected_region where (not region_id in (select region_id as c1 from region where region_code = 'AG')) or region_id = 12 group by c0"
},
"style": "rule"
} | {
"index": 281,
"split": "train"
} | |
Is the booking end date for the rental with ID 15 later than the booking end date for the rental with ID 5? | products_for_hire | select t1.c1 > t0.c1 from (select booking_end_date as c1 from bookings where booking_id = 15) as t1, (select booking_end_date as c1 from bookings where booking_id = 5) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_for_hire",
"sql": "select t1.c1 > t0.c1 from (select booking_end_date as c1 from bookings where booking_id = 15) as t1, (select booking_end_date as c1 from bookings where booking_id = 5) as t0"
},
"style": "rule"
} | {
"index": 3927,
"split": "train"
} | |
What are the latest revision date and catalog ID for catalogs with IDs between 2 and 8 and with a level name that includes "atego"? | product_catalog | select t0.date_of_latest_revision, t0.catalog_id from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_id between 2 and 8 and t1.catalog_level_name like '%atego%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "product_catalog",
"sql": "select t0.date_of_latest_revision, t0.catalog_id from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id where t1.catalog_id between 2 and 8 and t1.catalog_level_name like '%atego%'"
},
"style": "rule"
} | {
"index": 474,
"split": "train"
} | |
How many days passed between when a document was first located at location 'n' and when it was moved out of that location? | cre_Doc_Tracking_DB | select julianday(t1.c0) - julianday(t0.c2) from (select date_in_location_from as c0 from document_locations where location_code = 'n' and location_code = 'n') as t1, (select date_in_locaton_to as c2 from document_locations) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Tracking_DB",
"sql": "select julianday(t1.c0) - julianday(t0.c2) from (select date_in_location_from as c0 from document_locations where location_code = 'n' and location_code = 'n') as t1, (select date_in_locaton_to as c2 from document_locations) as t0"
},
"style": "ru... | {
"index": 3680,
"split": "train"
} | |
How many days passed between the date when policy 301 was opened and the date it was closed? | insurance_fnol | select julianday(t1.c0) - julianday(t0.c1) from (select date_closed as c0 from customers_policies where policy_id = 301 and policy_id = 301) as t1, (select date_opened as c1 from customers_policies) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_fnol",
"sql": "select julianday(t1.c0) - julianday(t0.c1) from (select date_closed as c0 from customers_policies where policy_id = 301 and policy_id = 301) as t1, (select date_opened as c1 from customers_policies) as t0"
},
"style": "rule"
} | {
"index": 3721,
"split": "train"
} | |
What are the details of the first three purchases, including branch ID, member ID, total pounds purchased, and the members' hometowns, for members who registered in 2016, sorted by hometown in reverse alphabetical order? | shop_membership | select t0.branch_id, t0.member_id, t0.total_pounds, t1.hometown as c3 from purchase as t0 join member as t1 on t0.member_id = t1.member_id join membership_register_branch as t2 on t1.member_id = t2.member_id join branch as t3 on t2.branch_id = t3.branch_id where t2.register_year like '2016%' order by c3 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": "shop_membership",
"sql": "select t0.branch_id, t0.member_id, t0.total_pounds, t1.hometown as c3 from purchase as t0 join member as t1 on t0.member_id = t1.member_id join membership_register_branch as t2 on t1.member_id = t2.member_id join branch as t3 on t2.branch_id = t3.branch_... | {
"index": 2810,
"split": "train"
} | |
Find the age, class, rank, name, and ship ID of all captains, excluding those who command ships with names containing "halarop."
---? | ship_1 | select anon_1.c4, anon_1.c3, anon_1.c2, anon_1.c1, anon_1.c0 from (select age as c4, class as c3, rank as c2, name as c1, ship_id as c0 from captain except select t0.age as c4, t0.class as c3, t0.rank as c2, t0.name as c1, t0.ship_id as c0 from captain as t0 join ship as t1 on t0.ship_id = t1.ship_id where t1.name like... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "ship_1",
"sql": "select anon_1.c4, anon_1.c3, anon_1.c2, anon_1.c1, anon_1.c0 from (select age as c4, class as c3, rank as c2, name as c1, ship_id as c0 from captain except select t0.age as c4, t0.class as c3, t0.rank as c2, t0.name as c1, t0.ship_id as c0 from captain as t0 join... | {
"index": 1132,
"split": "train"
} | |
What are the three highest activity IDs recorded in the Faculty Participates In table? | activity_1 | select max(actid) as c0 from faculty_participates_in 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": "activity_1",
"sql": "select max(actid) as c0 from faculty_participates_in order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 2930,
"split": "train"
} | |
What is the numerical difference between the user IDs of the users who posted tweets with IDs 7 and 5? | twitter_1 | select t1.c0 - t0.c0 from (select uid as c0 from tweets where id = 7) as t1, (select uid as c0 from tweets where id = 5) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "twitter_1",
"sql": "select t1.c0 - t0.c0 from (select uid as c0 from tweets where id = 7) as t1, (select uid as c0 from tweets where id = 5) as t0"
},
"style": "rule"
} | {
"index": 3632,
"split": "train"
} | |
Which staff members' IDs are associated with the most frequently occurring role that ends with "Leader" in their role description? | tracking_grants_for_research | select t0.staff_id from project_staff as t0 join staff_roles as t1 on t0.role_code = t1.role_code, (select role_description as c1 from staff_roles where c1 like '%Leader' group by c1 order by count(*) desc limit 1) as t0 where t1.role_description = t0.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select t0.staff_id from project_staff as t0 join staff_roles as t1 on t0.role_code = t1.role_code, (select role_description as c1 from staff_roles where c1 like '%Leader' group by c1 order by count(*) desc limit 1) as t0 where t1.role_descri... | {
"index": 1207,
"split": "train"
} | |
Which are the five browsers with the lowest market share and their IDs where the browser is compatible with browser ID 3, but not with any Web Client Accelerators whose client starts with "user/Google se," sorted by the number of such compatibility records? | browser_web | select t0.market_share, t0.id as c2 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id where (not t1.accelerator_id in (select web_client_accelerator.id as c1 from web_client_accelerator where web_client_accelerator.client like 'user/Google se%')) and t1.browser_id = 3 group by c2 ord... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "browser_web",
"sql": "select t0.market_share, t0.id as c2 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id where (not t1.accelerator_id in (select web_client_accelerator.id as c1 from web_client_accelerator where web_client_accelerator.client ... | {
"index": 260,
"split": "train"
} | |
Show the shipping charges and order statuses for customer orders that are not linked to customers who responded to mailshot campaigns with customer IDs of 1 or higher. | customers_campaigns_ecommerce | select anon_1.c0, anon_1.c1 from (select order_shipping_charges as c0, order_status_code as c1 from customer_orders except select t0.order_shipping_charges as c0, t0.order_status_code as c1 from customer_orders as t0 join customers as t1 on t0.customer_id = t1.customer_id join mailshot_customers as t2 on t1.customer_id... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c1 from (select order_shipping_charges as c0, order_status_code as c1 from customer_orders except select t0.order_shipping_charges as c0, t0.order_status_code as c1 from customer_orders as t0 join customers as t1 on... | {
"index": 2401,
"split": "train"
} | |
What are the unique combinations of Player Award Player ID, year, and first name for players whose last name has the highest number of different weight entries or ends with the letter "w"? | baseball_1 | select distinct t0.player_id, t0.year, t1.name_first from player_award as t0 join player as t1 on t0.player_id = t1.player_id, (select name_last as c1 from player group by c1 order by count(distinct (weight)) desc limit 1) as t0 where t1.name_last = t0.c1 or t1.name_last like '%w' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select distinct t0.player_id, t0.year, t1.name_first from player_award as t0 join player as t1 on t0.player_id = t1.player_id, (select name_last as c1 from player group by c1 order by count(distinct (weight)) desc limit 1) as t0 where t1.name_last = t0.c1 or ... | {
"index": 2136,
"split": "train"
} | |
What are the average maintenance contract ID, the total number of assets, company name, and company ID for third-party companies whose company type includes "tractor" and that supply fewer than 5 assets? | assets_maintenance | select avg(t0.maintenance_contract_id), count(*) as c2, t1.company_name, t1.company_id as c3 from assets as t0 join third_party_companies as t1 on t0.supplier_company_id = t1.company_id where t1.company_type like '%tractor' group by c3 having c2 < 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": "assets_maintenance",
"sql": "select avg(t0.maintenance_contract_id), count(*) as c2, t1.company_name, t1.company_id as c3 from assets as t0 join third_party_companies as t1 on t0.supplier_company_id = t1.company_id where t1.company_type like '%tractor' group by c3 having c2 < 5"
... | {
"index": 2435,
"split": "train"
} | |
Which restaurant and type pairs are listed in the "Type Of Restaurant" table but have not been visited by any male students? | restaurant_1 | select anon_1.c0, anon_1.c1 from (select resid as c0, restypeid as c1 from type_of_restaurant except select t0.resid as c0, t0.restypeid as c1 from type_of_restaurant as t0 join restaurant as t1 on t0.resid = t1.resid join visits_restaurant as t2 on t1.resid = t2.resid join student as t3 on t2.stuid = t3.stuid where t3... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c1 from (select resid as c0, restypeid as c1 from type_of_restaurant except select t0.resid as c0, t0.restypeid as c1 from type_of_restaurant as t0 join restaurant as t1 on t0.resid = t1.resid join visits_restaurant as t2 on t1.resi... | {
"index": 396,
"split": "train"
} | |
Can you list the genders of students living in dorms who are either not registered in the student database or have student ID 1009, showing up to 10 results ordered alphabetically by gender? | dorm_1 | select t0.gender as c0 from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid where (not t1.stuid in (select student.stuid as c1 from student)) or t1.stuid = 1009 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": "dorm_1",
"sql": "select t0.gender as c0 from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid where (not t1.stuid in (select student.stuid as c1 from student)) or t1.stuid = 1009 order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 1146,
"split": "train"
} | |
How much more has customer #5 spent on lessons than the customer with the lowest total lesson cost among those whose cell phone number begins with "(780)719-4206x033"? | driving_school | select t2.c0 - t0.c2 from (select min(t1.c2) as c0 from (select sum(t1.price) as c2 from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t0.cell_mobile_phone_number like '(780)719-4206x033%' group by t0.customer_id) as t1) as t2, (select t0.customer_id, sum(t1.price) as c2 from customers as ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select t2.c0 - t0.c2 from (select min(t1.c2) as c0 from (select sum(t1.price) as c2 from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t0.cell_mobile_phone_number like '(780)719-4206x033%' group by t0.customer_id) as t1) as t... | {
"index": 3190,
"split": "train"
} | |
How many wrestlers are listed in the database? | wrestler | select count(*) from wrestler | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "wrestler",
"sql": "select count(*) from wrestler"
},
"style": "rule"
} | {
"index": 387,
"split": "train"
} | |
Does the valid from date for the card with ID 12 come after the valid from date for the card with ID 7? | customers_card_transactions | select t1.c2 > t0.c2 from (select date_valid_from as c2 from customers_cards where card_id = 12) as t1, (select date_valid_from as c2 from customers_cards where card_id = 7) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select t1.c2 > t0.c2 from (select date_valid_from as c2 from customers_cards where card_id = 12) as t1, (select date_valid_from as c2 from customers_cards where card_id = 7) as t0"
},
"style": "rule"
} | {
"index": 3842,
"split": "train"
} | |
Who are the employees involved in handling the document that has the fewest circulation records? Please provide their names, role codes, employee IDs, and also include the employee IDs associated with their circulation activities. | cre_Doc_Control_Systems | select t0.employee_name, t0.role_code, t0.employee_id, t1.employee_id from employees as t0 join circulation_history as t1 on t0.employee_id = t1.employee_id, (select document_id as c0 from circulation_history group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.document_id = t0.c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Control_Systems",
"sql": "select t0.employee_name, t0.role_code, t0.employee_id, t1.employee_id from employees as t0 join circulation_history as t1 on t0.employee_id = t1.employee_id, (select document_id as c0 from circulation_history group by c0 order by count(*) asc nul... | {
"index": 2929,
"split": "train"
} | |
What is the color associated with the highest number of unique mountain names in the photos, when listed starting from the color that comes last alphabetically? | mountain_photos | select color as c1, count(distinct (name)) from photos group by c1 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": "mountain_photos",
"sql": "select color as c1, count(distinct (name)) from photos group by c1 order by c1 desc limit 1"
},
"style": "rule"
} | {
"index": 1835,
"split": "train"
} | |
What are the titles, gross revenues in dollars, and directors of films, along with their market IDs, for films that are either estimated in the market with ID 1 or have no market estimation records at all? | film_rank | select t0.title, t0.gross_in_dollar, t0.director, t1.market_id as c3 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id join market as t2 on t1.market_id = t2.market_id where t2.market_id = 1 or (not t2.market_id in (select c3 as c3 from film_market_estimation)) | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "film_rank",
"sql": "select t0.title, t0.gross_in_dollar, t0.director, t1.market_id as c3 from film as t0 join film_market_estimation as t1 on t0.film_id = t1.film_id join market as t2 on t1.market_id = t2.market_id where t2.market_id = 1 or (not t2.market_id in (select c3 as c3 f... | {
"index": 913,
"split": "train"
} | |
Which product names have a product ID greater than 5 or greater than 2? | products_for_hire | select t0.product_name from products_for_hire as t0 join view_product_availability as t1 on t0.product_id = t1.product_id where t1.product_id > 5 or t1.product_id > 2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_for_hire",
"sql": "select t0.product_name from products_for_hire as t0 join view_product_availability as t1 on t0.product_id = t1.product_id where t1.product_id > 5 or t1.product_id > 2"
},
"style": "rule"
} | {
"index": 2951,
"split": "train"
} | |
Which are the top 10 buildings associated with departments offering courses that end with 'ics', listed in reverse alphabetical order? | college_2 | select t0.building as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.title like '%ics' 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": "college_2",
"sql": "select t0.building as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.title like '%ics' order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 2361,
"split": "train"
} | |
Can you tell me the author IDs, first names, and their authorship order for papers with the IDs 206 or 201? | icfp_1 | select t0.authid, t0.fname, t1.authorder from authors as t0 join authorship as t1 on t0.authid = t1.authid join papers as t2 on t1.paperid = t2.paperid where t2.paperid = 206 or t2.paperid = 201 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t0.authid, t0.fname, t1.authorder from authors as t0 join authorship as t1 on t0.authid = t1.authid join papers as t2 on t1.paperid = t2.paperid where t2.paperid = 206 or t2.paperid = 201"
},
"style": "rule"
} | {
"index": 208,
"split": "train"
} | |
How many days passed between the date staff member 15 was assigned to a department and the date their assignment ended? | department_store | select julianday(t1.c2) - julianday(t0.c0) from (select date_assigned_from as c2 from staff_department_assignments where staff_id = 15 and staff_id = 15) as t1, (select date_assigned_to as c0 from staff_department_assignments) 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 julianday(t1.c2) - julianday(t0.c0) from (select date_assigned_from as c2 from staff_department_assignments where staff_id = 15 and staff_id = 15) as t1, (select date_assigned_to as c0 from staff_department_assignments) as t0"
},
"style": "ru... | {
"index": 3701,
"split": "train"
} | |
Who is the employee with the highest-ranking role code among those who handled document number 10, listed in reverse alphabetical order by their name? | cre_Doc_Control_Systems | select t0.role_code from employees as t0 join circulation_history as t1 on t0.employee_id = t1.employee_id where t1.document_id = 10 order by t0.employee_name 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": "cre_Doc_Control_Systems",
"sql": "select t0.role_code from employees as t0 join circulation_history as t1 on t0.employee_id = t1.employee_id where t1.document_id = 10 order by t0.employee_name desc limit 1"
},
"style": "rule"
} | {
"index": 2380,
"split": "train"
} | |
What is the district, address ID, and average customer address ID for the addresses associated with the customer who has the email BRENT.HARKINS@sakilacustomer.org? | sakila_1 | select t0.district, t0.address_id as c1, avg(t1.address_id) from address as t0 join customer as t1 on t0.address_id = t1.address_id where t1.email = 'BRENT.HARKINS@sakilacustomer.org' 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": "sakila_1",
"sql": "select t0.district, t0.address_id as c1, avg(t1.address_id) from address as t0 join customer as t1 on t0.address_id = t1.address_id where t1.email = 'BRENT.HARKINS@sakilacustomer.org' group by c1"
},
"style": "rule"
} | {
"index": 360,
"split": "train"
} | |
Which are the descriptions of the top three document types associated with documents that received responses on October 4, 1976, or before January 19, 1990, listed in reverse alphabetical order? | tracking_grants_for_research | select t0.document_description as c0 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.response_received_date = '1976-10-04 22:13:27' or t1.response_received_date < '1990-01-19 19:57:14' order by c0 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select t0.document_description as c0 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.response_received_date = '1976-10-04 22:13:27' or t1.response_received_date < '1990-01-19 19:57:14'... | {
"index": 2070,
"split": "train"
} | |
For each stadium with a capacity percentage of 95.8% or less, what is the stadium's name, the number of unique injury records, and the smallest number of home games played? | game_injury | select name as c2, count(distinct (id)), min(home_games) from stadium where capacity_percentage <= 95.8 group by c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "game_injury",
"sql": "select name as c2, count(distinct (id)), min(home_games) from stadium where capacity_percentage <= 95.8 group by c2"
},
"style": "rule"
} | {
"index": 123,
"split": "train"
} | |
Which are the first 10 banks located in cities that start with "S," including their names, cities, and the number of customers they have, sorted alphabetically by bank name? | loan_1 | select bname as c0, city as c1, no_of_customers from bank where c1 like 'S%' 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": "loan_1",
"sql": "select bname as c0, city as c1, no_of_customers from bank where c1 like 'S%' order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 2571,
"split": "train"
} | |
How much smaller is customer 15's average customer ID compared to the highest average customer ID among customers whose first names contain "civa"? | customers_and_invoices | select t2.c2 - t0.c0 from (select max(t1.c0) as c2 from (select avg(t1.customer_id) as c0 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t0.customer_first_name like '%civa%' group by t0.customer_id) as t1) as t2, (select t0.customer_id, avg(t1.customer_id) as c0 from customers as t0 joi... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select t2.c2 - t0.c0 from (select max(t1.c0) as c2 from (select avg(t1.customer_id) as c0 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t0.customer_first_name like '%civa%' group by t0.customer_id) as t1) as t2, (... | {
"index": 3166,
"split": "train"
} | |
Which customers have address history entries, including the dates they were at those addresses, for orders that contained products with names ending in "pple"? Please include their customer IDs, the address validity periods, the order IDs, and the order status codes. | customers_and_products_contacts | select t0.customer_id, t0.date_from, t0.date_to, t2.order_id, t2.order_status_code from customer_address_history as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id join order_items as t3 on t2.order_id = t3.order_id join products as t4 on t3.produ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.customer_id, t0.date_from, t0.date_to, t2.order_id, t2.order_status_code from customer_address_history as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id j... | {
"index": 2755,
"split": "train"
} | |
Who are the top 5 wrestlers with the most eliminations they performed during matches starting with the time '10:4', excluding any eliminations involving wrestler 6? For each, how many opponents did they eliminate, and how many different times did these eliminations occur? | wrestler | select count(eliminated_by) as c0, count(distinct (time)) from elimination where time like '10:4%' and (not wrestler_id in (select wrestler_id as c1 from wrestler where wrestler_id = 6)) order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "wrestler",
"sql": "select count(eliminated_by) as c0, count(distinct (time)) from elimination where time like '10:4%' and (not wrestler_id in (select wrestler_id as c1 from wrestler where wrestler_id = 6)) order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 2989,
"split": "train"
} | |
What is the difference between the year Bob first became friends and the earliest year of any friendship started at or after year 6? | network_2 | select t2.c3 - t0.c1 from (select min(year) as c3 from personfriend where year >= 6) as t2, (select year as c1 from personfriend where name = 'Bob') as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "network_2",
"sql": "select t2.c3 - t0.c1 from (select min(year) as c3 from personfriend where year >= 6) as t2, (select year as c1 from personfriend where name = 'Bob') as t0"
},
"style": "rule"
} | {
"index": 3197,
"split": "train"
} | |
How many unique Institution IDs are associated with each Institution ID for the least common protein name in the database? | protein_institute | select t0.institution_id as c1, count(distinct (t0.institution_id)) from protein as t0, (select protein_name as c2 from protein group by c2 order by count(*) asc nulls last limit 1) as t0 where t0.protein_name = t0.c2 group by c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "protein_institute",
"sql": "select t0.institution_id as c1, count(distinct (t0.institution_id)) from protein as t0, (select protein_name as c2 from protein group by c2 order by count(*) asc nulls last limit 1) as t0 where t0.protein_name = t0.c2 group by c1"
},
"style": "rule... | {
"index": 1643,
"split": "train"
} | |
What are the population and county name, along with the delegate and district, for elections involving parties from 1998 to 2002 or before 2006? | election | select t0.population, t0.county_name, t1.delegate, t1.district from county as t0 join election as t1 on t0.county_id = t1.district join party as t2 on t1.party = t2.party_id where t2.year between 1998.0 and 2002.0 or t2.year < 2006.0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "election",
"sql": "select t0.population, t0.county_name, t1.delegate, t1.district from county as t0 join election as t1 on t0.county_id = t1.district join party as t2 on t1.party = t2.party_id where t2.year between 1998.0 and 2002.0 or t2.year < 2006.0"
},
"style": "rule"
} | {
"index": 819,
"split": "train"
} | |
What are the product names, product IDs, and the highest staff ID associated with products that have an ID greater than 118, sorted by their category code with nulls listed last? | customer_complaints | select t0.product_name, t0.product_id as c2, max(t1.staff_id) from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.product_id > 118 group by c2 order by t0.product_category_code 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": "customer_complaints",
"sql": "select t0.product_name, t0.product_id as c2, max(t1.staff_id) from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.product_id > 118 group by c2 order by t0.product_category_code asc nulls last"
},
"style": "rule"
} | {
"index": 699,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.