question stringlengths 1 606 | db_id stringclasses 139
values | external_knowledge stringclasses 1
value | sql stringlengths 19 1.35k | data_source stringclasses 1
value | prompt listlengths 2 2 | ability stringclasses 1
value | reward_model dict | extra_info dict |
|---|---|---|---|---|---|---|---|---|
Which characteristics with exactly two associated product characteristics have characteristic IDs less than or equal to 4, and what are their details, type codes, and IDs? | products_gen_characteristics | select t0.other_characteristic_details, t0.characteristic_type_code, t0.characteristic_id as c2 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.characteristic_id <= 4 group by c2 having count(*) = 2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_gen_characteristics",
"sql": "select t0.other_characteristic_details, t0.characteristic_type_code, t0.characteristic_id as c2 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.characteristic_id <= 4 grou... | {
"index": 1689,
"split": "train"
} | |
What is the percentage increase or decrease in the highest number of unique documents associated with any document status on December 25, 2014, compared to April 21, 2008? | cre_Doc_Control_Systems | select (max(t0.c2) / cast(max(t1.c2) as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c2 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t1.receipt_date = '2014-12-25 17:22:44' group by t0.document_status_code) as t0, (select t0.document... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Control_Systems",
"sql": "select (max(t0.c2) / cast(max(t1.c2) as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c2 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t1.receipt_date = '2014-12... | {
"index": 3008,
"split": "train"
} | |
Which genres have a maximum song rating, considering only genres that are either not associated with any song or have names starting with "blu," and what are those maximum ratings along with the genre names? | music_1 | select max(t0.rating), t1.g_name as c1 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where (not c1 in (select t0.genre_is as c2 from song)) or c1 like 'blu%' 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": "music_1",
"sql": "select max(t0.rating), t1.g_name as c1 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where (not c1 in (select t0.genre_is as c2 from song)) or c1 like 'blu%' group by c1"
},
"style": "rule"
} | {
"index": 591,
"split": "train"
} | |
What are the descriptions of up to five colors associated with products whose names start with "c", when listed in alphabetical order? | products_gen_characteristics | select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.product_name like 'c%' 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": "products_gen_characteristics",
"sql": "select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.product_name like 'c%' order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2586,
"split": "train"
} | |
Was the percentage change in the complaint-related measure for product 118 on August 6, 1977, greater than the product’s own average on that day? | customer_complaints | select abs((t2.c4 / cast(t2.c4 as real) - 1) * 100) > t1.c1 from (select avg(t1.product_id) as c4 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.date_complaint_raised = '1977-08-06 00:31:19' group by t0.product_id) as t2, (select abs((sum(t0.c4) / cast(sum(t0... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select abs((t2.c4 / cast(t2.c4 as real) - 1) * 100) > t1.c1 from (select avg(t1.product_id) as c4 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.date_complaint_raised = '1977-08-06 00:31:19... | {
"index": 3964,
"split": "train"
} | |
Among the medicines with ID 3, which FDA approval status is the rarest, meaning the one associated with the fewest such medicines? | medicine_enzyme_interaction | select t0.c0 as c1, count(distinct (t0.c2)) as c3 from (select fda_approved as c0, id as c2 from medicine where c2 = 3) as t0 group by c1 order by c3 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": "medicine_enzyme_interaction",
"sql": "select t0.c0 as c1, count(distinct (t0.c2)) as c3 from (select fda_approved as c0, id as c2 from medicine where c2 = 3) as t0 group by c1 order by c3 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 3667,
"split": "train"
} | |
What are the SSNs, names of the scientists, and the associated project identifiers for the first 10 scientists linked to projects with hours between 256 and 9684, when ordered by the scientist's name, with any nulls appearing last? | scientist_1 | select t0.ssn, t0.name, t1.scientist as c0 from scientists as t0 join assignedto as t1 on t0.ssn = t1.scientist join projects as t2 on t1.project = t2.code where t2.hours between 256 and 9684 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": "scientist_1",
"sql": "select t0.ssn, t0.name, t1.scientist as c0 from scientists as t0 join assignedto as t1 on t0.ssn = t1.scientist join projects as t2 on t1.project = t2.code where t2.hours between 256 and 9684 order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 2837,
"split": "train"
} | |
Which Participant IDs and Event IDs are associated with the event that has an ID of 95? | local_govt_in_alabama | select participant_id, event_id as c0 from participants_in_events where c0 = 95 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_in_alabama",
"sql": "select participant_id, event_id as c0 from participants_in_events where c0 = 95"
},
"style": "rule"
} | {
"index": 466,
"split": "train"
} | |
What is the difference between the number of followers user 2 has and the lowest followers count among users in partitions with IDs over 10? | twitter_1 | select t2.c0 - t0.c1 from (select min(followers) as c0 from user_profiles where partitionid > 10) as t2, (select followers as c1 from user_profiles where uid = 2) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "twitter_1",
"sql": "select t2.c0 - t0.c1 from (select min(followers) as c0 from user_profiles where partitionid > 10) as t2, (select followers as c1 from user_profiles where uid = 2) as t0"
},
"style": "rule"
} | {
"index": 3206,
"split": "train"
} | |
Which service type codes and product names are associated with workshop groups that have bookings scheduled for a delivery date after June 5th, 2014? | cre_Drama_Workshop_Groups | select t0.service_type_code, t0.product_name, t1.workshop_group_id from services as t0 join drama_workshop_groups as t1 on t0.workshop_group_id = t1.workshop_group_id join bookings as t2 on t1.workshop_group_id = t2.workshop_group_id where t2.planned_delivery_date > '2014-06-05 10:19:46' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Drama_Workshop_Groups",
"sql": "select t0.service_type_code, t0.product_name, t1.workshop_group_id from services as t0 join drama_workshop_groups as t1 on t0.workshop_group_id = t1.workshop_group_id join bookings as t2 on t1.workshop_group_id = t2.workshop_group_id where t2.p... | {
"index": 1516,
"split": "train"
} | |
Show me the customer IDs and order statuses for customers with an ID of 15 or any customer with an ID less than or equal to 9. | tracking_orders | select t0.customer_id, t1.order_status from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t1.customer_id = 15 or t1.customer_id <= 9 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select t0.customer_id, t1.order_status from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t1.customer_id = 15 or t1.customer_id <= 9"
},
"style": "rule"
} | {
"index": 670,
"split": "train"
} | |
What are the claim amount paid and claim amount claimed for claims related to the most frequently issued policy? | insurance_and_eClaims | select anon_1.c1, anon_1.c0 from (select amount_piad as c1, amount_claimed as c0 from claim_headers intersect select t0.amount_piad as c1, t0.amount_claimed as c0 from claim_headers as t0 join policies as t1 on t0.policy_id = t1.policy_id, (select policy_id as c2 from policies group by c2 order by count(*) asc nulls la... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_and_eClaims",
"sql": "select anon_1.c1, anon_1.c0 from (select amount_piad as c1, amount_claimed as c0 from claim_headers intersect select t0.amount_piad as c1, t0.amount_claimed as c0 from claim_headers as t0 join policies as t1 on t0.policy_id = t1.policy_id, (select ... | {
"index": 2512,
"split": "train"
} | |
Which are the first 10 scientists, including their names and SSNs, along with their assigned scientists and projects, where the project names either end with "rallax" or start with "Aerodynamics and Ice", sorted by project name with any nulls appearing last? | scientist_1 | select t0.name, t0.ssn, t1.scientist, t1.project as c1 from scientists as t0 join assignedto as t1 on t0.ssn = t1.scientist join projects as t2 on t1.project = t2.code where t2.name like '%rallax' or t2.name like 'Aerodynamics and Ice %' order by c1 asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "scientist_1",
"sql": "select t0.name, t0.ssn, t1.scientist, t1.project as c1 from scientists as t0 join assignedto as t1 on t0.ssn = t1.scientist join projects as t2 on t1.project = t2.code where t2.name like '%rallax' or t2.name like 'Aerodynamics and Ice %' order by c1 asc null... | {
"index": 982,
"split": "train"
} | |
What are the Book Club ID, Book Title, and Publisher of the earliest book club, along with the company name of the culture company, for movies released in a year less than or equal to the sum of all movie years or in 1999 or earlier? | culture_company | select t0.book_club_id as c2, t0.book_title, t0.publisher, t1.book_club_id, t1.company_name from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id join movie as t2 on t1.movie_id = t2.movie_id, (select sum(year) as c5 from movie) as t0 where t2.year <= t0.c5 or t2.year <= 1999 order 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": "culture_company",
"sql": "select t0.book_club_id as c2, t0.book_title, t0.publisher, t1.book_club_id, t1.company_name from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id join movie as t2 on t1.movie_id = t2.movie_id, (select sum(year) as c5 from m... | {
"index": 310,
"split": "train"
} | |
What are the counts of guest last names and dates of birth for guests whose apartment ID is less than or equal to the smallest apartment ID among bookings that either ended on October 25, 2017, or ended between November 12 and November 29, 2017, and who booked an apartment after August 4, 2016? | apartment_rentals | select count(t0.guest_last_name), count(t0.date_of_birth) from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id, (select min(apt_id) as c2 from apartment_bookings where booking_end_date = '2017-10-25 11:08:42' or booking_end_date between '2017-11-12 01:05:09' and '2017-11-29 12:59:42') as t0 wher... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(t0.guest_last_name), count(t0.date_of_birth) from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id, (select min(apt_id) as c2 from apartment_bookings where booking_end_date = '2017-10-25 11:08:42' or booking_end_date... | {
"index": 2937,
"split": "train"
} | |
What are the year, event ID, event name, and associated record ID for events where the record was set by swimmers with a 100-meter time equal to the highest time among swimmers who have a 100-meter time less than or equal to 57.31 seconds or greater than or equal to 57.35 seconds? | swimming | select t0.year, t0.id, t0.name, t1.id from event as t0 join record as t1 on t0.id = t1.event_id join swimmer as t2 on t1.swimmer_id = t2.id, (select max(meter_100) as c3 from swimmer where meter_100 <= 57.31 or meter_100 >= 57.35) as t0 where t2.meter_100 = t0.c3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "swimming",
"sql": "select t0.year, t0.id, t0.name, t1.id from event as t0 join record as t1 on t0.id = t1.event_id join swimmer as t2 on t1.swimmer_id = t2.id, (select max(meter_100) as c3 from swimmer where meter_100 <= 57.31 or meter_100 >= 57.35) as t0 where t2.meter_100 = t0.... | {
"index": 2777,
"split": "train"
} | |
Can you tell me the descriptions of products involved in complaints labeled as 'Product Unusable' where the staff handling the complaint has an ID greater than 117? | customer_complaints | select t0.product_description from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.staff_id > 117 and t1.complaint_type_code = 'Product Unusable' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_description from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.staff_id > 117 and t1.complaint_type_code = 'Product Unusable'"
},
"style": "rule"
} | {
"index": 1206,
"split": "train"
} | |
Can you tell me the different numbers of injured people, the locations, and the years when these incidents happened, listing each unique combination only once? | perpetrator | select distinct injured, location, year from perpetrator | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "perpetrator",
"sql": "select distinct injured, location, year from perpetrator"
},
"style": "rule"
} | {
"index": 19,
"split": "train"
} | |
Can you tell me the location, number of hosts, first year, and party ID for parties that have hosts who are exactly 30 years old? | party_host | select t0.location, t0.number_of_hosts, t0.first_year, t1.party_id from party as t0 join party_host as t1 on t0.party_id = t1.party_id join host as t2 on t1.host_id = t2.host_id where t2.age = 30 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "party_host",
"sql": "select t0.location, t0.number_of_hosts, t0.first_year, t1.party_id from party as t0 join party_host as t1 on t0.party_id = t1.party_id join host as t2 on t1.host_id = t2.host_id where t2.age = 30"
},
"style": "rule"
} | {
"index": 2565,
"split": "train"
} | |
Can you list the budget type descriptions and codes from the reference budget codes, along with the corresponding budget type codes and document IDs for expenses? These expenses are linked to documents whose document type codes start with "FM" or contain the letter "P". | cre_Docs_and_Epenses | select t0.budget_type_description, t0.budget_type_code, t1.budget_type_code, t1.document_id from ref_budget_codes as t0 join documents_with_expenses as t1 on t0.budget_type_code = t1.budget_type_code join documents as t2 on t1.document_id = t2.document_id join ref_document_types as t3 on t2.document_type_code = t3.docu... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Docs_and_Epenses",
"sql": "select t0.budget_type_description, t0.budget_type_code, t1.budget_type_code, t1.document_id from ref_budget_codes as t0 join documents_with_expenses as t1 on t0.budget_type_code = t1.budget_type_code join documents as t2 on t1.document_id = t2.docum... | {
"index": 339,
"split": "train"
} | |
What are the different sexes and ages of students named Steven Leighton or whose last names end with "Apap"? | dorm_1 | select distinct sex, age from student where fname = 'Steven' and lname = 'Leighton' or lname like '%Apap' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct sex, age from student where fname = 'Steven' and lname = 'Leighton' or lname like '%Apap'"
},
"style": "rule"
} | {
"index": 2165,
"split": "train"
} | |
Did the log entry for problem log 7 occur after the log entry for problem log 2? | tracking_software_problems | select t1.c2 > t0.c2 from (select log_entry_date as c2 from problem_log where problem_log_id = 7) as t1, (select log_entry_date as c2 from problem_log where problem_log_id = 2) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t1.c2 > t0.c2 from (select log_entry_date as c2 from problem_log where problem_log_id = 7) as t1, (select log_entry_date as c2 from problem_log where problem_log_id = 2) as t0"
},
"style": "rule"
} | {
"index": 3947,
"split": "train"
} | |
Is the valid starting date of the card with ID 8 later than the valid starting date of the card with ID 5? | customers_card_transactions | select t1.c2 > t0.c2 from (select date_valid_from as c2 from customers_cards where card_id = 8) as t1, (select date_valid_from as c2 from customers_cards where card_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": "customers_card_transactions",
"sql": "select t1.c2 > t0.c2 from (select date_valid_from as c2 from customers_cards where card_id = 8) as t1, (select date_valid_from as c2 from customers_cards where card_id = 5) as t0"
},
"style": "rule"
} | {
"index": 3972,
"split": "train"
} | |
Find the Paper ID and title of the most recent paper associated with an institution whose name includes "ersit" or "Universi". | icfp_1 | select t0.paperid as c1, t0.title from papers as t0 join authorship as t1 on t0.paperid = t1.paperid join inst as t2 on t1.instid = t2.instid where t2.name like '%ersit%' or t2.name like '%Universi%' 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": "icfp_1",
"sql": "select t0.paperid as c1, t0.title from papers as t0 join authorship as t1 on t0.paperid = t1.paperid join inst as t2 on t1.instid = t2.instid where t2.name like '%ersit%' or t2.name like '%Universi%' order by c1 desc limit 1"
},
"style": "rule"
} | {
"index": 231,
"split": "train"
} | |
What are the office locations, employee numbers, and highest degrees of the top 10 professors who teach classes with code containing "4" or the class with the fewest students enrolled, sorted by their highest degree in order from highest to lowest? | college_1 | select t0.prof_office, t0.emp_num, t0.prof_high_degree as c3 from professor as t0 join employee as t1 on t0.emp_num = t1.emp_num join class as t2 on t1.emp_num = t2.prof_num, (select class_code as c0 from class group by c0 order by count(*) asc nulls last limit 1) as t0 where t2.class_code like '%4%' or t2.class_code =... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_1",
"sql": "select t0.prof_office, t0.emp_num, t0.prof_high_degree as c3 from professor as t0 join employee as t1 on t0.emp_num = t1.emp_num join class as t2 on t1.emp_num = t2.prof_num, (select class_code as c0 from class group by c0 order by count(*) asc nulls last limi... | {
"index": 1156,
"split": "train"
} | |
How does the Cmi Cross Reference ID for the electoral register entry with ID 4 compare to 75? | local_govt_mdm | select cmi_cross_ref_id - 75 from electoral_register where electoral_register_id = 4 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_mdm",
"sql": "select cmi_cross_ref_id - 75 from electoral_register where electoral_register_id = 4"
},
"style": "rule"
} | {
"index": 3241,
"split": "train"
} | |
What are the order IDs, order details, and customer IDs for orders with order IDs of 4 or less that include products with IDs less than 12? | customers_and_invoices | select t0.order_id, t0.order_details, t0.customer_id from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.order_id <= 4 and t1.product_id < 12 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select t0.order_id, t0.order_details, t0.customer_id from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.order_id <= 4 and t1.product_id < 12"
},
"style": "rule"
} | {
"index": 1520,
"split": "train"
} | |
What are the details of the three museums with the smallest Museum Ids, including their Museum Id and details, along with the Tourist Attraction Id and Attraction Type Code for the attractions linked to them that have a feature with feature id 528? Sort the results by museum id, putting any with null ids at the end. | cre_Theme_park | select t0.museum_id as c1, t0.museum_details, t1.tourist_attraction_id, t1.attraction_type_code from museums as t0 join tourist_attractions as t1 on t0.museum_id = t1.tourist_attraction_id join tourist_attraction_features as t2 on t1.tourist_attraction_id = t2.tourist_attraction_id join features as t3 on t2.feature_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": "cre_Theme_park",
"sql": "select t0.museum_id as c1, t0.museum_details, t1.tourist_attraction_id, t1.attraction_type_code from museums as t0 join tourist_attractions as t1 on t0.museum_id = t1.tourist_attraction_id join tourist_attraction_features as t2 on t1.tourist_attraction_id... | {
"index": 1961,
"split": "train"
} | |
How many distinct documents are associated with the functional area that has the code 8? | document_management | select t0.c1 from (select count(distinct (t1.document_code)) as c1 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t0.functional_area_code = 8 group by t0.functional_area_code) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "document_management",
"sql": "select t0.c1 from (select count(distinct (t1.document_code)) as c1 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t0.functional_area_code = 8 group by t0.functional_area_cod... | {
"index": 3375,
"split": "train"
} | |
Which markets have films with a gross revenue of at least 177.2 million dollars, and what are their Market IDs, countries, and number of cities? | film_rank | select t0.market_id, t0.country, t0.number_cities from market as t0 join film_market_estimation as t1 on t0.market_id = t1.market_id join film as t2 on t1.film_id = t2.film_id where t2.gross_in_dollar >= 177200000 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "film_rank",
"sql": "select t0.market_id, t0.country, t0.number_cities from market as t0 join film_market_estimation as t1 on t0.market_id = t1.market_id join film as t2 on t1.film_id = t2.film_id where t2.gross_in_dollar >= 177200000"
},
"style": "rule"
} | {
"index": 2301,
"split": "train"
} | |
Show the active status, airline IDs, airline names, and source airport IDs for airlines that have routes originating from airports in cities ending with the letter "s". | flight_4 | select t0.active, t0.alid, t0.name, t1.src_apid from airlines as t0 join routes as t1 on t0.alid = t1.alid join airports as t2 on t1.src_apid = t2.apid where t2.city like '%s' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_4",
"sql": "select t0.active, t0.alid, t0.name, t1.src_apid from airlines as t0 join routes as t1 on t0.alid = t1.alid join airports as t2 on t1.src_apid = t2.apid where t2.city like '%s'"
},
"style": "rule"
} | {
"index": 2481,
"split": "train"
} | |
What are the three customer details that have the most rows, and how many rows and customer details are there for each, sorted alphabetically by customer details? | tracking_orders | select customer_details as c2, count(*), count(customer_details) from customers group by c2 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 customer_details as c2, count(*), count(customer_details) from customers group by c2 order by c2 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 733,
"split": "train"
} | |
What is the percentage change between the total number of bookings and the highest customer ID count among bookings with payments made at exactly 2018-03-22 02:28:11? | products_for_hire | select (count(t0.c2) / cast(count(t0.c2) as real) - 1) * 100 from (select max(t1.customer_id) as c2 from bookings as t0 join payments as t1 on t0.booking_id = t1.booking_id where t1.payment_date = '2018-03-22 02:28:11' group by t0.booking_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": "products_for_hire",
"sql": "select (count(t0.c2) / cast(count(t0.c2) as real) - 1) * 100 from (select max(t1.customer_id) as c2 from bookings as t0 join payments as t1 on t0.booking_id = t1.booking_id where t1.payment_date = '2018-03-22 02:28:11' group by t0.booking_id) as t0"
... | {
"index": 3040,
"split": "train"
} | |
How many days pass between enrollment and course completion for students enrolled in courses with IDs between 10 and 15? | e_learning | select julianday(t1.c2) - julianday(t0.c1) from (select date_of_completion as c2 from student_course_enrolment where course_id between 10 and 15 and course_id between 10 and 15) as t1, (select date_of_enrolment as c1 from student_course_enrolment) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select julianday(t1.c2) - julianday(t0.c1) from (select date_of_completion as c2 from student_course_enrolment where course_id between 10 and 15 and course_id between 10 and 15) as t1, (select date_of_enrolment as c1 from student_course_enrolment) as t0"
},... | {
"index": 3711,
"split": "train"
} | |
Which are the three browsers with the highest market share and their IDs that support web client accelerators used by all clients, when sorted by the IDs in descending order? | browser_web | select t0.market_share, t0.id as c1 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id join web_client_accelerator as t2 on t1.accelerator_id = t2.id where t2.client = 'All' order by c1 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "browser_web",
"sql": "select t0.market_share, t0.id as c1 from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id join web_client_accelerator as t2 on t1.accelerator_id = t2.id where t2.client = 'All' order by c1 desc limit 3"
},
"style": "rule"
... | {
"index": 2213,
"split": "train"
} | |
Which incident type descriptions, along with their reference and behavior incident type codes, occurred during incidents that started between June 19, 2017, in the afternoon and October 10, 2017, late at night? | behavior_monitoring | select t0.incident_type_description, t0.incident_type_code, t1.incident_type_code from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t1.date_incident_start between '2017-06-19 14:25:54' and '2017-10-10 22:43:54' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "behavior_monitoring",
"sql": "select t0.incident_type_description, t0.incident_type_code, t1.incident_type_code from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t1.date_incident_start between '2017-06-19 14:25:54' an... | {
"index": 2712,
"split": "train"
} | |
How much higher is the smallest premise ID associated with premise 2 compared to the lowest premise ID among all premises? | customers_campaigns_ecommerce | select t2.c3 - t0.c2 from (select min(t1.c2) as c3 from (select min(t1.premise_id) as c2 from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id group by t0.premise_id) as t1) as t2, (select t0.premise_id, min(t1.premise_id) as c2 from premises as t0 join customer_addresses as t1 on t0.premis... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c3 - t0.c2 from (select min(t1.c2) as c3 from (select min(t1.premise_id) as c2 from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id group by t0.premise_id) as t1) as t2, (select t0.premise_id, min(t1.... | {
"index": 3187,
"split": "train"
} | |
Among the airline that has the most flights starting from its source airports, for each destination airport it flies to, what is the number of unique destination airports served and the lowest airline ID among its routes to that destination? | flight_4 | select t0.dst_ap as c0, count(distinct (t0.dst_ap)), min(t0.alid) from routes as t0, (select airline as c2 from routes group by c2 order by count(src_apid) desc limit 1) as t0 where t0.airline = t0.c2 group by c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_4",
"sql": "select t0.dst_ap as c0, count(distinct (t0.dst_ap)), min(t0.alid) from routes as t0, (select airline as c2 from routes group by c2 order by count(src_apid) desc limit 1) as t0 where t0.airline = t0.c2 group by c0"
},
"style": "rule"
} | {
"index": 788,
"split": "train"
} | |
Which staff members, who have authorized the closure of at least three problems, are among the top five when sorted alphabetically by their first names? For each, please provide their last name and staff ID, considering only those whose closure was authorized by staff IDs less than or equal to 8. | tracking_software_problems | select t0.staff_last_name, t0.staff_id as c1 from staff as t0 join problems as t1 on t0.staff_id = t1.closure_authorised_by_staff_id where t1.closure_authorised_by_staff_id <= 8 group by c1 having count(*) >= 3 order by t0.staff_first_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": "tracking_software_problems",
"sql": "select t0.staff_last_name, t0.staff_id as c1 from staff as t0 join problems as t1 on t0.staff_id = t1.closure_authorised_by_staff_id where t1.closure_authorised_by_staff_id <= 8 group by c1 having count(*) >= 3 order by t0.staff_first_name asc... | {
"index": 104,
"split": "train"
} | |
What is the numerical difference between the OMIM value of the enzyme with ID 3 and the highest OMIM value among all enzymes? | medicine_enzyme_interaction | select t2.c1 - t0.c3 from (select max(omim) as c1 from enzyme) as t2, (select omim as c3 from enzyme where id = 3) 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": "medicine_enzyme_interaction",
"sql": "select t2.c1 - t0.c3 from (select max(omim) as c1 from enzyme) as t2, (select omim as c3 from enzyme where id = 3) as t0"
},
"style": "rule"
} | {
"index": 3946,
"split": "train"
} | |
Which countries have a unique name and ID where the country ID is either greater than the smallest country ID associated with leagues or exactly 13274? | soccer_1 | select distinct t0.name, t0.id from country as t0 join league as t1 on t0.id = t1.country_id, (select min(country_id) as c2 from league) as t0 where t1.country_id > t0.c2 or t1.country_id = 13274 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "soccer_1",
"sql": "select distinct t0.name, t0.id from country as t0 join league as t1 on t0.id = t1.country_id, (select min(country_id) as c2 from league) as t0 where t1.country_id > t0.c2 or t1.country_id = 13274"
},
"style": "rule"
} | {
"index": 1434,
"split": "train"
} | |
For each Service ID in the Services table, how many times does that Service ID appear uniquely? | insurance_fnol | select service_id as c0, count(distinct (service_id)) from services 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": "insurance_fnol",
"sql": "select service_id as c0, count(distinct (service_id)) from services group by c0"
},
"style": "rule"
} | {
"index": 814,
"split": "train"
} | |
What are the invoice numbers of the most recent 10 invoices that have shipment tracking numbers starting with "3534"? | tracking_orders | select t0.invoice_number as c0 from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where t1.shipment_tracking_number like '3534%' 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": "tracking_orders",
"sql": "select t0.invoice_number as c0 from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where t1.shipment_tracking_number like '3534%' order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 889,
"split": "train"
} | |
What is the percent change in the organization ID for service 29 at 2017-06-19 02:59:21? | local_govt_and_lot | select (t0.organization_id / cast(t0.organization_id as real) - 1) * 100 from services as t0 join organizations as t1 on t0.organization_id = t1.organization_id join things as t2 on t1.organization_id = t2.organization_id join timed_status_of_things as t3 on t2.thing_id = t3.thing_id where t0.service_id = 29 and t3.dat... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_id / cast(t0.organization_id as real) - 1) * 100 from services as t0 join organizations as t1 on t0.organization_id = t1.organization_id join things as t2 on t1.organization_id = t2.organization_id join timed_status_of_things a... | {
"index": 3420,
"split": "train"
} | |
Can you tell me the colors and types of grapes, along with the number of cases, for wines produced in appellations located in the county of Amador? | wine_1 | select t0.color, t0.grape, t1.cases from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.county = 'Amador' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "wine_1",
"sql": "select t0.color, t0.grape, t1.cases from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.county = 'Amador'"
},
"style": "rule"
} | {
"index": 399,
"split": "train"
} | |
Which schools have players with the most common playing position and a name ending with "Crow," and what are their School IDs, divisions, and locations? | school_player | select t0.school_id, t0.division, t1.location from school_details as t0 join school as t1 on t0.school_id = t1.school_id join player as t2 on t1.school_id = t2.school_id, (select position as c2 from player group by c2 order by count(*) desc limit 1) as t0 where t2.position = t0.c2 and t2.player like '% Crow *' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "school_player",
"sql": "select t0.school_id, t0.division, t1.location from school_details as t0 join school as t1 on t0.school_id = t1.school_id join player as t2 on t1.school_id = t2.school_id, (select position as c2 from player group by c2 order by count(*) desc limit 1) as t0 ... | {
"index": 25,
"split": "train"
} | |
Can you list up to 10 color descriptions from the reference colors for products whose typical selling price contains "6101", sorted alphabetically by color description? | products_gen_characteristics | select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.typical_selling_price like '%6101%' 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": "products_gen_characteristics",
"sql": "select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.typical_selling_price like '%6101%' order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 1269,
"split": "train"
} | |
Which research outcomes have outcome codes and descriptions that are not associated with documents of type 'REG' in the system? | tracking_grants_for_research | select anon_1.c1, anon_1.c0 from (select outcome_code as c1, outcome_description as c0 from research_outcomes except select t0.outcome_code as c1, t0.outcome_description as c0 from research_outcomes as t0 join project_outcomes as t1 on t0.outcome_code = t1.outcome_code join projects as t2 on t1.project_id = t2.project_... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select anon_1.c1, anon_1.c0 from (select outcome_code as c1, outcome_description as c0 from research_outcomes except select t0.outcome_code as c1, t0.outcome_description as c0 from research_outcomes as t0 join project_outcomes as t1 on t0.ou... | {
"index": 1151,
"split": "train"
} | |
What are the three highest address IDs in the Customer Addresses table? | department_store | select address_id as c0 from customer_addresses 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": "department_store",
"sql": "select address_id as c0 from customer_addresses order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 1540,
"split": "train"
} | |
What are the SSNs and names of the first five scientists, ordered by their SSNs, who are working on projects with fewer than 189 hours allocated? | scientist_1 | select t0.ssn as c0, t0.name from scientists as t0 join assignedto as t1 on t0.ssn = t1.scientist join projects as t2 on t1.project = t2.code where t2.hours < 189 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": "scientist_1",
"sql": "select t0.ssn as c0, t0.name from scientists as t0 join assignedto as t1 on t0.ssn = t1.scientist join projects as t2 on t1.project = t2.code where t2.hours < 189 order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 608,
"split": "train"
} | |
Was the tweet with ID 4 posted after the tweet with ID 6? | twitter_1 | select t1.c0 > t0.c0 from (select createdate as c0 from tweets where id = 4) as t1, (select createdate as c0 from tweets where 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": "twitter_1",
"sql": "select t1.c0 > t0.c0 from (select createdate as c0 from tweets where id = 4) as t1, (select createdate as c0 from tweets where id = 6) as t0"
},
"style": "rule"
} | {
"index": 3930,
"split": "train"
} | |
What is the rating of films that are either not listed in the film table or have the film ID 17? | sakila_1 | select t0.rating from film as t0 join film_actor as t1 on t0.film_id = t1.film_id where (not t1.film_id in (select t0.film_id as c0 from film)) or t1.film_id = 17 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.rating from film as t0 join film_actor as t1 on t0.film_id = t1.film_id where (not t1.film_id in (select t0.film_id as c0 from film)) or t1.film_id = 17"
},
"style": "rule"
} | {
"index": 156,
"split": "train"
} | |
What is the difference between the highest airport ID that company 5 has flown to and the highest airport ID that company 3 has flown to? | flight_company | select t1.c2 - t0.c2 from (select max(t1.airport_id) as c2 from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t0.id = 3 group by t0.id) as t1, (select t0.id, max(t1.airport_id) as c2 from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t0.id = 5 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": "flight_company",
"sql": "select t1.c2 - t0.c2 from (select max(t1.airport_id) as c2 from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t0.id = 3 group by t0.id) as t1, (select t0.id, max(t1.airport_id) as c2 from operate_company as t0 join flight as t1 on... | {
"index": 3609,
"split": "train"
} | |
Is the year associated with book club ID 5 earlier than 1990? | culture_company | select year < 1990 from book_club where book_club_id = 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "culture_company",
"sql": "select year < 1990 from book_club where book_club_id = 5"
},
"style": "rule"
} | {
"index": 3334,
"split": "train"
} | |
Which are the top 10 document types with the most unique grants associated with them when the document is labeled as "Regular," sorted by the document type code? | tracking_grants_for_research | select count(distinct (t0.grant_id)) from documents as t0 join document_types as t1 on t0.document_type_code = t1.document_type_code where t1.document_description = 'Regular' group by t1.document_type_code order by t1.document_type_code asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select count(distinct (t0.grant_id)) from documents as t0 join document_types as t1 on t0.document_type_code = t1.document_type_code where t1.document_description = 'Regular' group by t1.document_type_code order by t1.document_type_code asc ... | {
"index": 607,
"split": "train"
} | |
What are the ship IDs, mission codes, and fates for the first five missions, ordered by fate alphabetically, with any unknown fates listed last? | ship_mission | select ship_id, code, fate as c2 from mission order by c2 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "ship_mission",
"sql": "select ship_id, code, fate as c2 from mission order by c2 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 74,
"split": "train"
} | |
What are the character cell counts and display types for screen modes used by phones that have chip models launched after 2002 and with model names starting with "X"? | phone_1 | select anon_1.c1, anon_1.c0 from (select t0.char_cells as c1, t0.type as c0 from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode join chip_model as t2 on t1.chip_model = t2.model_name where t2.launch_year > 2002.0 intersect select t0.char_cells as c1, t0.type as c0 from screen_mode as t0 join ph... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "phone_1",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.char_cells as c1, t0.type as c0 from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode join chip_model as t2 on t1.chip_model = t2.model_name where t2.launch_year > 2002.0 intersect select t0.char... | {
"index": 2821,
"split": "train"
} | |
How many days have passed between the date when customer 13's address was first recorded and the date it was last updated in their address history? | customers_and_products_contacts | select julianday(t1.c0) - julianday(t0.c2) from (select date_from as c0 from customer_address_history where customer_id = 13 and customer_id = 13) as t1, (select date_to as c2 from customer_address_history) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_products_contacts",
"sql": "select julianday(t1.c0) - julianday(t0.c2) from (select date_from as c0 from customer_address_history where customer_id = 13 and customer_id = 13) as t1, (select date_to as c2 from customer_address_history) as t0"
},
"style": "rule"
} | {
"index": 3692,
"split": "train"
} | |
Which three block floors have the fewest distinct blockfloor entries in the hospital, and what are their floor numbers? | hospital_1 | select blockfloor as c0 from block group by c0 order by count(distinct (blockfloor)) 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": "hospital_1",
"sql": "select blockfloor as c0 from block group by c0 order by count(distinct (blockfloor)) asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 1976,
"split": "train"
} | |
What is the percentage change in the average property ID for customer 19 with properties numbered 107 or higher, comparing the period around March 27, 2015, to that around September 27, 2016? | local_govt_and_lot | select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select avg(t1.property_id) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2016-09-27 12:00:00' and t1.property_id >= 107 group by t0.customer_id) as t0, (select t0.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": "local_govt_and_lot",
"sql": "select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select avg(t1.property_id) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2016-09-27 12:00:00' and t1.prop... | {
"index": 3973,
"split": "train"
} | |
Find the names and UIDs of users who follow or are followed by the user with the fewest followers. | twitter_1 | select t0.name from user_profiles as t0 join follows as t1 on t0.uid = t1.f2, (select f2 as c1 from follows group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.f2 = t0.c1 or t1.f2 = 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": "twitter_1",
"sql": "select t0.name from user_profiles as t0 join follows as t1 on t0.uid = t1.f2, (select f2 as c1 from follows group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.f2 = t0.c1 or t1.f2 = t0.c1"
},
"style": "rule"
} | {
"index": 1153,
"split": "train"
} | |
For each broadcast channel, what are the number of unique times of day starting with "N" or the most common time of day, and how many programs are scheduled during those times? Show the first five channels sorted by their ID. | program_share | select t0.channel_id as c2, count(distinct (t0.time_of_day)), count(t0.program_id) from broadcast as t0, (select time_of_day as c1 from broadcast group by c1 order by count(*) desc limit 1) as t0 where t0.time_of_day like 'N%' or t0.time_of_day = t0.c1 group by c2 order by c2 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "program_share",
"sql": "select t0.channel_id as c2, count(distinct (t0.time_of_day)), count(t0.program_id) from broadcast as t0, (select time_of_day as c1 from broadcast group by c1 order by count(*) desc limit 1) as t0 where t0.time_of_day like 'N%' or t0.time_of_day = t0.c1 gro... | {
"index": 1298,
"split": "train"
} | |
How many games have been played at each stadium with a capacity percentage of 100.3% or less, and what is the total attendance and stadium ID for each of these stadiums? | game_injury | select count(*), t0.total_attendance, t0.id as c1 from stadium as t0 join game as t1 on t0.id = t1.stadium_id where t0.capacity_percentage <= 100.3 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": "game_injury",
"sql": "select count(*), t0.total_attendance, t0.id as c1 from stadium as t0 join game as t1 on t0.id = t1.stadium_id where t0.capacity_percentage <= 100.3 group by c1"
},
"style": "rule"
} | {
"index": 876,
"split": "train"
} | |
What are the names of the five media types with tracks shorter than 410,566 milliseconds or between 162,220 and 340,532 milliseconds, listed in reverse alphabetical order? | store_1 | select t0.name as c0 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.milliseconds < 410566 or t1.milliseconds between 162220 and 340532 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": "store_1",
"sql": "select t0.name as c0 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.milliseconds < 410566 or t1.milliseconds between 162220 and 340532 order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 1042,
"split": "train"
} | |
Can you list, for each stadium, its average attendance and number of home games, particularly focusing on stadiums whose IDs are 6 or below or those not matching any existing stadium ID? | game_injury | select t0.average_attendance, t0.home_games from stadium as t0 join game as t1 on t0.id = t1.stadium_id where (not t1.stadium_id in (select t0.id as c1 from stadium)) or t1.stadium_id <= 6 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "game_injury",
"sql": "select t0.average_attendance, t0.home_games from stadium as t0 join game as t1 on t0.id = t1.stadium_id where (not t1.stadium_id in (select t0.id as c1 from stadium)) or t1.stadium_id <= 6"
},
"style": "rule"
} | {
"index": 868,
"split": "train"
} | |
Show the Shop ID, Shop Name, Location, Open Date, and Open Year for shops that do not stock any devices running the iOS software platform. | device | select anon_1.c0, anon_1.c1, anon_1.c4, anon_1.c2, anon_1.c3 from (select shop_id as c0, shop_name as c1, location as c4, open_date as c2, open_year as c3 from shop except select t0.shop_id as c0, t0.shop_name as c1, t0.location as c4, t0.open_date as c2, t0.open_year as c3 from shop as t0 join stock as t1 on t0.shop_i... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "device",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c4, anon_1.c2, anon_1.c3 from (select shop_id as c0, shop_name as c1, location as c4, open_date as c2, open_year as c3 from shop except select t0.shop_id as c0, t0.shop_name as c1, t0.location as c4, t0.open_date as c2, t0.open... | {
"index": 1522,
"split": "train"
} | |
What are the names of up to five characteristics with IDs between 4 and 15 associated with product number 1, listed in alphabetical order? | products_gen_characteristics | select t0.characteristic_name as c0 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.characteristic_id between 4 and 15 and t1.product_id = 1 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": "products_gen_characteristics",
"sql": "select t0.characteristic_name as c0 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.characteristic_id between 4 and 15 and t1.product_id = 1 order by c0 asc nulls last lim... | {
"index": 2475,
"split": "train"
} | |
What is the difference between customer 6's savings balance and 80,000? | small_bank_1 | select balance - 80000.0 from savings where custid = 6 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "small_bank_1",
"sql": "select balance - 80000.0 from savings where custid = 6"
},
"style": "rule"
} | {
"index": 3251,
"split": "train"
} | |
How does order ID 5 rank when the order items are sorted by product ID in descending order? | customers_and_addresses | select t1.c1, t1.c2 as c0 from (select row_number() over (order by product_id desc) as c1, order_id as c2 from order_items) as t1 where c0 = 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_addresses",
"sql": "select t1.c1, t1.c2 as c0 from (select row_number() over (order by product_id desc) as c1, order_id as c2 from order_items) as t1 where c0 = 5"
},
"style": "rule"
} | {
"index": 3474,
"split": "train"
} | |
What are the unique combinations of person IDs and address IDs in the People Addresses table? | student_assessment | select distinct person_id, address_id from people_addresses | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "student_assessment",
"sql": "select distinct person_id, address_id from people_addresses"
},
"style": "rule"
} | {
"index": 1341,
"split": "train"
} | |
What is the name and salary of the employee with the ID 269734834? | flight_1 | select t0.name, t0.salary from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 269734834 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_1",
"sql": "select t0.name, t0.salary from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 269734834"
},
"style": "rule"
} | {
"index": 1866,
"split": "train"
} | |
Which students, identified by their student IDs and details, are enrolled in the course named French or in the overall least popular course? | student_assessment | select t0.student_id, t0.student_details from students as t0 join student_course_registrations as t1 on t0.student_id = t1.student_id join courses as t2 on t1.course_id = t2.course_id, (select course_name as c1 from courses group by c1 order by count(*) asc nulls last limit 1) as t0 where t2.course_name = 'French' or 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": "student_assessment",
"sql": "select t0.student_id, t0.student_details from students as t0 join student_course_registrations as t1 on t0.student_id = t1.student_id join courses as t2 on t1.course_id = t2.course_id, (select course_name as c1 from courses group by c1 order by count(... | {
"index": 2625,
"split": "train"
} | |
Which postal codes are associated with customers who have the most frequently used email address, and what are the first five postal codes when sorted alphabetically? | sakila_1 | select t0.postal_code as c0 from address as t0 join customer as t1 on t0.address_id = t1.address_id, (select email as c1 from customer group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.email = t0.c1 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": "sakila_1",
"sql": "select t0.postal_code as c0 from address as t0 join customer as t1 on t0.address_id = t1.address_id, (select email as c1 from customer group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.email = t0.c1 order by c0 asc nulls last limit 5"
},
... | {
"index": 1071,
"split": "train"
} | |
Find the countries, college IDs, and member IDs of members whose colleges have names ending with "School" and are led by someone whose name starts with "Samir Chahi. | decoration_competition | select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.country as c2, t0.college_id as c0, t0.member_id as c1 from member as t0 join college as t1 on t0.college_id = t1.college_id where t1.name like '%School' intersect select t0.country as c2, t0.college_id as c0, t0.member_id as c1 from member as t0 join college as t1... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "decoration_competition",
"sql": "select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.country as c2, t0.college_id as c0, t0.member_id as c1 from member as t0 join college as t1 on t0.college_id = t1.college_id where t1.name like '%School' intersect select t0.country as c2, t0.... | {
"index": 1583,
"split": "train"
} | |
Which five locations have the most different years in which violent incidents involving perpetrators were recorded? | perpetrator | select location as c1, count(distinct (year)) as c0 from perpetrator group by c1 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": "perpetrator",
"sql": "select location as c1, count(distinct (year)) as c0 from perpetrator group by c1 order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 2624,
"split": "train"
} | |
What are the budget type descriptions and codes for expenses linked to the most frequently occurring statement details or those with statement details ending in "rivate Project"? | cre_Docs_and_Epenses | select t0.budget_type_description, t0.budget_type_code from ref_budget_codes as t0 join documents_with_expenses as t1 on t0.budget_type_code = t1.budget_type_code join documents as t2 on t1.document_id = t2.document_id join statements as t3 on t2.document_id = t3.statement_id, (select statement_details as c1 from state... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Docs_and_Epenses",
"sql": "select t0.budget_type_description, t0.budget_type_code from ref_budget_codes as t0 join documents_with_expenses as t1 on t0.budget_type_code = t1.budget_type_code join documents as t2 on t1.document_id = t2.document_id join statements as t3 on t2.do... | {
"index": 2496,
"split": "train"
} | |
Which are the top three most recent purchases made by members at branch 1, including each member's name, hometown, their ID, and the year of purchase? | shop_membership | select t0.name, t0.hometown, t1.member_id, t1.year as c3 from member as t0 join purchase as t1 on t0.member_id = t1.member_id join membership_register_branch as t2 on t0.member_id = t2.member_id join branch as t3 on t2.branch_id = t3.branch_id where t3.branch_id = 1 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.name, t0.hometown, t1.member_id, t1.year as c3 from member as t0 join purchase as t1 on t0.member_id = t1.member_id join membership_register_branch as t2 on t0.member_id = t2.member_id join branch as t3 on t2.branch_id = t3.branch_id where t3.b... | {
"index": 295,
"split": "train"
} | |
Which are the five detention types with the fewest occurrences among those whose type codes end with "K" or begin with "LUNC"? Please provide their descriptions and codes, sorted by increasing number of detention records. | behavior_monitoring | select t0.detention_type_description, t0.detention_type_code as c0 from ref_detention_type as t0 join detention as t1 on t0.detention_type_code = t1.detention_type_code where t1.detention_type_code like '%K' or t1.detention_type_code like 'LUNC%' group by c0 order by count(*) 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": "behavior_monitoring",
"sql": "select t0.detention_type_description, t0.detention_type_code as c0 from ref_detention_type as t0 join detention as t1 on t0.detention_type_code = t1.detention_type_code where t1.detention_type_code like '%K' or t1.detention_type_code like 'LUNC%' gro... | {
"index": 427,
"split": "train"
} | |
Show the top three accounts with account names containing "3," including each account's id, the total sum of their account ids, and the number of unique transaction amounts associated with them, sorted by account id in descending order. | customers_and_invoices | select sum(t0.account_id), count(distinct (t0.transaction_amount)), t1.account_id as c1 from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.account_name like '%3%' group by c1 order by c1 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select sum(t0.account_id), count(distinct (t0.transaction_amount)), t1.account_id as c1 from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.account_name like '%3%' group by c1 order by c1 desc limit 3"
... | {
"index": 1678,
"split": "train"
} | |
Between user 1 and user 2, who trusts a greater number of unique users when considering their lowest trust levels, and which user has the higher minimum trust score among their trusted users? | epinions_1 | select count(distinct (t0.target_u_id)), t1.u_id as c1 from trust as t0 join useracct as t1 on t0.source_u_id = t1.u_id where c1 = 2 or c1 = 1 group by c1 order by min(t0.trust) desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select count(distinct (t0.target_u_id)), t1.u_id as c1 from trust as t0 join useracct as t1 on t0.source_u_id = t1.u_id where c1 = 2 or c1 = 1 group by c1 order by min(t0.trust) desc limit 1"
},
"style": "rule"
} | {
"index": 1484,
"split": "train"
} | |
What is the difference between the smallest purchase transaction amount on August 13, 1977, and the smallest purchase transaction amount on October 8, 1985, for transactions between 8.9 and 207,484,122.2796? | tracking_share_transactions | select t1.c1 - t0.c1 from (select min(t1.amount_of_transaction) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'PUR' and t1.date_of_transaction = '1977-08-13 02:18:47' and t1.amount_of_transaction between 8.9 and 207... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select t1.c1 - t0.c1 from (select min(t1.amount_of_transaction) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'PUR' and t1.date_of_transa... | {
"index": 3532,
"split": "train"
} | |
What are the artist IDs 249 and 260, and what is the average artist ID recorded in their albums? | store_1 | select avg(t0.artist_id), t1.id as c0 from albums as t0 join artists as t1 on t0.artist_id = t1.id where c0 = 249 or c0 = 260 group by c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select avg(t0.artist_id), t1.id as c0 from albums as t0 join artists as t1 on t0.artist_id = t1.id where c0 = 249 or c0 = 260 group by c0"
},
"style": "rule"
} | {
"index": 2211,
"split": "train"
} | |
Can you list the first five activities along with their names that have students advised by someone with an advisor ID less than 8772? Show the activities sorted by activity ID, placing any activities without an ID at the end. | activity_1 | select t0.actid as c1, t0.activity_name from activity as t0 join participates_in as t1 on t0.actid = t1.actid join student as t2 on t1.stuid = t2.stuid where t2.advisor < 8772 or t2.advisor < 8772 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": "activity_1",
"sql": "select t0.actid as c1, t0.activity_name from activity as t0 join participates_in as t1 on t0.actid = t1.actid join student as t2 on t1.stuid = t2.stuid where t2.advisor < 8772 or t2.advisor < 8772 order by c1 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2061,
"split": "train"
} | |
What is the description of the first incident type, alphabetically, associated with student ID 5? | behavior_monitoring | select t0.incident_type_description as c0 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t1.student_id = 5 order by c0 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "behavior_monitoring",
"sql": "select t0.incident_type_description as c0 from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code where t1.student_id = 5 order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 1479,
"split": "train"
} | |
Which districts with IDs of 3 or less are associated with store number 5? | store_product | select distinct district_id as c0, store_id as c1 from store_district where c0 <= 3 and c1 = 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_product",
"sql": "select distinct district_id as c0, store_id as c1 from store_district where c0 <= 3 and c1 = 5"
},
"style": "rule"
} | {
"index": 1378,
"split": "train"
} | |
Find the number of followers and email address of the user who posted the tweet with ID 4. | twitter_1 | select t0.followers, t0.email from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.id = 4 order by t1.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": "twitter_1",
"sql": "select t0.followers, t0.email from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.id = 4 order by t1.id desc limit 1"
},
"style": "rule"
} | {
"index": 1509,
"split": "train"
} | |
What is the difference between the total flight velocity of the company with ID 7 and the lowest total flight velocity among all operating companies? | flight_company | select t2.c3 - t0.c2 from (select min(t1.c2) as c3 from (select sum(t1.velocity) as c2 from operate_company as t0 join flight as t1 on t0.id = t1.company_id group by t0.id) as t1) as t2, (select t0.id, sum(t1.velocity) as c2 from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t0.id = 7 group by ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_company",
"sql": "select t2.c3 - t0.c2 from (select min(t1.c2) as c3 from (select sum(t1.velocity) as c2 from operate_company as t0 join flight as t1 on t0.id = t1.company_id group by t0.id) as t1) as t2, (select t0.id, sum(t1.velocity) as c2 from operate_company as t0 joi... | {
"index": 3193,
"split": "train"
} | |
Which are the top five publishers of book clubs that are associated with movies starting with '5' or with the most frequently linked movie, sorted in reverse alphabetical order? | culture_company | select t0.publisher as c0 from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id, (select movie_id as c1 from culture_company group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.movie_id like '5%' or t1.movie_id = t0.c1 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": "culture_company",
"sql": "select t0.publisher as c0 from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id, (select movie_id as c1 from culture_company group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.movie_id like '5%' or t1.movi... | {
"index": 1291,
"split": "train"
} | |
Which fleet series and models are associated with aircrafts that have been flown by pilot number 4, but not by the pilot who has the fewest total records? | pilot_record | select anon_1.c2, anon_1.c1 from (select t0.fleet_series as c2, t0.model as c1 from aircraft as t0 join pilot_record as t1 on t0.aircraft_id = t1.aircraft_id where t1.pilot_id = 4 except select t0.fleet_series as c2, t0.model as c1 from aircraft as t0 join pilot_record as t1 on t0.aircraft_id = t1.aircraft_id, (select ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c2, anon_1.c1 from (select t0.fleet_series as c2, t0.model as c1 from aircraft as t0 join pilot_record as t1 on t0.aircraft_id = t1.aircraft_id where t1.pilot_id = 4 except select t0.fleet_series as c2, t0.model as c1 from aircraft as t0 join ... | {
"index": 2501,
"split": "train"
} | |
How many different parts are associated with each part ID that has a chargeable amount containing "4"? Show the number of unique part associations, the chargeable amount, and the part ID, sorted by the number of unique associated parts. | assets_maintenance | select count(distinct (t0.part_id)) as c0, t1.chargeable_amount as c1, t1.part_id as c2 from asset_parts as t0 join parts as t1 on t0.part_id = t1.part_id where c1 like '%4%' group by c2 order by c0 asc nulls last | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "assets_maintenance",
"sql": "select count(distinct (t0.part_id)) as c0, t1.chargeable_amount as c1, t1.part_id as c2 from asset_parts as t0 join parts as t1 on t0.part_id = t1.part_id where c1 like '%4%' group by c2 order by c0 asc nulls last"
},
"style": "rule"
} | {
"index": 921,
"split": "train"
} | |
Do customers with ID 11, who are classified as good or bad customers ending with "d," have any associated discount coupons, and if so, what are their coupon IDs? | products_for_hire | select t0.coupon_id, t1.coupon_id from discount_coupons as t0 join customers as t1 on t0.coupon_id = t1.coupon_id where t1.customer_id = 11 and t1.good_or_bad_customer like '%d' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.coupon_id, t1.coupon_id from discount_coupons as t0 join customers as t1 on t0.coupon_id = t1.coupon_id where t1.customer_id = 11 and t1.good_or_bad_customer like '%d'"
},
"style": "rule"
} | {
"index": 612,
"split": "train"
} | |
What are the names and trade names of medicines that interact with enzymes whose OMIM number is at least the smallest OMIM number among all enzymes? | medicine_enzyme_interaction | select t0.name, t0.trade_name from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id join enzyme as t2 on t1.enzyme_id = t2.id, (select min(omim) as c1 from enzyme) as t0 where t2.omim >= 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": "medicine_enzyme_interaction",
"sql": "select t0.name, t0.trade_name from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id join enzyme as t2 on t1.enzyme_id = t2.id, (select min(omim) as c1 from enzyme) as t0 where t2.omim >= t0.c1"
},
"style": "... | {
"index": 2215,
"split": "train"
} | |
Can you list the top 10 players with last names starting with "Bla" who have appeared as all-stars fewer than twice? For each, include the number of unique years they were selected as all-stars, their birth country, and their player ID, with the results sorted by player ID in reverse order. | baseball_1 | select count(distinct (t0.year)), t1.birth_country, t1.player_id as c1 from all_star as t0 join player as t1 on t0.player_id = t1.player_id where t1.name_last like 'Bla%' group by c1 having count(*) < 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": "baseball_1",
"sql": "select count(distinct (t0.year)), t1.birth_country, t1.player_id as c1 from all_star as t0 join player as t1 on t0.player_id = t1.player_id where t1.name_last like 'Bla%' group by c1 having count(*) < 2 order by c1 desc limit 10"
},
"style": "rule"
} | {
"index": 2370,
"split": "train"
} | |
What are the project IDs and corresponding staff role codes for roles that start with "res" or are labeled as "leader," listed in order of ascending project ID? | tracking_grants_for_research | select t0.project_id as c1, t1.role_code as c0 from project_staff as t0 join staff_roles as t1 on t0.role_code = t1.role_code where c0 like 'res%' or c0 = 'leader' 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": "tracking_grants_for_research",
"sql": "select t0.project_id as c1, t1.role_code as c0 from project_staff as t0 join staff_roles as t1 on t0.role_code = t1.role_code where c0 like 'res%' or c0 = 'leader' order by c1 asc nulls last"
},
"style": "rule"
} | {
"index": 849,
"split": "train"
} | |
What was the end date of the most recent project that staff member 13739108.0 was involved in? | tracking_grants_for_research | select t0.date_to, t0.project_id as c0 from project_staff as t0, (select max(project_id) as c2 from project_staff where staff_id = 13739108.0) as t1 where c0 = t1.c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select t0.date_to, t0.project_id as c0 from project_staff as t0, (select max(project_id) as c2 from project_staff where staff_id = 13739108.0) as t1 where c0 = t1.c2"
},
"style": "rule"
} | {
"index": 3798,
"split": "train"
} | |
Which cinemas have a certain capacity and ID, and are scheduled to show films titled "The Case of the Mystery Weekend" or films with titles ending with "e Piggy Banker"? | cinema | select t0.capacity, t0.cinema_id, t1.cinema_id from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id join film as t2 on t1.film_id = t2.film_id where t2.title = 'The Case of the Mystery Weekend' or t2.title like '%e Piggy Banker' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cinema",
"sql": "select t0.capacity, t0.cinema_id, t1.cinema_id from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id join film as t2 on t1.film_id = t2.film_id where t2.title = 'The Case of the Mystery Weekend' or t2.title like '%e Piggy Banker'"
},
"style": "... | {
"index": 1370,
"split": "train"
} | |
Who is the author or tutor with a course whose name contains "t his," and what are their personal name, address, family name, and the course description? Please provide the first such course sorted alphabetically by course description. | e_learning | select t0.personal_name, t0.address_line_1, t0.family_name, t1.course_description as c2 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_name like '%t his%' order by c2 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select t0.personal_name, t0.address_line_1, t0.family_name, t1.course_description as c2 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_name like '%t his%' order by c2 asc nulls last limit 1"
},
"styl... | {
"index": 529,
"split": "train"
} | |
What is the percentage change in the number of customers who filed complaints about product 117 between February 10, 1973, and July 11, 1987? | 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 = 117 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 = 117 and t1.date_complaint_raised = '1973-02-10 22:55:56' group by t... | {
"index": 3413,
"split": "train"
} | |
Did train 9 depart after train 1? | station_weather | select t1.c0 > t0.c0 from (select time as c0 from train where id = 9) as t1, (select time as c0 from train where id = 1) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "station_weather",
"sql": "select t1.c0 > t0.c0 from (select time as c0 from train where id = 9) as t1, (select time as c0 from train where id = 1) as t0"
},
"style": "rule"
} | {
"index": 3098,
"split": "train"
} | |
Which three teams have the highest number of wins in postseason tournaments, and what is the maximum number of wins each achieved, when looking at all postseason appearances? Please list these teams starting with the team with the highest ID in reverse order. | baseball_1 | select team_id_winner as c1, max(wins) from postseason group by c1 order by c1 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select team_id_winner as c1, max(wins) from postseason group by c1 order by c1 desc limit 3"
},
"style": "rule"
} | {
"index": 663,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.