question stringlengths 1 606 | db_id stringclasses 139
values | external_knowledge stringclasses 1
value | sql stringlengths 19 1.35k | data_source stringclasses 1
value | prompt listlengths 2 2 | ability stringclasses 1
value | reward_model dict | extra_info dict |
|---|---|---|---|---|---|---|---|---|
What is the problem ID that ranks seventh when sorting the problems by their highest associated log entry's problem ID, considering only logs assigned to staff with IDs up to 10? | tracking_software_problems | select t1.c4, t1.c2 as c1 from (select row_number() over (order by t0.c3 asc nulls last) as c4, t0.c0 as c2 from (select t0.problem_id as c0, max(t1.problem_id) as c3 from problems as t0 join problem_log as t1 on t0.problem_id = t1.problem_id where t1.assigned_to_staff_id <= 10 group by c0) as t0) as t1 where c1 = 7 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t1.c4, t1.c2 as c1 from (select row_number() over (order by t0.c3 asc nulls last) as c4, t0.c0 as c2 from (select t0.problem_id as c0, max(t1.problem_id) as c3 from problems as t0 join problem_log as t1 on t0.problem_id = t1.problem_id ... | {
"index": 3510,
"split": "train"
} | |
Which ten incident types and corresponding student IDs, for students whose last name includes "ade," are listed with the smallest student IDs? | behavior_monitoring | select t0.incident_type_code, t1.student_id as c1 from behavior_incident as t0 join students as t1 on t0.student_id = t1.student_id where t1.last_name like '%ade%' 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": "behavior_monitoring",
"sql": "select t0.incident_type_code, t1.student_id as c1 from behavior_incident as t0 join students as t1 on t0.student_id = t1.student_id where t1.last_name like '%ade%' order by c1 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 1698,
"split": "train"
} | |
Can you provide the Customer IDs and Names of customers whose phone numbers contain the digit "0" and who also have the phone number "1-446-940-9907x257" on file? | insurance_fnol | select anon_1.c1, anon_1.c0 from (select t0.customer_id as c1, t0.customer_name as c0 from customers as t0 join customers_policies as t1 on t0.customer_id = t1.customer_id join available_policies as t2 on t1.policy_id = t2.policy_id where t2.customer_phone like '%0%' intersect select t0.customer_id as c1, t0.customer_n... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_fnol",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.customer_id as c1, t0.customer_name as c0 from customers as t0 join customers_policies as t1 on t0.customer_id = t1.customer_id join available_policies as t2 on t1.policy_id = t2.policy_id where t2.customer_phon... | {
"index": 153,
"split": "train"
} | |
Did Customer 9 become a customer after Customer 6? | customer_deliveries | select t1.c2 > t0.c2 from (select date_became_customer as c2 from customers where customer_id = 9) as t1, (select date_became_customer as c2 from customers where customer_id = 6) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_deliveries",
"sql": "select t1.c2 > t0.c2 from (select date_became_customer as c2 from customers where customer_id = 9) as t1, (select date_became_customer as c2 from customers where customer_id = 6) as t0"
},
"style": "rule"
} | {
"index": 3072,
"split": "train"
} | |
What are the installation dates and dock counts for the stations with the fewest total records, sorted alphabetically by station name, limited to the first 10? | bike_1 | select t0.installation_date, t0.dock_count from station as t0 join status as t1 on t0.id = t1.station_id, (select station_id as c2 from status group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.station_id = t0.c2 order by t0.name 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": "bike_1",
"sql": "select t0.installation_date, t0.dock_count from station as t0 join status as t1 on t0.id = t1.station_id, (select station_id as c2 from status group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.station_id = t0.c2 order by t0.name asc nulls last ... | {
"index": 1060,
"split": "train"
} | |
Can you tell me how many unique addresses are associated with supplier 4, including the total number of address details, and how many distinct supplier addresses there are for this supplier? | department_store | select count(distinct (t0.address_id)), count(t0.address_details), count(distinct (t1.address_id)) from addresses as t0 join supplier_addresses as t1 on t0.address_id = t1.address_id where t1.supplier_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": "department_store",
"sql": "select count(distinct (t0.address_id)), count(t0.address_details), count(distinct (t1.address_id)) from addresses as t0 join supplier_addresses as t1 on t0.address_id = t1.address_id where t1.supplier_id = 4"
},
"style": "rule"
} | {
"index": 1064,
"split": "train"
} | |
What is the Address ID for the person whose cell mobile number starts with "766-272-99"? | student_assessment | select t0.address_id from people_addresses as t0 join people as t1 on t0.person_id = t1.person_id where t1.cell_mobile_number like '766-272-99%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.address_id from people_addresses as t0 join people as t1 on t0.person_id = t1.person_id where t1.cell_mobile_number like '766-272-99%'"
},
"style": "rule"
} | {
"index": 277,
"split": "train"
} | |
Can you tell me the media type name and ID for the track with ID 342? | store_1 | select distinct t0.name, t0.id from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.id = 342 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct t0.name, t0.id from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.id = 342"
},
"style": "rule"
} | {
"index": 2404,
"split": "train"
} | |
What are the Customer Addresses' Address IDs, Customer IDs, the associated Addresses' Address IDs, and their State Province Counties for customers whose related employees do not have an address in a county ending with "ine" and with address ID 8? | customer_deliveries | select t0.address_id, t0.customer_id, t1.address_id as c3, t1.state_province_county as c0 from customer_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id join employees as t2 on t1.address_id = t2.employee_address_id where (not t2.employee_address_id in (select c3 as c3 from addresses where c0 like ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_deliveries",
"sql": "select t0.address_id, t0.customer_id, t1.address_id as c3, t1.state_province_county as c0 from customer_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id join employees as t2 on t1.address_id = t2.employee_address_id where (not t2... | {
"index": 1321,
"split": "train"
} | |
What are the first 10 parties associated with host ID 3, listed in order of their party IDs, along with the number of times each party appears? | party_host | select party_id as c1, count(distinct (party_id)) from party_host where host_id = 3 group by c1 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": "party_host",
"sql": "select party_id as c1, count(distinct (party_id)) from party_host where host_id = 3 group by c1 order by c1 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 1869,
"split": "train"
} | |
Can you list the activity names and their IDs for activities involving faculty members with IDs greater than or equal to 1121 or with IDs between 1082 and 8721, sorted alphabetically by activity name? | activity_1 | select t0.activity_name as c0 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.facid >= 1121 or t1.facid between 1082 and 8721 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": "activity_1",
"sql": "select t0.activity_name as c0 from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.facid >= 1121 or t1.facid between 1082 and 8721 order by c0 asc nulls last"
},
"style": "rule"
} | {
"index": 515,
"split": "train"
} | |
What are the Service Type Code and Service ID for the services linked to the resident with the fewest services or to resident 88? | local_govt_and_lot | select t0.service_type_code from services as t0 join residents_services as t1 on t0.service_id = t1.service_id, (select resident_id as c1 from residents_services group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.resident_id = t0.c1 or t1.resident_id = 88 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.service_type_code from services as t0 join residents_services as t1 on t0.service_id = t1.service_id, (select resident_id as c1 from residents_services group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.resident_id = t0.c1 ... | {
"index": 2403,
"split": "train"
} | |
Which are the ten most recent user accounts, including their user IDs and names, that have submitted reviews for items whose titles contain "cu" or end with "ple", along with the ratings of those reviews? | epinions_1 | select t0.u_id as c2, t0.name, t1.rating from useracct as t0 join review as t1 on t0.u_id = t1.u_id join item as t2 on t1.i_id = t2.i_id where t2.title like '%cu%' or t2.title like '%ple' order by c2 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select t0.u_id as c2, t0.name, t1.rating from useracct as t0 join review as t1 on t0.u_id = t1.u_id join item as t2 on t1.i_id = t2.i_id where t2.title like '%cu%' or t2.title like '%ple' order by c2 desc limit 10"
},
"style": "rule"
} | {
"index": 731,
"split": "train"
} | |
Who is the male artist whose name ends with "chel" that comes last alphabetically, and what country are they from? | music_1 | select artist_name as c1, country from artist where gender = 'Male' and c1 like '%chel' 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": "music_1",
"sql": "select artist_name as c1, country from artist where gender = 'Male' and c1 like '%chel' order by c1 desc limit 1"
},
"style": "rule"
} | {
"index": 398,
"split": "train"
} | |
What is the number of staff and the count of unique performance scores for each shop that opened in a year containing "20"? | coffee_shop | select num_of_staff as c1, count(distinct (score)) from shop where open_year like '%20%' 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": "coffee_shop",
"sql": "select num_of_staff as c1, count(distinct (score)) from shop where open_year like '%20%' group by c1"
},
"style": "rule"
} | {
"index": 388,
"split": "train"
} | |
What are the location, product, OMIM number, and enzyme ID for enzymes that interact with medicines which are either not FDA approved or have the most frequently assigned FDA approval status? | medicine_enzyme_interaction | select t0.location, t0.product, t0.omim, t1.enzyme_id from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id join medicine as t2 on t1.medicine_id = t2.id, (select fda_approved as c3 from medicine group by c3 order by count(*) desc limit 1) as t0 where t2.fda_approved like '%No' or t2.fda_appr... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.location, t0.product, t0.omim, t1.enzyme_id from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id join medicine as t2 on t1.medicine_id = t2.id, (select fda_approved as c3 from medicine group by c3 order b... | {
"index": 357,
"split": "train"
} | |
What are the three products available at store number 2, along with their pages per minute color, sorted by the highest pages per minute color? | store_product | select t0.product, t0.pages_per_minute_color as c0 from product as t0 join store_product as t1 on t0.product_id = t1.product_id where t1.store_id = 2 order by c0 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_product",
"sql": "select t0.product, t0.pages_per_minute_color as c0 from product as t0 join store_product as t1 on t0.product_id = t1.product_id where t1.store_id = 2 order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 2681,
"split": "train"
} | |
Which courses are associated with persons whose IDs are less than 141, along with the course for the person with ID 141? Please list the Course ID and Course Name for these courses. | student_assessment | select anon_1.c0, anon_1.c1 from (select t0.course_id as c0, t0.course_name as c1 from courses as t0 join student_course_registrations as t1 on t0.course_id = t1.course_id join students as t2 on t1.student_id = t2.student_id join people as t3 on t2.student_id = t3.person_id join people_addresses as t4 on t3.person_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": "student_assessment",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.course_id as c0, t0.course_name as c1 from courses as t0 join student_course_registrations as t1 on t0.course_id = t1.course_id join students as t2 on t1.student_id = t2.student_id join people as t3 on t2.st... | {
"index": 1654,
"split": "train"
} | |
Among courses with at most three sections, which course has the department name last in alphabetical order, and what are its title and course ID? If there's a tie, select the one with the most sections. | college_2 | select t0.title, t0.course_id as c0 from course as t0 join section as t1 on t0.course_id = t1.course_id, (select course_id as c1 from section group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.course_id = t0.c1 group by c0 having count(*) <= 3 order by t0.dept_name desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_2",
"sql": "select t0.title, t0.course_id as c0 from course as t0 join section as t1 on t0.course_id = t1.course_id, (select course_id as c1 from section group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.course_id = t0.c1 group by c0 having count(*) <= ... | {
"index": 1224,
"split": "train"
} | |
What is the name of the first medicine, alphabetically, that interacts with enzyme number 6? | medicine_enzyme_interaction | select t0.name as c0 from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.enzyme_id = 6 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": "medicine_enzyme_interaction",
"sql": "select t0.name as c0 from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.enzyme_id = 6 order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 1121,
"split": "train"
} | |
How much more savings does customer 1 have compared to customer 5? | small_bank_1 | select t1.c0 - t0.c0 from (select balance as c0 from savings where custid = 5) as t1, (select balance as c0 from savings where custid = 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": "small_bank_1",
"sql": "select t1.c0 - t0.c0 from (select balance as c0 from savings where custid = 5) as t1, (select balance as c0 from savings where custid = 1) as t0"
},
"style": "rule"
} | {
"index": 3622,
"split": "train"
} | |
Which are the three incident types, with descriptions containing "Disturbance," that have the highest average Student ID, and what are their average Student ID values? | behavior_monitoring | select avg(t0.student_id) as c1, t1.incident_type_code as c0 from behavior_incident as t0 join ref_incident_type as t1 on t0.incident_type_code = t1.incident_type_code where t1.incident_type_description like '%Disturbance' group by c0 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": "behavior_monitoring",
"sql": "select avg(t0.student_id) as c1, t1.incident_type_code as c0 from behavior_incident as t0 join ref_incident_type as t1 on t0.incident_type_code = t1.incident_type_code where t1.incident_type_description like '%Disturbance' group by c0 order by c1 des... | {
"index": 2238,
"split": "train"
} | |
For web client accelerators compatible with browsers since 2005 or earlier, which accelerator's name and ID is associated with the browser that has the highest average compatible since year, and among those, shows the most recent maximum compatible year? | browser_web | select t0.name, t0.id as c0 from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id, (select browser_id as c1 from accelerator_compatible_browser group by c1 order by avg(compatible_since_year) desc limit 1) as t0 where t1.compatible_since_year <= 2005 and t1.browser_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": "browser_web",
"sql": "select t0.name, t0.id as c0 from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id, (select browser_id as c1 from accelerator_compatible_browser group by c1 order by avg(compatible_since_year) desc limit 1) a... | {
"index": 1790,
"split": "train"
} | |
Which movies have their title, release year, and director information in common with movies reviewed by someone whose name includes "Whi"? | movie_1 | select anon_1.c0, anon_1.c1, anon_1.c2 from (select title as c0, year as c1, director as c2 from movie intersect select t0.title as c0, t0.year as c1, t0.director as c2 from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid where t2.name like '%Whi%') as anon_1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "movie_1",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select title as c0, year as c1, director as c2 from movie intersect select t0.title as c0, t0.year as c1, t0.director as c2 from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid ... | {
"index": 957,
"split": "train"
} | |
What is the price, ID, and total number of appearances in regular orders for each product with an ID less than or equal to 5 or greater than 1? | customer_deliveries | select t0.product_price, t0.product_id as c1, sum(t1.product_id) from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t1.product_id <= 5 or t1.product_id > 1 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": "customer_deliveries",
"sql": "select t0.product_price, t0.product_id as c1, sum(t1.product_id) from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t1.product_id <= 5 or t1.product_id > 1 group by c1"
},
"style": "rule"
} | {
"index": 22,
"split": "train"
} | |
What are the customer IDs, booking end dates, and refund amounts for all bookings, including those that are for the product with ID 4? | products_for_hire | select anon_1.c1, anon_1.c0, anon_1.c2 from (select customer_id as c1, booking_end_date as c0, amount_of_refund as c2 from bookings union select t0.customer_id as c1, t0.booking_end_date as c0, t0.amount_of_refund as c2 from bookings as t0 join products_booked as t1 on t0.booking_id = t1.booking_id join products_for_hi... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c1, anon_1.c0, anon_1.c2 from (select customer_id as c1, booking_end_date as c0, amount_of_refund as c2 from bookings union select t0.customer_id as c1, t0.booking_end_date as c0, t0.amount_of_refund as c2 from bookings as t0 join product... | {
"index": 235,
"split": "train"
} | |
Which tracks have either been open since 1968 or earlier, or opened more recently than the number of unique years in which tracks with seating exactly 63,000 or less than 92,000 opened? For these tracks, what are their names and track IDs? | race_track | select distinct t0.name, t0.track_id from track as t0, (select count(distinct (year_opened)) as c0 from track where seating = 63000.0 or seating < 92000.0) as t0 where t0.year_opened > t0.c0 or t0.year_opened <= 1968.0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "race_track",
"sql": "select distinct t0.name, t0.track_id from track as t0, (select count(distinct (year_opened)) as c0 from track where seating = 63000.0 or seating < 92000.0) as t0 where t0.year_opened > t0.c0 or t0.year_opened <= 1968.0"
},
"style": "rule"
} | {
"index": 2695,
"split": "train"
} | |
Find the personal names and author IDs of course authors and tutors who have taught courses with students whose latest logon date was on or before January 10, 2018. | e_learning | select anon_1.c1, anon_1.c0 from (select personal_name as c1, author_id as c0 from course_authors_and_tutors intersect select t0.personal_name as c1, t0.author_id as c0 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id join student_course_enrolment as t2 on t1.course_id = t2.course_... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c1, anon_1.c0 from (select personal_name as c1, author_id as c0 from course_authors_and_tutors intersect select t0.personal_name as c1, t0.author_id as c0 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id joi... | {
"index": 2203,
"split": "train"
} | |
What are the student IDs and department numbers of students who have minors in departments taught by faculty with facid 6191, and what are the phone numbers of those departments? | college_3 | select t0.stuid, t0.dno, t1.dphone from minor_in as t0 join department as t1 on t0.dno = t1.dno join course as t2 on t1.dno = t2.dno join faculty as t3 on t2.instructor = t3.facid where t3.facid = 6191 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_3",
"sql": "select t0.stuid, t0.dno, t1.dphone from minor_in as t0 join department as t1 on t0.dno = t1.dno join course as t2 on t1.dno = t2.dno join faculty as t3 on t2.instructor = t3.facid where t3.facid = 6191"
},
"style": "rule"
} | {
"index": 2749,
"split": "train"
} | |
When was the most recent document prepared for the project with the highest project ID among those whose document names start with "Revie"? | cre_Docs_and_Epenses | select t0.document_date, t0.project_id as c3 from documents as t0, (select max(project_id) as c2 from documents where document_name like 'Revie%') as t1 where c3 = 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": "cre_Docs_and_Epenses",
"sql": "select t0.document_date, t0.project_id as c3 from documents as t0, (select max(project_id) as c2 from documents where document_name like 'Revie%') as t1 where c3 = t1.c2"
},
"style": "rule"
} | {
"index": 3752,
"split": "train"
} | |
Which program, broadcast on a channel owned by Anhui Television or a channel whose owner name includes "S," has the earliest Program ID? Please provide the Program ID and owner, along with the broadcast time of day and the Program ID of that broadcast. | program_share | select t0.program_id, t0.owner, t1.time_of_day, t1.program_id as c0 from program as t0 join broadcast as t1 on t0.program_id = t1.program_id join channel as t2 on t1.channel_id = t2.channel_id where t2.owner = 'Anhui Television' or t2.owner like '%S%' 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": "program_share",
"sql": "select t0.program_id, t0.owner, t1.time_of_day, t1.program_id as c0 from program as t0 join broadcast as t1 on t0.program_id = t1.program_id join channel as t2 on t1.channel_id = t2.channel_id where t2.owner = 'Anhui Television' or t2.owner like '%S%' orde... | {
"index": 821,
"split": "train"
} | |
How many days passed between the Date From and Date To for customer with ID 12 in their address history? | customers_and_products_contacts | select julianday(t1.c2) - julianday(t0.c0) from (select date_to as c2 from customer_address_history) as t1, (select date_from as c0 from customer_address_history where customer_id = 12 and customer_id = 12) 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.c2) - julianday(t0.c0) from (select date_to as c2 from customer_address_history) as t1, (select date_from as c0 from customer_address_history where customer_id = 12 and customer_id = 12) as t0"
},
"style": "rule"
} | {
"index": 3864,
"split": "train"
} | |
Is the smallest total value purchased by supplier 1 higher than the smallest total value purchased among suppliers with the phone number 287-071-1153x254? | department_store | select t2.c2 > t1.c1 from (select min(t1.total_value_purchased) as c2 from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id where t0.supplier_id = 1 group by t0.supplier_id) as t2, (select min(t0.c2) as c1 from (select min(t1.total_value_purchased) as c2 from suppliers as t0 join product_... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c2 > t1.c1 from (select min(t1.total_value_purchased) as c2 from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id where t0.supplier_id = 1 group by t0.supplier_id) as t2, (select min(t0.c2) as c1 from (select min... | {
"index": 3270,
"split": "train"
} | |
What are the smallest and largest IDs of aircraft associated with airport ID 2? | aircraft | select min(id), max(id) from airport_aircraft where airport_id = 2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "aircraft",
"sql": "select min(id), max(id) from airport_aircraft where airport_id = 2"
},
"style": "rule"
} | {
"index": 3633,
"split": "train"
} | |
Which aircrafts have pilots with nationality either containing "United St" or exactly "United States," and among these, which one has the highest aircraft ID? Show the fleet series, model, and aircraft ID of that aircraft. | pilot_record | select t0.fleet_series, t0.model, t0.aircraft_id as c2 from aircraft as t0 join pilot_record as t1 on t0.aircraft_id = t1.aircraft_id join pilot as t2 on t1.pilot_id = t2.pilot_id where t2.nationality like '%United St%' or t2.nationality = 'United States' order by c2 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "pilot_record",
"sql": "select t0.fleet_series, t0.model, t0.aircraft_id as c2 from aircraft as t0 join pilot_record as t1 on t0.aircraft_id = t1.aircraft_id join pilot as t2 on t1.pilot_id = t2.pilot_id where t2.nationality like '%United St%' or t2.nationality = 'United States' o... | {
"index": 1557,
"split": "train"
} | |
Which manufacturer IDs, number of factories, and names are associated with manufacturers that do not produce any furniture with five or fewer components? | manufacturer | select anon_1.c0, anon_1.c2, anon_1.c1 from (select manufacturer_id as c0, num_of_factories as c2, name as c1 from manufacturer except select t0.manufacturer_id as c0, t0.num_of_factories as c2, t0.name as c1 from manufacturer as t0 join furniture_manufacte as t1 on t0.manufacturer_id = t1.manufacturer_id join furnitur... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "manufacturer",
"sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select manufacturer_id as c0, num_of_factories as c2, name as c1 from manufacturer except select t0.manufacturer_id as c0, t0.num_of_factories as c2, t0.name as c1 from manufacturer as t0 join furniture_manufacte... | {
"index": 714,
"split": "train"
} | |
What is the difference between 15 and the smallest apartment ID booked by guest 2? | apartment_rentals | select t0.c0 - 15 from (select min(t1.apt_id) as c0 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where t0.guest_id = 2 group by t0.guest_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": "apartment_rentals",
"sql": "select t0.c0 - 15 from (select min(t1.apt_id) as c0 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where t0.guest_id = 2 group by t0.guest_id) as t0"
},
"style": "rule"
} | {
"index": 3208,
"split": "train"
} | |
What is the total catalog level number and latest revision date for each catalog that has attribute IDs all at least 2? | product_catalog | select sum(t0.catalog_level_number), t2.date_of_latest_revision from catalog_contents_additional_attributes as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number join catalogs as t2 on t1.catalog_id = t2.catalog_id group by t2.catalog_id having min(t0.attribute_id) >= 2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "product_catalog",
"sql": "select sum(t0.catalog_level_number), t2.date_of_latest_revision from catalog_contents_additional_attributes as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number join catalogs as t2 on t1.catalog_id = t2.catalog_id group... | {
"index": 2330,
"split": "train"
} | |
What are the description and code of the least frequently recorded incident type, and what is the average student ID for incidents of that type? | behavior_monitoring | select t0.incident_type_description, t0.incident_type_code as c0, avg(t1.student_id) from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code, (select incident_type_code as c1 from behavior_incident group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.in... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "behavior_monitoring",
"sql": "select t0.incident_type_description, t0.incident_type_code as c0, avg(t1.student_id) from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code, (select incident_type_code as c1 from behavior_incident g... | {
"index": 1878,
"split": "train"
} | |
What was the arrival date and highest price of flights heading to Washington D.C., where the price was at its maximum? | flight_1 | select t0.arrival_date, t0.price as c0 from flight as t0, (select max(price) as c3 from flight where destination like 'Washington D.C%') as t1 where c0 = t1.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": "flight_1",
"sql": "select t0.arrival_date, t0.price as c0 from flight as t0, (select max(price) as c3 from flight where destination like 'Washington D.C%') as t1 where c0 = t1.c3"
},
"style": "rule"
} | {
"index": 3840,
"split": "train"
} | |
Can you tell me the bottom three records (based on year) for counties with zip codes starting with "D", specifically for the county that has the fewest unique population counts? For each of these records, I want to know the year, the name of the comptroller, the lieutenant governor, and the committee involved. | election | select t0.year as c2, t0.comptroller, t0.lieutenant_governor, t1.committee from party as t0 join election as t1 on t0.party_id = t1.party join county as t2 on t1.district = t2.county_id, (select county_id as c1 from county group by c1 order by count(distinct (population)) asc nulls last limit 1) as t0 where t2.zip_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": "election",
"sql": "select t0.year as c2, t0.comptroller, t0.lieutenant_governor, t1.committee from party as t0 join election as t1 on t0.party_id = t1.party join county as t2 on t1.district = t2.county_id, (select county_id as c1 from county group by c1 order by count(distinct (p... | {
"index": 1015,
"split": "train"
} | |
Which three enzymes that interact with the medicine named Sulpirid (and whose name contains the letter "i") are located at specific locations, and what are their names, chromosomal positions, and cellular locations? | medicine_enzyme_interaction | select t0.name, t0.chromosome, t0.location as c2 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id join medicine as t2 on t1.medicine_id = t2.id where t2.trade_name = 'Sulpirid' and t2.name like '%i%' 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": "medicine_enzyme_interaction",
"sql": "select t0.name, t0.chromosome, t0.location as c2 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id join medicine as t2 on t1.medicine_id = t2.id where t2.trade_name = 'Sulpirid' and t2.name like '%i%' order by c... | {
"index": 1106,
"split": "train"
} | |
When was the hire date of the employee who had the highest manager ID in the organization? | hr_1 | select t0.hire_date, t0.manager_id as c3 from employees as t0, (select max(manager_id) as c0 from employees) as t1 where c3 = t1.c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "hr_1",
"sql": "select t0.hire_date, t0.manager_id as c3 from employees as t0, (select max(manager_id) as c0 from employees) as t1 where c3 = t1.c0"
},
"style": "rule"
} | {
"index": 3780,
"split": "train"
} | |
What are the start times and appointment IDs, along with the patients, for appointments where the patient has been prescribed medication with brand X and code 1? | hospital_1 | select t0.start, t0.appointmentid, t2.patient from appointment as t0 join patient as t1 on t0.patient = t1.ssn join prescribes as t2 on t1.ssn = t2.patient join medication as t3 on t2.medication = t3.code where t3.brand = 'X' and t3.code = 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": "hospital_1",
"sql": "select t0.start, t0.appointmentid, t2.patient from appointment as t0 join patient as t1 on t0.patient = t1.ssn join prescribes as t2 on t1.ssn = t2.patient join medication as t3 on t2.medication = t3.code where t3.brand = 'X' and t3.code = 1"
},
"style": ... | {
"index": 13,
"split": "train"
} | |
Which stations are served by train number 10 but are not served by the station with station ID 8? Please provide their station IDs, locations, and the number of platforms each station has. | train_station | select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.station_id as c2, t0.location as c1, t0.number_of_platforms as c0 from station as t0 join train_station as t1 on t0.station_id = t1.station_id where t1.train_id = 10 except select t0.station_id as c2, t0.location as c1, t0.number_of_platforms as c0 from station as ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "train_station",
"sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.station_id as c2, t0.location as c1, t0.number_of_platforms as c0 from station as t0 join train_station as t1 on t0.station_id = t1.station_id where t1.train_id = 10 except select t0.station_id as c2, ... | {
"index": 1750,
"split": "train"
} | |
How many assets have an acquisition date recorded, and how many maintenance contracts are there, excluding those contracts associated with the third-party company named Schuppe-Carroll with company ID 2? | assets_maintenance | select count(t0.asset_acquired_date), count(t1.maintenance_contract_id) from assets as t0 join maintenance_contracts as t1 on t0.maintenance_contract_id = t1.maintenance_contract_id where (not t1.maintenance_contract_company_id in (select third_party_companies.company_id as c0 from third_party_companies where third_par... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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(t0.asset_acquired_date), count(t1.maintenance_contract_id) from assets as t0 join maintenance_contracts as t1 on t0.maintenance_contract_id = t1.maintenance_contract_id where (not t1.maintenance_contract_company_id in (select third_party_... | {
"index": 175,
"split": "train"
} | |
Looking at the campuses listed in reverse alphabetical order, which three campuses have the most recorded years of data? | csu_1 | select count(year) from campuses group by campus order by campus 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": "csu_1",
"sql": "select count(year) from campuses group by campus order by campus desc limit 3"
},
"style": "rule"
} | {
"index": 1926,
"split": "train"
} | |
For each claim, find the claim ID, the total number of records associated with that claim, and the number of times the claim date was recorded. List the three claims with the highest claim IDs, showing these details. | insurance_policies | select claim_id as c1, count(*), count(date_claim_made) from claims group by c1 order by c1 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_policies",
"sql": "select claim_id as c1, count(*), count(date_claim_made) from claims group by c1 order by c1 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 2243,
"split": "train"
} | |
Which players, who tried out most frequently at colleges whose names include the letter "U," have yellow card counts recorded, but who did not try out for any positions with "id" in their name? | soccer_2 | select anon_1.c0, anon_1.c2 from (select t0.pname as c0, t0.ycard as c2 from player as t0 join tryout as t1 on t0.pid = t1.pid, (select pid as c1 from tryout where cname like '%U%' group by c1 order by count(*) desc limit 1) as t1 where t1.pid = t1.c1 except select t0.pname as c0, t0.ycard as c2 from player as t0 join ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "soccer_2",
"sql": "select anon_1.c0, anon_1.c2 from (select t0.pname as c0, t0.ycard as c2 from player as t0 join tryout as t1 on t0.pid = t1.pid, (select pid as c1 from tryout where cname like '%U%' group by c1 order by count(*) desc limit 1) as t1 where t1.pid = t1.c1 except se... | {
"index": 2960,
"split": "train"
} | |
What is the CMI cross-reference ID for the benefits overpayment record linked to the council tax ID 3? | local_govt_mdm | select cmi_cross_ref_id from benefits_overpayments where council_tax_id = 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": "local_govt_mdm",
"sql": "select cmi_cross_ref_id from benefits_overpayments where council_tax_id = 3"
},
"style": "rule"
} | {
"index": 3385,
"split": "train"
} | |
How does the organization with 7 unique services rank among all organizations when they are ordered from the one with the most services to the least? | local_govt_and_lot | select t1.c1, t1.c4 as c2 from (select row_number() over (order by t0.c3 desc) as c1, t0.c5 as c4 from (select t0.organization_id as c5, count(distinct (t1.service_id)) as c3 from organizations as t0 join services as t1 on t0.organization_id = t1.organization_id group by c5) as t0) as t1 where c2 = 7 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_and_lot",
"sql": "select t1.c1, t1.c4 as c2 from (select row_number() over (order by t0.c3 desc) as c1, t0.c5 as c4 from (select t0.organization_id as c5, count(distinct (t1.service_id)) as c3 from organizations as t0 join services as t1 on t0.organization_id = t1.orga... | {
"index": 3489,
"split": "train"
} | |
Which race events took place at tracks opened between 1947 and 1997, and have the same track ID and date as races at those tracks? | race_track | select anon_1.c1, anon_1.c0 from (select track_id as c1, date as c0 from race intersect select t0.track_id as c1, t0.date as c0 from race as t0 join track as t1 on t0.track_id = t1.track_id where t1.year_opened between 1947.0 and 1997.0) as anon_1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "race_track",
"sql": "select anon_1.c1, anon_1.c0 from (select track_id as c1, date as c0 from race intersect select t0.track_id as c1, t0.date as c0 from race as t0 join track as t1 on t0.track_id = t1.track_id where t1.year_opened between 1947.0 and 1997.0) as anon_1"
},
"st... | {
"index": 1832,
"split": "train"
} | |
Which flights operated by the cargo company with the highest total group equity shareholding (not exceeding 100%), and what are their IDs, vehicle flight numbers, and airport IDs? | flight_company | select t0.id, t0.vehicle_flight_number, t0.airport_id from flight as t0 join operate_company as t1 on t0.company_id = t1.id, (select name as c2 from operate_company where principal_activities = 'Cargo' and group_equity_shareholding <= 100.0 group by c2 order by sum(group_equity_shareholding) desc limit 1) as t0 where t... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_company",
"sql": "select t0.id, t0.vehicle_flight_number, t0.airport_id from flight as t0 join operate_company as t1 on t0.company_id = t1.id, (select name as c2 from operate_company where principal_activities = 'Cargo' and group_equity_shareholding <= 100.0 group by c2 or... | {
"index": 2874,
"split": "train"
} | |
Which catalog structure with catalog ID of 2 or less has the highest combined total of next entry IDs among those that are at the least common catalog level name? Also, what is that total, and what is the smallest catalog level number associated with it? | product_catalog | select sum(t0.next_entry_id) as c0, min(t0.catalog_level_number), t1.catalog_level_number as c1 from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number, (select catalog_level_name as c3 from catalog_structure group by c3 order by count(*) asc nulls last limit 1) as ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "product_catalog",
"sql": "select sum(t0.next_entry_id) as c0, min(t0.catalog_level_number), t1.catalog_level_number as c1 from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number, (select catalog_level_name as c3 from catalog_s... | {
"index": 2833,
"split": "train"
} | |
For each order quantity associated with product 5, what are the quantities and the smallest order ID for each? | customers_and_products_contacts | select order_quantity as c1, min(order_id) from order_items where product_id = 5 group by c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_products_contacts",
"sql": "select order_quantity as c1, min(order_id) from order_items where product_id = 5 group by c1"
},
"style": "rule"
} | {
"index": 15,
"split": "train"
} | |
Show the floors, height in feet, and street address for up to five buildings that have fewer than 17 floors or 22 or fewer floors, ordered by street address with any nulls appearing last. | protein_institute | select floors as c2, height_feet, street_address as c0 from building where c2 < 17 or c2 <= 22 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": "protein_institute",
"sql": "select floors as c2, height_feet, street_address as c0 from building where c2 < 17 or c2 <= 22 order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 1742,
"split": "train"
} | |
What was the percentage increase or decrease in the number of unique purchase transactions from October 8, 1985, to December 2, 1990? | tracking_share_transactions | select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select count(distinct (t1.transaction_id)) 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 = '1985-10-08 13:13:39' group by t0.tran... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select count(distinct (t1.transaction_id)) 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_co... | {
"index": 3427,
"split": "train"
} | |
For colors with fewer than five associated products that have a typical buying price starting with "339404," what are the top three colors and their codes when listed in reverse alphabetical order by color description? | products_gen_characteristics | select t0.color_description as c0, t0.color_code as c1 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.typical_buying_price like '339404%' group by c1 having count(*) < 5 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": "products_gen_characteristics",
"sql": "select t0.color_description as c0, t0.color_code as c1 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.typical_buying_price like '339404%' group by c1 having count(*) < 5 order by c0 desc limit 3"
},
"... | {
"index": 653,
"split": "train"
} | |
What are the Attribute Values, Attribute IDs, and Catalog Level Numbers for catalog entries at the 'Sub-Category' or 'Category' levels? | product_catalog | select t0.attribute_value, t0.attribute_id, t0.catalog_level_number from catalog_contents_additional_attributes as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_level_name = 'Sub-Category' or t1.catalog_level_name = 'Category' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "product_catalog",
"sql": "select t0.attribute_value, t0.attribute_id, t0.catalog_level_number from catalog_contents_additional_attributes as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_level_name = 'Sub-Category' or t1.cat... | {
"index": 2313,
"split": "train"
} | |
How many people participated in debates? | debate | select count(*) from debate_people | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "debate",
"sql": "select count(*) from debate_people"
},
"style": "rule"
} | {
"index": 2200,
"split": "train"
} | |
How many days elapsed between the Date Assigned From and Date Assigned To for the staff department assignment that occurred on 2018-03-24 at 07:04:28? | department_store | select julianday(t1.c3) - julianday(t0.c0) from (select date_assigned_to as c3 from staff_department_assignments where c3 = '2018-03-24 07:04:28' and c3 = '2018-03-24 07:04:28') as t1, (select date_assigned_from as c0 from staff_department_assignments) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select julianday(t1.c3) - julianday(t0.c0) from (select date_assigned_to as c3 from staff_department_assignments where c3 = '2018-03-24 07:04:28' and c3 = '2018-03-24 07:04:28') as t1, (select date_assigned_from as c0 from staff_department_assignments) ... | {
"index": 3703,
"split": "train"
} | |
What is the difference between the number of unique documents of type "Hard Drive" shipped through agents with codes containing "L" and the highest number of unique documents across all document types? | cre_Doc_Control_Systems | select t2.c0 - t0.c2 from (select max(t1.c2) as c0 from (select count(distinct (t1.document_id)) as c2 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code group by t0.document_type_code) as t1) as t2, (select t0.document_type_code, count(distinct (t1.document_id)) as c2 f... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c0 - t0.c2 from (select max(t1.c2) as c0 from (select count(distinct (t1.document_id)) as c2 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code group by t0.document_type_code) as t1) as t... | {
"index": 3877,
"split": "train"
} | |
Can you list the names and IDs of up to three subjects that have courses authored by individuals with author IDs of 9 or less, sorted alphabetically by subject name? | e_learning | select t0.subject_name as c1, t0.subject_id from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.author_id <= 9 order by c1 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select t0.subject_name as c1, t0.subject_id from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.author_id <= 9 order by c1 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 199,
"split": "train"
} | |
Did the registration date for student 141 in course 301 happen after their previous registration in the same course? | student_assessment | select registration_date > registration_date from student_course_registrations where student_id = 141 and course_id = 301 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 registration_date > registration_date from student_course_registrations where student_id = 141 and course_id = 301"
},
"style": "rule"
} | {
"index": 3102,
"split": "train"
} | |
Which document type code, document name, date stored, and document ID are recorded in the All Documents table, excluding those documents whose type code begins with "RV"? | cre_Doc_Tracking_DB | select anon_1.c3, anon_1.c1, anon_1.c2, anon_1.c0 from (select document_type_code as c3, document_name as c1, date_stored as c2, document_id as c0 from all_documents except select t0.document_type_code as c3, t0.document_name as c1, t0.date_stored as c2, t0.document_id as c0 from all_documents as t0 join ref_document_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": "cre_Doc_Tracking_DB",
"sql": "select anon_1.c3, anon_1.c1, anon_1.c2, anon_1.c0 from (select document_type_code as c3, document_name as c1, date_stored as c2, document_id as c0 from all_documents except select t0.document_type_code as c3, t0.document_name as c1, t0.date_stored as... | {
"index": 579,
"split": "train"
} | |
Can you list the top 5 players, showing their age, school ID, and name, along with the school's denomination and name, for schools whose division ends with "vision 2"? The list should be sorted alphabetically by the school's name. | school_player | select t0.age, t0.school_id, t0.player, t1.denomination, t1.school as c0 from player as t0 join school as t1 on t0.school_id = t1.school_id join school_details as t2 on t1.school_id = t2.school_id where t2.division like '%vision 2' 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": "school_player",
"sql": "select t0.age, t0.school_id, t0.player, t1.denomination, t1.school as c0 from player as t0 join school as t1 on t0.school_id = t1.school_id join school_details as t2 on t1.school_id = t2.school_id where t2.division like '%vision 2' order by c0 asc nulls la... | {
"index": 999,
"split": "train"
} | |
Can you tell me the latest 10 log entry dates and their corresponding log IDs for problems reported before October 5th, 2010, and sort these results by the staff member who reported the problem in descending order? | tracking_software_problems | select t0.log_entry_date, t0.problem_log_id from problem_log as t0 join problems as t1 on t0.problem_id = t1.problem_id where t1.date_problem_reported < '2010-10-05 02:25:37' order by t1.reported_by_staff_id 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_software_problems",
"sql": "select t0.log_entry_date, t0.problem_log_id from problem_log as t0 join problems as t1 on t0.problem_id = t1.problem_id where t1.date_problem_reported < '2010-10-05 02:25:37' order by t1.reported_by_staff_id desc limit 10"
},
"style": "rul... | {
"index": 1018,
"split": "train"
} | |
What are the transaction type codes, share counts, transaction IDs, and the investor IDs and details of investors who have lots with details exactly equal to 'z' or containing the letter 's'? | tracking_share_transactions | select t0.transaction_type_code, t0.share_count, t0.transaction_id, t2.investor_id, t2.investor_details from transactions as t0 join transactions_lots as t1 on t0.transaction_id = t1.transaction_id join investors as t2 on t0.investor_id = t2.investor_id join lots as t3 on t2.investor_id = t3.investor_id where t3.lot_de... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select t0.transaction_type_code, t0.share_count, t0.transaction_id, t2.investor_id, t2.investor_details from transactions as t0 join transactions_lots as t1 on t0.transaction_id = t1.transaction_id join investors as t2 on t0.investor_id = t2.... | {
"index": 2539,
"split": "train"
} | |
On which date was the largest payment made after February 16, 2018? | insurance_policies | select t0.date_payment_made, t0.amount_payment as c2 from payments as t0, (select max(amount_payment) as c1 from payments where date_payment_made > '2018-02-16 00:00:00') as t1 where c2 = t1.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_policies",
"sql": "select t0.date_payment_made, t0.amount_payment as c2 from payments as t0, (select max(amount_payment) as c1 from payments where date_payment_made > '2018-02-16 00:00:00') as t1 where c2 = t1.c1"
},
"style": "rule"
} | {
"index": 3916,
"split": "train"
} | |
How much is the average customer ID for party 3 below or above 13? | e_government | select t0.c1 - 13.0 from (select avg(t1.customer_id) as c1 from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t0.party_id = 3 group by t0.party_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_government",
"sql": "select t0.c1 - 13.0 from (select avg(t1.customer_id) as c1 from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t0.party_id = 3 group by t0.party_id) as t0"
},
"style": "rule"
} | {
"index": 3233,
"split": "train"
} | |
Can you tell me the artist IDs and album titles for albums that have tracks longer than 3 minutes and 13 seconds, with the tracks belonging to genres numbered between 12 and 17? | store_1 | select t0.artist_id, t0.title from albums as t0 join tracks as t1 on t0.id = t1.album_id where t1.milliseconds > 193253 and t1.genre_id between 12 and 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": "store_1",
"sql": "select t0.artist_id, t0.title from albums as t0 join tracks as t1 on t0.id = t1.album_id where t1.milliseconds > 193253 and t1.genre_id between 12 and 17"
},
"style": "rule"
} | {
"index": 2732,
"split": "train"
} | |
Which Drivers or Teams participated in the race with ID 545, and how many different years did they appear in? | formula_1 | select name as c0, count(distinct (year)) from races where raceid = 545 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": "formula_1",
"sql": "select name as c0, count(distinct (year)) from races where raceid = 545 group by c0"
},
"style": "rule"
} | {
"index": 2434,
"split": "train"
} | |
What are the ten most recent election dates involving representatives with IDs less than 7, and how many unique dates are associated with each? | election_representative | select date as c1, count(distinct (date)) from election where representative_id < 7 group by c1 order by c1 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "election_representative",
"sql": "select date as c1, count(distinct (date)) from election where representative_id < 7 group by c1 order by c1 desc limit 10"
},
"style": "rule"
} | {
"index": 621,
"split": "train"
} | |
What are the Product IDs, dates when complaints were raised, complaint type codes, and email addresses of staff members who have staff IDs of 117 or 115? | customer_complaints | select t0.product_id, t0.date_complaint_raised, t0.complaint_type_code, t1.email_address from complaints as t0 join staff as t1 on t0.staff_id = t1.staff_id where t1.staff_id = 117 or t1.staff_id = 115 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_id, t0.date_complaint_raised, t0.complaint_type_code, t1.email_address from complaints as t0 join staff as t1 on t0.staff_id = t1.staff_id where t1.staff_id = 117 or t1.staff_id = 115"
},
"style": "rule"
} | {
"index": 2120,
"split": "train"
} | |
What are the names of the top 10 catalog entries and their level numbers where the catalog level name contains "go", sorted from the highest to the lowest catalog level number? | product_catalog | select t0.catalog_entry_name, t1.catalog_level_number as c0 from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_level_name like '%go%' 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": "product_catalog",
"sql": "select t0.catalog_entry_name, t1.catalog_level_number as c0 from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.catalog_level_name like '%go%' order by c0 desc limit 10"
},
"style": "... | {
"index": 100,
"split": "train"
} | |
How many unique mailshot customer records are associated with the customer who has the phone number 205.496.0690x53058, and what is this customer's name and ID? | customers_campaigns_ecommerce | select count(distinct (t0.customer_id)), t1.customer_name, t1.customer_id as c2 from mailshot_customers as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.customer_phone = '205.496.0690x53058' group by c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_campaigns_ecommerce",
"sql": "select count(distinct (t0.customer_id)), t1.customer_name, t1.customer_id as c2 from mailshot_customers as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.customer_phone = '205.496.0690x53058' group by c2"
},
"style"... | {
"index": 1228,
"split": "train"
} | |
What is the difference between the address IDs assigned to customer 10 and customer 4? | driving_school | select t1.c0 - t0.c0 from (select customer_address_id as c0 from customers where customer_id = 4) as t1, (select customer_address_id as c0 from customers where customer_id = 10) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select t1.c0 - t0.c0 from (select customer_address_id as c0 from customers where customer_id = 4) as t1, (select customer_address_id as c0 from customers where customer_id = 10) as t0"
},
"style": "rule"
} | {
"index": 3604,
"split": "train"
} | |
What are the invoice number, shipment date, shipment's order ID, and order date for shipments where the order was placed after May 10, 1971, at 01:54:18? | tracking_orders | select t0.invoice_number, t0.shipment_date, t0.order_id, t1.date_order_placed as c0 from shipments as t0 join orders as t1 on t0.order_id = t1.order_id where c0 > '1971-05-10 01:54:18' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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, t0.shipment_date, t0.order_id, t1.date_order_placed as c0 from shipments as t0 join orders as t1 on t0.order_id = t1.order_id where c0 > '1971-05-10 01:54:18'"
},
"style": "rule"
} | {
"index": 312,
"split": "train"
} | |
For each airport, what are its elevation, city, and airport ID, along with the highest airline ID among routes operated by either the most frequently used airline overall or a less common airline that operates routes starting with "S" or from the airport with code "FWA"? | flight_4 | select t0.elevation, t0.city, t0.apid as c3, max(t1.alid) from airports as t0 join routes as t1 on t0.apid = t1.src_apid, (select airline as c0 from routes group by c0 order by count(*) desc limit 1) as t1, (select airline as c0 from routes where src_ap like 'S%' or src_ap = 'FWA' group by c0 order by count(*) asc null... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_4",
"sql": "select t0.elevation, t0.city, t0.apid as c3, max(t1.alid) from airports as t0 join routes as t1 on t0.apid = t1.src_apid, (select airline as c0 from routes group by c0 order by count(*) desc limit 1) as t1, (select airline as c0 from routes where src_ap like 'S... | {
"index": 2639,
"split": "train"
} | |
Show the ten stations with the fewest platforms and their annual entry and exit numbers, where these stations are served by the most frequently named train. | train_station | select t0.number_of_platforms as c0, t0.annual_entry_exit from station as t0 join train_station as t1 on t0.station_id = t1.station_id join train as t2 on t1.train_id = t2.train_id, (select name as c1 from train group by c1 order by count(*) desc limit 1) as t0 where t2.name = t0.c1 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": "train_station",
"sql": "select t0.number_of_platforms as c0, t0.annual_entry_exit from station as t0 join train_station as t1 on t0.station_id = t1.station_id join train as t2 on t1.train_id = t2.train_id, (select name as c1 from train group by c1 order by count(*) desc limit 1) ... | {
"index": 43,
"split": "train"
} | |
Which railway object has the most entries with wheels ending in '4-0' or starting with '0-6-', and what are the counts of total entries and distinct wheel configurations for that object? | railway | select objectnumber as c1, count(builder), count(distinct (wheels)) from railway where wheels like '%4-0' or wheels like '0-6-%' group by c1 order by count(*) 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": "railway",
"sql": "select objectnumber as c1, count(builder), count(distinct (wheels)) from railway where wheels like '%4-0' or wheels like '0-6-%' group by c1 order by count(*) desc limit 1"
},
"style": "rule"
} | {
"index": 1587,
"split": "train"
} | |
What are the distinct accelerator IDs, browser IDs, and the years they became compatible for accelerators that support connections like Dial-up, Broadband, DSL, ISDN, Satellite, Wireless, or any connection type starting with "A"? | browser_web | select distinct t0.accelerator_id, t0.browser_id, t0.compatible_since_year from accelerator_compatible_browser as t0 join web_client_accelerator as t1 on t0.accelerator_id = t1.id where t1.connection = 'Dial-up, Broadband, DSL, ISDN, Satellite, Wireless' or t1.connection like 'A%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "browser_web",
"sql": "select distinct t0.accelerator_id, t0.browser_id, t0.compatible_since_year from accelerator_compatible_browser as t0 join web_client_accelerator as t1 on t0.accelerator_id = t1.id where t1.connection = 'Dial-up, Broadband, DSL, ISDN, Satellite, Wireless' or ... | {
"index": 2488,
"split": "train"
} | |
Can you show me all the details of ships that are classified as Panamax? | ship_1 | select * from ship where type = 'Panamax' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "ship_1",
"sql": "select * from ship where type = 'Panamax'"
},
"style": "rule"
} | {
"index": 380,
"split": "train"
} | |
How many additional documents with the "working" status were received by April 17, 1999, compared to those received by September 27, 1982, considering only documents shipped by agents whose codes start with 'S' on the earlier date? | cre_Doc_Control_Systems | select t1.c1 - t0.c1 from (select count(distinct (t1.document_id)) as c1 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t0.document_status_code = 'working' and t1.receipt_date = '1999-04-17 14:19:32' group by t0.document_status_code) as t1, (select t0.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_Doc_Control_Systems",
"sql": "select t1.c1 - t0.c1 from (select count(distinct (t1.document_id)) as c1 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t0.document_status_code = 'working' and t1.receipt_date = '199... | {
"index": 3514,
"split": "train"
} | |
How many days are there between the Date In Location From and Date In Location To for a specific document location record? | cre_Doc_Tracking_DB | select julianday(t1.c0) - julianday(t0.c2) from (select date_in_location_from as c0 from document_locations) as t1, (select date_in_locaton_to as c2 from document_locations where date_in_location_from = '2010-11-26 19:22:50' and date_in_location_from = '2010-11-26 19:22:50') as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Tracking_DB",
"sql": "select julianday(t1.c0) - julianday(t0.c2) from (select date_in_location_from as c0 from document_locations) as t1, (select date_in_locaton_to as c2 from document_locations where date_in_location_from = '2010-11-26 19:22:50' and date_in_location_from... | {
"index": 3682,
"split": "train"
} | |
Can you provide the names of all players and clubs? | sports_competition | select anon_1.c0 from (select name as c0 from player union select name from club) as anon_1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "sports_competition",
"sql": "select anon_1.c0 from (select name as c0 from player union select name from club) as anon_1"
},
"style": "rule"
} | {
"index": 2122,
"split": "train"
} | |
For each team, what is the youngest age among players whose positions include "ase"? | school_player | select team as c0, min(age) from player where position like '%ase%' 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": "school_player",
"sql": "select team as c0, min(age) from player where position like '%ase%' group by c0"
},
"style": "rule"
} | {
"index": 85,
"split": "train"
} | |
Who are the users that reviewed items with IDs of 1 or higher and gave reviews with a rank between 6 and 7? | epinions_1 | select t0.name, t0.u_id from useracct as t0 join review as t1 on t0.u_id = t1.u_id where t1.i_id >= 1 and t1.rank between 6 and 7 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select t0.name, t0.u_id from useracct as t0 join review as t1 on t0.u_id = t1.u_id where t1.i_id >= 1 and t1.rank between 6 and 7"
},
"style": "rule"
} | {
"index": 341,
"split": "train"
} | |
What is the name of the company and its average funding request for "Mycorrhizal Systems," considering only companies where the average amount requested is less than or equal to 120,000? | entrepreneur | select company as c0, avg(money_requested) from entrepreneur where c0 = 'Mycorrhizal Systems' group by c0 having avg(money_requested) <= 120000.0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "entrepreneur",
"sql": "select company as c0, avg(money_requested) from entrepreneur where c0 = 'Mycorrhizal Systems' group by c0 having avg(money_requested) <= 120000.0"
},
"style": "rule"
} | {
"index": 1101,
"split": "train"
} | |
Which students have first names, classroom numbers, and grades among those assigned to rooms numbered higher than 104? | student_1 | select distinct firstname, classroom as c1, grade from list where c1 > 104 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_1",
"sql": "select distinct firstname, classroom as c1, grade from list where c1 > 104"
},
"style": "rule"
} | {
"index": 809,
"split": "train"
} | |
What is the director and release year of the top movie when sorting directors in reverse alphabetical order, along with the reviewer ID and stars for ratings given either by reviewer 203 or by reviewers who haven't rated any movies yet? | movie_1 | select t0.director as c3, t0.year, t1.rid as c1, t1.stars from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid where t2.rid = 203 or (not t2.rid in (select c1 as c1 from rating)) order by c3 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "movie_1",
"sql": "select t0.director as c3, t0.year, t1.rid as c1, t1.stars from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid where t2.rid = 203 or (not t2.rid in (select c1 as c1 from rating)) order by c3 desc limit 1"
},
"style": "... | {
"index": 939,
"split": "train"
} | |
What are the names, team IDs, and team names of the top three teams (sorted alphabetically in reverse order) that participated in match seasons linked to countries named either "United States" or starting with "Unite"? | match_season | select t0.name, t0.team_id, t1.team as c1 from team as t0 join match_season as t1 on t0.team_id = t1.team join country as t2 on t1.country = t2.country_id where t2.country_name = 'United States' or t2.country_name like 'Unite%' 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": "match_season",
"sql": "select t0.name, t0.team_id, t1.team as c1 from team as t0 join match_season as t1 on t0.team_id = t1.team join country as t2 on t1.country = t2.country_id where t2.country_name = 'United States' or t2.country_name like 'Unite%' order by c1 desc limit 3"
}... | {
"index": 2191,
"split": "train"
} | |
Which are the three most recent party and election year pairs associated with counties that have zip code D02 or the most common zip code among all counties, sorted by year? | election | select t0.party, t0.year as c2 from party as t0 join election as t1 on t0.party_id = t1.party join county as t2 on t1.district = t2.county_id, (select zip_code as c1 from county group by c1 order by count(distinct (population)) desc limit 1) as t0 where t2.zip_code = 'D02' or t2.zip_code = t0.c1 order by c2 asc nulls l... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "election",
"sql": "select t0.party, t0.year as c2 from party as t0 join election as t1 on t0.party_id = t1.party join county as t2 on t1.district = t2.county_id, (select zip_code as c1 from county group by c1 order by count(distinct (population)) desc limit 1) as t0 where t2.zip_... | {
"index": 1008,
"split": "train"
} | |
What are the names and codes of the top 10 projects associated with the scientist named John Doe, listed in reverse alphabetical order by project name? | scientist_1 | select t0.name as c3, t0.code, t1.project, t1.scientist from projects as t0 join assignedto as t1 on t0.code = t1.project join scientists as t2 on t1.scientist = t2.ssn where t2.name = 'John Doe' order by c3 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "scientist_1",
"sql": "select t0.name as c3, t0.code, t1.project, t1.scientist from projects as t0 join assignedto as t1 on t0.code = t1.project join scientists as t2 on t1.scientist = t2.ssn where t2.name = 'John Doe' order by c3 desc limit 10"
},
"style": "rule"
} | {
"index": 459,
"split": "train"
} | |
List the distinct problem IDs, log entry descriptions, log entry dates, and the first names of staff members who are assigned to staff ID 4. | tracking_software_problems | select distinct t0.problem_id, t0.log_entry_description, t0.log_entry_date, t1.staff_first_name from problem_log as t0 join staff as t1 on t0.assigned_to_staff_id = t1.staff_id where t1.staff_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": "tracking_software_problems",
"sql": "select distinct t0.problem_id, t0.log_entry_description, t0.log_entry_date, t1.staff_first_name from problem_log as t0 join staff as t1 on t0.assigned_to_staff_id = t1.staff_id where t1.staff_id = 4"
},
"style": "rule"
} | {
"index": 495,
"split": "train"
} | |
How many tweets were posted by users who have exactly 23,927,492 followers or at least 890 followers? | twitter_1 | select count(t0.id) from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid where t1.followers between 23927492 and 23927492 or t1.followers >= 890 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(t0.id) from tweets as t0 join user_profiles as t1 on t0.uid = t1.uid where t1.followers between 23927492 and 23927492 or t1.followers >= 890"
},
"style": "rule"
} | {
"index": 1419,
"split": "train"
} | |
How many days have passed between the Date From and Date To for the staff members involved in projects? | tracking_grants_for_research | select julianday(t1.c3) - julianday(t0.c0) from (select date_to as c3 from project_staff) as t1, (select date_from as c0 from project_staff) 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_grants_for_research",
"sql": "select julianday(t1.c3) - julianday(t0.c0) from (select date_to as c3 from project_staff) as t1, (select date_from as c0 from project_staff) as t0"
},
"style": "rule"
} | {
"index": 3742,
"split": "train"
} | |
Can you tell me the candidate IDs and how many unique people with IDs up to 7 support each candidate who has a support rate of 33% or less? | candidate_poll | select candidate_id as c0, count(distinct (people_id)) from candidate where support_rate <= 0.33 and people_id <= 7 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": "candidate_poll",
"sql": "select candidate_id as c0, count(distinct (people_id)) from candidate where support_rate <= 0.33 and people_id <= 7 group by c0"
},
"style": "rule"
} | {
"index": 2138,
"split": "train"
} | |
Who are the five employees with the highest role codes, and what are their names and dates of birth? | cre_Doc_Tracking_DB | select employee_name, date_of_birth from employees order by role_code 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": "cre_Doc_Tracking_DB",
"sql": "select employee_name, date_of_birth from employees order by role_code desc limit 5"
},
"style": "rule"
} | {
"index": 2031,
"split": "train"
} | |
What is the percentage change in the number of low temperature records at stations between the 06:30 train and the 22:10 train? | station_weather | select (count(t0.c2) / cast(count(t1.c2) as real) - 1) * 100 from (select t0.low_temperature as c2 from weekly_weather as t0 join station as t1 on t0.station_id = t1.id join route as t2 on t1.id = t2.station_id join train as t3 on t2.train_id = t3.id where t3.time = '06:30') as t0, (select t0.low_temperature as c2 from... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "station_weather",
"sql": "select (count(t0.c2) / cast(count(t1.c2) as real) - 1) * 100 from (select t0.low_temperature as c2 from weekly_weather as t0 join station as t1 on t0.station_id = t1.id join route as t2 on t1.id = t2.station_id join train as t3 on t2.train_id = t3.id whe... | {
"index": 3051,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.