question stringlengths 1 606 | db_id stringclasses 139
values | external_knowledge stringclasses 1
value | sql stringlengths 19 1.35k | data_source stringclasses 1
value | prompt listlengths 2 2 | ability stringclasses 1
value | reward_model dict | extra_info dict |
|---|---|---|---|---|---|---|---|---|
What are the ten colors (by description) associated with products whose descriptions start with "exer," listed in reverse alphabetical order? | products_gen_characteristics | select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.product_description like 'exer%' 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": "products_gen_characteristics",
"sql": "select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.product_description like 'exer%' order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 1616,
"split": "train"
} | |
What is the product id for the order item with id 7? | tracking_orders | select product_id from order_items where order_item_id = 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_orders",
"sql": "select product_id from order_items where order_item_id = 7"
},
"style": "rule"
} | {
"index": 3403,
"split": "train"
} | |
Can you list the address roads, branch names, and branch IDs for branches where members have a level of 6 or exactly 6, or members with a level less than 4, sorted by address road alphabetically? | shop_membership | select t0.address_road as c2, t0.name, t0.branch_id from branch as t0 join membership_register_branch as t1 on t0.branch_id = t1.branch_id join member as t2 on t1.member_id = t2.member_id where t2.level between 6 and 6 or t2.level < 4 order by c2 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": "shop_membership",
"sql": "select t0.address_road as c2, t0.name, t0.branch_id from branch as t0 join membership_register_branch as t1 on t0.branch_id = t1.branch_id join member as t2 on t1.member_id = t2.member_id where t2.level between 6 and 6 or t2.level < 4 order by c2 asc nul... | {
"index": 1466,
"split": "train"
} | |
Did staff member 2's birthday occur after staff member 3's birthday? | driving_school | select t1.c0 > t0.c0 from (select date_of_birth as c0 from staff where staff_id = 2) as t1, (select date_of_birth as c0 from staff where staff_id = 3) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select t1.c0 > t0.c0 from (select date_of_birth as c0 from staff where staff_id = 2) as t1, (select date_of_birth as c0 from staff where staff_id = 3) as t0"
},
"style": "rule"
} | {
"index": 3084,
"split": "train"
} | |
Who are the people listed as friends of someone whose name includes "Zac," along with the year they became friends and the friend's age, sorted by their own names in reverse alphabetical order? | network_2 | select t0.name as c1, t0.year, t0.friend, t1.age from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.name like '%Zac%' order by c1 desc | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "network_2",
"sql": "select t0.name as c1, t0.year, t0.friend, t1.age from personfriend as t0 join person as t1 on t0.friend = t1.name where t1.name like '%Zac%' order by c1 desc"
},
"style": "rule"
} | {
"index": 557,
"split": "train"
} | |
List the names of up to three architects whose names start with "Gaotun" or end with "zhou Arch," sorted alphabetically by their names. | architecture | select t0.name as c0 from architect as t0 join bridge as t1 on t0.id = t1.architect_id where t1.name like 'Gaotun%' or t1.name like '%zhou Arch' order by c0 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "architecture",
"sql": "select t0.name as c0 from architect as t0 join bridge as t1 on t0.id = t1.architect_id where t1.name like 'Gaotun%' or t1.name like '%zhou Arch' order by c0 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 2109,
"split": "train"
} | |
Which persons have friends whose names end with "lice," and what are their cities and names? | network_2 | select t0.city from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.friend like '%lice' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "network_2",
"sql": "select t0.city from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.friend like '%lice'"
},
"style": "rule"
} | {
"index": 365,
"split": "train"
} | |
What is the percentage change in the average project ID, based on document data, for projects with IDs less than 195 between November 29, 1981, and August 24, 1983? | cre_Docs_and_Epenses | select (sum(t0.c0) / cast(sum(t1.c0) as real) - 1) * 100 from (select avg(t1.project_id) as c0 from projects as t0 join documents as t1 on t0.project_id = t1.project_id where t1.document_date = '1981-11-29 10:23:01' and t1.project_id < 195 group by t0.project_id) as t0, (select t0.project_id, avg(t1.project_id) as c0 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_Docs_and_Epenses",
"sql": "select (sum(t0.c0) / cast(sum(t1.c0) as real) - 1) * 100 from (select avg(t1.project_id) as c0 from projects as t0 join documents as t1 on t0.project_id = t1.project_id where t1.document_date = '1981-11-29 10:23:01' and t1.project_id < 195 group by ... | {
"index": 3013,
"split": "train"
} | |
What is the name, country ID, and ID of the city that has postal code 75444 and belongs to the country with the lowest country ID? | sakila_1 | select t0.city, t0.country_id as c1 from city as t0 join address as t1 on t0.city_id = t1.city_id where t1.postal_code = 75444 order by c1 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "sakila_1",
"sql": "select t0.city, t0.country_id as c1 from city as t0 join address as t1 on t0.city_id = t1.city_id where t1.postal_code = 75444 order by c1 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 1685,
"split": "train"
} | |
What is the difference between Farida's average song resolution and 1080, and how far is her average from this value? | music_1 | select t0.c0 - 1080.0 from (select avg(t1.resolution) as c0 from artist as t0 join song as t1 on t0.artist_name = t1.artist_name where t0.artist_name = 'Farida' group by t0.artist_name) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "music_1",
"sql": "select t0.c0 - 1080.0 from (select avg(t1.resolution) as c0 from artist as t0 join song as t1 on t0.artist_name = t1.artist_name where t0.artist_name = 'Farida' group by t0.artist_name) as t0"
},
"style": "rule"
} | {
"index": 3244,
"split": "train"
} | |
Which park with more than one qualifying game (attendance above the total attendance across all games and games fewer than 58) and the highest park ID is associated with the state and park name? | baseball_1 | select t0.state, t0.park_name from park as t0 join home_game as t1 on t0.park_id = t1.park_id, (select count(attendance) as c1 from home_game) as t0 where t1.attendance > t0.c1 and t1.games < 58 group by t0.park_id having count(*) > 1 order by t0.park_id desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select t0.state, t0.park_name from park as t0 join home_game as t1 on t0.park_id = t1.park_id, (select count(attendance) as c1 from home_game) as t0 where t1.attendance > t0.c1 and t1.games < 58 group by t0.park_id having count(*) > 1 order by t0.park_id desc... | {
"index": 1314,
"split": "train"
} | |
What are the prominence, range, and id of the mountains that are associated with photos having IDs 4 or 8? | mountain_photos | select t0.prominence, t0.range from mountain as t0 join photos as t1 on t0.id = t1.mountain_id where t1.id = 4 or t1.id = 8 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "mountain_photos",
"sql": "select t0.prominence, t0.range from mountain as t0 join photos as t1 on t0.id = t1.mountain_id where t1.id = 4 or t1.id = 8"
},
"style": "rule"
} | {
"index": 2931,
"split": "train"
} | |
How many airports away is airport 6 from airport 5 based on the minimum airport ID associated with flights departing from airport 6? | flight_company | select t0.c2 - 5 from (select min(t1.airport_id) as c2 from airport as t0 join flight as t1 on t0.id = t1.airport_id where t0.id = 6 group by t0.id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_company",
"sql": "select t0.c2 - 5 from (select min(t1.airport_id) as c2 from airport as t0 join flight as t1 on t0.id = t1.airport_id where t0.id = 6 group by t0.id) as t0"
},
"style": "rule"
} | {
"index": 3237,
"split": "train"
} | |
List the names of the top 10 donors in the endowment, sorted by the most recent school ID. | school_finance | select donator_name from endowment order by school_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": "school_finance",
"sql": "select donator_name from endowment order by school_id desc limit 10"
},
"style": "rule"
} | {
"index": 696,
"split": "train"
} | |
Which staff members are involved in handling complaints made by customers from Kansas? Provide their last names, first names, email addresses, and staff IDs. | customer_complaints | select anon_1.c0, anon_1.c2, anon_1.c3, anon_1.c1 from (select last_name as c0, first_name as c2, email_address as c3, staff_id as c1 from staff intersect select t0.last_name as c0, t0.first_name as c2, t0.email_address as c3, t0.staff_id as c1 from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id join cu... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c2, anon_1.c3, anon_1.c1 from (select last_name as c0, first_name as c2, email_address as c3, staff_id as c1 from staff intersect select t0.last_name as c0, t0.first_name as c2, t0.email_address as c3, t0.staff_id as c1 from ... | {
"index": 2268,
"split": "train"
} | |
Which are the five loan types with the smallest maximum loan amounts, listed from lowest to highest, showing each loan type and its maximum amount? | loan_1 | select loan_type as c0, max(amount) as c1 from loan group by c0 order by c1 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "loan_1",
"sql": "select loan_type as c0, max(amount) as c1 from loan group by c0 order by c1 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 378,
"split": "train"
} | |
What are the enrollment numbers, states, and names of colleges where players with a ycard starting with "y" participated in tryouts? | soccer_2 | select t0.enr, t0.state, t1.cname from college as t0 join tryout as t1 on t0.cname = t1.cname join player as t2 on t1.pid = t2.pid where t2.ycard like 'y%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t0.enr, t0.state, t1.cname from college as t0 join tryout as t1 on t0.cname = t1.cname join player as t2 on t1.pid = t2.pid where t2.ycard like 'y%'"
},
"style": "rule"
} | {
"index": 1080,
"split": "train"
} | |
Which airports, identified by their names, IDs, and countries, are served by operating companies of the least common type among those with a group equity shareholding of 40% or less? | flight_company | select t0.name, t0.id, t0.country from airport as t0 join flight as t1 on t0.id = t1.airport_id join operate_company as t2 on t1.company_id = t2.id, (select type as c1 from operate_company where group_equity_shareholding <= 40.0 group by c1 order by count(*) asc nulls last limit 1) as t0 where t2.type = t0.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_company",
"sql": "select t0.name, t0.id, t0.country from airport as t0 join flight as t1 on t0.id = t1.airport_id join operate_company as t2 on t1.company_id = t2.id, (select type as c1 from operate_company where group_equity_shareholding <= 40.0 group by c1 order by count... | {
"index": 2478,
"split": "train"
} | |
What are the grant end dates and organization IDs for grants that have both response received dates on or before January 27, 1977, and sent dates on or before January 28, 2014? | tracking_grants_for_research | select anon_1.c0, anon_1.c1 from (select t0.grant_end_date as c0, t0.organisation_id as c1 from grants as t0 join documents as t1 on t0.grant_id = t1.grant_id where t1.response_received_date <= '1977-01-27 07:14:11' intersect select t0.grant_end_date as c0, t0.organisation_id as c1 from grants as t0 join documents as 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": "tracking_grants_for_research",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.grant_end_date as c0, t0.organisation_id as c1 from grants as t0 join documents as t1 on t0.grant_id = t1.grant_id where t1.response_received_date <= '1977-01-27 07:14:11' intersect select t0.grant... | {
"index": 759,
"split": "train"
} | |
Which are the ten most accessed documents that have a document code ending with "1", ordered from the most to the least accessed? | document_management | select t0.document_name from documents as t0 join document_functional_areas as t1 on t0.document_code = t1.document_code where t1.document_code like '%1' order by t0.access_count 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": "document_management",
"sql": "select t0.document_name from documents as t0 join document_functional_areas as t1 on t0.document_code = t1.document_code where t1.document_code like '%1' order by t0.access_count desc limit 10"
},
"style": "rule"
} | {
"index": 2288,
"split": "train"
} | |
Can you tell me all the unique party IDs from the party host records? | party_host | select distinct party_id from party_host | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct party_id from party_host"
},
"style": "rule"
} | {
"index": 1259,
"split": "train"
} | |
What is the organization ID of the thing with ID 84, minus 7? | local_govt_and_lot | select organization_id - 7 from things where thing_id = 84 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 organization_id - 7 from things where thing_id = 84"
},
"style": "rule"
} | {
"index": 3884,
"split": "train"
} | |
Can you show me the earliest three transactions, including the date, transaction type code, and the investor’s name and ID, for investors with IDs from 1 to 19, sorted by the date of the transaction? | tracking_share_transactions | select t0.date_of_transaction as c0, t0.transaction_type_code, t1.investor_details, t1.investor_id from transactions as t0 join investors as t1 on t0.investor_id = t1.investor_id join lots as t2 on t1.investor_id = t2.investor_id where t2.investor_id <= 19 or t2.investor_id >= 1 order by c0 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select t0.date_of_transaction as c0, t0.transaction_type_code, t1.investor_details, t1.investor_id from transactions as t0 join investors as t1 on t0.investor_id = t1.investor_id join lots as t2 on t1.investor_id = t2.investor_id where t2.inv... | {
"index": 1845,
"split": "train"
} | |
What are the incident types and their descriptions associated with detention types whose descriptions end with "g Break time"? | behavior_monitoring | select t0.incident_type_code, t0.incident_type_description from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code join students as t2 on t1.student_id = t2.student_id join assessment_notes as t3 on t2.student_id = t3.student_id join teachers as t4 on t3.teacher_id = 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": "behavior_monitoring",
"sql": "select t0.incident_type_code, t0.incident_type_description from ref_incident_type as t0 join behavior_incident as t1 on t0.incident_type_code = t1.incident_type_code join students as t2 on t1.student_id = t2.student_id join assessment_notes as t3 on ... | {
"index": 409,
"split": "train"
} | |
Which operate companies with fewer than three flights on May 19, 196*, or October 2*, and what are their principal activities and IDs? | flight_company | select t0.principal_activities, t0.id as c0 from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t1.date like 'May 19, 196%' or t1.date like 'October 2%' group by c0 having count(*) < 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_company",
"sql": "select t0.principal_activities, t0.id as c0 from operate_company as t0 join flight as t1 on t0.id = t1.company_id where t1.date like 'May 19, 196%' or t1.date like 'October 2%' group by c0 having count(*) < 3"
},
"style": "rule"
} | {
"index": 992,
"split": "train"
} | |
Which closure authorising staff ID and product ID are associated with the most recent problem report, where the product name starts with "t" or is exactly "game"? | tracking_software_problems | select t0.closure_authorised_by_staff_id, t1.product_id from problems as t0 join product as t1 on t0.product_id = t1.product_id where t1.product_name like 't%' or t1.product_name = 'game' order by t0.reported_by_staff_id desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t0.closure_authorised_by_staff_id, t1.product_id from problems as t0 join product as t1 on t0.product_id = t1.product_id where t1.product_name like 't%' or t1.product_name = 'game' order by t0.reported_by_staff_id desc limit 1"
},
"... | {
"index": 191,
"split": "train"
} | |
What is the total of all movie release years for each director? | culture_company | select director as c0, sum(year) from movie 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": "culture_company",
"sql": "select director as c0, sum(year) from movie group by c0"
},
"style": "rule"
} | {
"index": 2028,
"split": "train"
} | |
Could you tell me the names and IDs of activities, along with how many students are participating in each, for activities with IDs less than or equal to 770 or between 778 and 782, where more than four students are involved? | activity_1 | select t0.activity_name, t0.actid as c2, count(t1.actid) from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.actid <= 770 or t1.actid between 778 and 782 group by c2 having count(*) > 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": "activity_1",
"sql": "select t0.activity_name, t0.actid as c2, count(t1.actid) from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.actid <= 770 or t1.actid between 778 and 782 group by c2 having count(*) > 4"
},
"style": "rule"
} | {
"index": 98,
"split": "train"
} | |
Which employee numbers belong to either professors or department staff? | college_1 | select anon_1.c0 from (select emp_num as c0 from professor union select emp_num from department) 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": "college_1",
"sql": "select anon_1.c0 from (select emp_num as c0 from professor union select emp_num from department) as anon_1"
},
"style": "rule"
} | {
"index": 356,
"split": "train"
} | |
What are the top 10 program origins and their corresponding program IDs, along with the broadcast times and program IDs, for broadcasts on channels with the highest market share percentage? Specifically, these channels should have a share in percent at least as high as the maximum share among all channels, and their ow... | program_share | select t0.origin as c4, t0.program_id, t1.time_of_day, t1.program_id 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, (select max(share_in_percent) as c0 from channel) as t1 where t2.share_in_percent >= t1.c0 and (not t2.owner in (select t0.ow... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.origin as c4, t0.program_id, t1.time_of_day, t1.program_id 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, (select max(share_in_percent) as c0 from channel) as t1 where... | {
"index": 509,
"split": "train"
} | |
Show the ranking and district of each market, along with the IDs of the phones and the markets where phones with the carrier "Sprint" are available. | phone_market | select t0.ranking, t0.district, t1.phone_id, t1.market_id from market as t0 join phone_market as t1 on t0.market_id = t1.market_id join phone as t2 on t1.phone_id = t2.phone_id where t2.carrier = 'Sprint' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "phone_market",
"sql": "select t0.ranking, t0.district, t1.phone_id, t1.market_id from market as t0 join phone_market as t1 on t0.market_id = t1.market_id join phone as t2 on t1.phone_id = t2.phone_id where t2.carrier = 'Sprint'"
},
"style": "rule"
} | {
"index": 2008,
"split": "train"
} | |
What is the smallest and largest club ID among players who belong to clubs with an ID of 2 or higher? | sports_competition | select min(club_id), max(club_id) from player where club_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": "sports_competition",
"sql": "select min(club_id), max(club_id) from player where club_id >= 2"
},
"style": "rule"
} | {
"index": 3649,
"split": "train"
} | |
For each product name, what is the total number of entries and the lowest price available? | solvency_ii | select product_name as c2, count(*), min(product_price) from products 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": "solvency_ii",
"sql": "select product_name as c2, count(*), min(product_price) from products group by c2"
},
"style": "rule"
} | {
"index": 1649,
"split": "train"
} | |
What is the percentage change in the smallest customer ID with invoices under $16.86 between October 7, 2007, and April 22, 2009? | store_1 | select (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select min(t1.customer_id) as c0 from customers as t0 join invoices as t1 on t0.id = t1.customer_id where t1.invoice_date = '2007-10-07 00:00:00' and t1.total < 16.86 group by t0.id) as t0, (select min(t1.customer_id) as c0 from customers as t0 join invoice... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select min(t1.customer_id) as c0 from customers as t0 join invoices as t1 on t0.id = t1.customer_id where t1.invoice_date = '2007-10-07 00:00:00' and t1.total < 16.86 group by t0.id) as t0, (select m... | {
"index": 3053,
"split": "train"
} | |
Which author has the highest number of distinct submissions where the scores are either equal to the total number of different scores across all submissions or are below 89.0? For that author, what are the total number of submissions, the sum of their scores, and the number of unique submission IDs? | workshop_paper | select t0.author as c2, count(t0.author), sum(t0.scores), count(distinct (t0.submission_id)) as c1 from submission as t0, (select count(distinct (scores)) as c3 from submission) as t0 where t0.scores = t0.c3 or t0.scores < 89.0 group by c2 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": "workshop_paper",
"sql": "select t0.author as c2, count(t0.author), sum(t0.scores), count(distinct (t0.submission_id)) as c1 from submission as t0, (select count(distinct (scores)) as c3 from submission) as t0 where t0.scores = t0.c3 or t0.scores < 89.0 group by c2 order by c1 des... | {
"index": 21,
"split": "train"
} | |
What are the ranks and classes of captains who command ships built in 1997 or later? | ship_1 | select anon_1.c1, anon_1.c0 from (select rank as c1, class as c0 from captain except select t0.rank as c1, t0.class as c0 from captain as t0 join ship as t1 on t0.ship_id = t1.ship_id where t1.built_year < 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": "ship_1",
"sql": "select anon_1.c1, anon_1.c0 from (select rank as c1, class as c0 from captain except select t0.rank as c1, t0.class as c0 from captain as t0 join ship as t1 on t0.ship_id = t1.ship_id where t1.built_year < 1997.0) as anon_1"
},
"style": "rule"
} | {
"index": 500,
"split": "train"
} | |
What are the numbers of transit passengers and total passengers for airports that have aircraft with "H-5" in their name, excluding those airports that are associated with aircraft having an ID of 3? | aircraft | select anon_1.c1, anon_1.c0 from (select t0.transit_passengers as c1, t0.total_passengers as c0 from airport as t0 join airport_aircraft as t1 on t0.airport_id = t1.airport_id join aircraft as t2 on t1.aircraft_id = t2.aircraft_id where t2.aircraft like '%H-5%' except select t0.transit_passengers as c1, t0.total_passen... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c1, anon_1.c0 from (select t0.transit_passengers as c1, t0.total_passengers as c0 from airport as t0 join airport_aircraft as t1 on t0.airport_id = t1.airport_id join aircraft as t2 on t1.aircraft_id = t2.aircraft_id where t2.aircraft like '%H-5%'... | {
"index": 1772,
"split": "train"
} | |
Is the total sum of student IDs for courses where students earned an 'A' grade greater than the number of unique total student ID sums for courses with IDs starting with '6'? | college_3 | select t2.c1 > t1.c3 from (select sum(t1.stuid) as c1 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t0.lettergrade = 'A' group by t0.lettergrade) as t2, (select count(distinct (t0.c1)) as c3 from (select sum(t1.stuid) as c1 from gradeconversion as t0 join enrolled_in as t1 on t0.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": "college_3",
"sql": "select t2.c1 > t1.c3 from (select sum(t1.stuid) as c1 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t0.lettergrade = 'A' group by t0.lettergrade) as t2, (select count(distinct (t0.c1)) as c3 from (select sum(t1.stuid) as ... | {
"index": 3264,
"split": "train"
} | |
Did player 1367 have a birthday before player 835? | soccer_1 | select t1.c1 < t0.c1 from (select birthday as c1 from player where id = 1367) as t1, (select birthday as c1 from player where id = 835) 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": "soccer_1",
"sql": "select t1.c1 < t0.c1 from (select birthday as c1 from player where id = 1367) as t1, (select birthday as c1 from player where id = 835) as t0"
},
"style": "rule"
} | {
"index": 3889,
"split": "train"
} | |
For each claim header with a policy ID less than 507, what are the three claim headers that have the smallest amount paid and the largest amount claimed? Please list their claim header IDs along with these minimum and maximum amounts, sorted by the highest amount claimed. | insurance_and_eClaims | select claim_header_id as c0, min(amount_piad), max(amount_claimed) as c2 from claim_headers where policy_id < 507 group by c0 order by c2 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": "insurance_and_eClaims",
"sql": "select claim_header_id as c0, min(amount_piad), max(amount_claimed) as c2 from claim_headers where policy_id < 507 group by c0 order by c2 desc limit 3"
},
"style": "rule"
} | {
"index": 2012,
"split": "train"
} | |
How many days elapsed between the date a staff member was assigned to a department and the date they were released from that assignment, specifically for those with job titles containing "tment Man"? | department_store | select julianday(t1.c0) - julianday(t0.c1) from (select date_assigned_from as c0 from staff_department_assignments) as t1, (select date_assigned_to as c1 from staff_department_assignments where job_title_code like '%tment Man%' and job_title_code like '%tment Man%') 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.c0) - julianday(t0.c1) from (select date_assigned_from as c0 from staff_department_assignments) as t1, (select date_assigned_to as c1 from staff_department_assignments where job_title_code like '%tment Man%' and job_title_code like '... | {
"index": 3833,
"split": "train"
} | |
Did problem 10 happen after problem 2 was reported? | tracking_software_problems | select t1.c0 > t0.c0 from (select date_problem_reported as c0 from problems where problem_id = 10) as t1, (select date_problem_reported as c0 from problems where problem_id = 2) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t1.c0 > t0.c0 from (select date_problem_reported as c0 from problems where problem_id = 10) as t1, (select date_problem_reported as c0 from problems where problem_id = 2) as t0"
},
"style": "rule"
} | {
"index": 3996,
"split": "train"
} | |
Who are the top five people with email addresses starting with "cele," ranked by the total number of their addresses, and what are their last names and person IDs? | student_assessment | select sum(t0.person_id) as c0, t1.last_name, t1.person_id as c2 from people_addresses as t0 join people as t1 on t0.person_id = t1.person_id where t1.email_address like 'cele%' group by c2 order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "student_assessment",
"sql": "select sum(t0.person_id) as c0, t1.last_name, t1.person_id as c2 from people_addresses as t0 join people as t1 on t0.person_id = t1.person_id where t1.email_address like 'cele%' group by c2 order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 2909,
"split": "train"
} | |
Retrieve the address IDs and customer IDs for the first three customers (when ordered by customer ID from highest to lowest) who placed orders with items having product IDs up to 12 and order IDs less than 8. | department_store | select t0.address_id, t0.customer_id as c0 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id join order_items as t3 on t2.order_id = t3.order_id where t3.product_id <= 12 and t3.order_id < 8 order by c0 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select t0.address_id, t0.customer_id as c0 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id join order_items as t3 on t2.order_id = t3.order_id where t3.p... | {
"index": 738,
"split": "train"
} | |
Can you tell me the document codes that are either linked to the functional area for document 961 or belong to section 27? | document_management | select anon_1.c1 from (select document_code as c1 from document_functional_areas where c1 = 961 union select document_code from document_sections where section_id = 27) 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": "document_management",
"sql": "select anon_1.c1 from (select document_code as c1 from document_functional_areas where c1 = 961 union select document_code from document_sections where section_id = 27) as anon_1"
},
"style": "rule"
} | {
"index": 899,
"split": "train"
} | |
What is the least common principal activity among companies whose activities end with 'rgo airline'? | flight_company | select t0.c1 as c3, count(distinct (t0.c0)) as c2 from (select principal_activities as c1, id as c0 from operate_company where c1 like '%rgo airline') as t0 group by c3 order by c2 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_company",
"sql": "select t0.c1 as c3, count(distinct (t0.c0)) as c2 from (select principal_activities as c1, id as c0 from operate_company where c1 like '%rgo airline') as t0 group by c3 order by c2 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 3666,
"split": "train"
} | |
Did the tweet with ID 9 happen more recently than the tweet with ID 4? | twitter_1 | select t1.c0 > t0.c0 from (select createdate as c0 from tweets where id = 9) as t1, (select createdate as c0 from tweets where id = 4) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "twitter_1",
"sql": "select t1.c0 > t0.c0 from (select createdate as c0 from tweets where id = 9) as t1, (select createdate as c0 from tweets where id = 4) as t0"
},
"style": "rule"
} | {
"index": 3113,
"split": "train"
} | |
What are the names and IDs of playlists, along with the album IDs and genre IDs of the tracks that are linked to invoice lines with invoice IDs less than 324, focusing on the track with the lowest genre ID? | store_1 | select t0.name, t0.id, t2.album_id, t2.genre_id as c2 from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id join tracks as t2 on t1.track_id = t2.id join invoice_lines as t3 on t2.id = t3.track_id where t3.invoice_id < 324 order by c2 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select t0.name, t0.id, t2.album_id, t2.genre_id as c2 from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id join tracks as t2 on t1.track_id = t2.id join invoice_lines as t3 on t2.id = t3.track_id where t3.invoice_id < 324 order by c2 asc nul... | {
"index": 2968,
"split": "train"
} | |
Among airlines with less than three routes that either originate from airports ending with "AX" or from the most frequently used source airport in all routes, what is the airline ID with the highest destination airport ID? Please also include the airline's country in the results, ordering by country alphabetically, and... | flight_4 | select t0.alid as c0, max(t1.dst_apid) from airlines as t0 join routes as t1 on t0.alid = t1.alid, (select src_ap as c1 from routes group by c1 order by count(*) desc limit 1) as t0 where t1.src_ap like '%AX' or t1.src_ap = t0.c1 group by c0 having count(*) < 3 order by t0.country asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_4",
"sql": "select t0.alid as c0, max(t1.dst_apid) from airlines as t0 join routes as t1 on t0.alid = t1.alid, (select src_ap as c1 from routes group by c1 order by count(*) desc limit 1) as t0 where t1.src_ap like '%AX' or t1.src_ap = t0.c1 group by c0 having count(*) < 3... | {
"index": 2846,
"split": "train"
} | |
How many days have passed between the date when a document moved into a location and the date it moved out from that location? | cre_Doc_Tracking_DB | select julianday(t1.c3) - julianday(t0.c0) from (select date_in_locaton_to as c3 from document_locations) as t1, (select date_in_location_from as c0 from document_locations) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Tracking_DB",
"sql": "select julianday(t1.c3) - julianday(t0.c0) from (select date_in_locaton_to as c3 from document_locations) as t1, (select date_in_location_from as c0 from document_locations) as t0"
},
"style": "rule"
} | {
"index": 3810,
"split": "train"
} | |
Can you show me the names of all the repairs and technicians combined? | machine_repair | select anon_1.c0 from (select name as c0 from repair union select name from technician) 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": "machine_repair",
"sql": "select anon_1.c0 from (select name as c0 from repair union select name from technician) as anon_1"
},
"style": "rule"
} | {
"index": 2794,
"split": "train"
} | |
Does the booking with ID 1 have an earlier end date than the booking with ID 14? | products_for_hire | select t1.c1 < t0.c1 from (select booking_end_date as c1 from bookings where booking_id = 1) as t1, (select booking_end_date as c1 from bookings where booking_id = 14) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_for_hire",
"sql": "select t1.c1 < t0.c1 from (select booking_end_date as c1 from bookings where booking_id = 1) as t1, (select booking_end_date as c1 from bookings where booking_id = 14) as t0"
},
"style": "rule"
} | {
"index": 3896,
"split": "train"
} | |
What are the last name, mobile phone number, and customer ID of customers, along with the highest staff ID associated with their lessons that last exactly 2 units of time? | driving_school | select t0.last_name, t0.cell_mobile_phone_number, t0.customer_id as c2, max(t1.staff_id) from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t1.lesson_time = 2 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": "driving_school",
"sql": "select t0.last_name, t0.cell_mobile_phone_number, t0.customer_id as c2, max(t1.staff_id) from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t1.lesson_time = 2 group by c2"
},
"style": "rule"
} | {
"index": 2954,
"split": "train"
} | |
What are the first ten genders in reverse alphabetical order among all persons in the database? | network_2 | select gender as c0 from person 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": "network_2",
"sql": "select gender as c0 from person order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 1200,
"split": "train"
} | |
For each film scheduled, how many unique film entries are there, what is the total number of screenings, and what is the highest ticket price offered? | cinema | select film_id as c3, count(distinct (film_id)), count(*), max(price) from schedule group by c3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cinema",
"sql": "select film_id as c3, count(distinct (film_id)), count(*), max(price) from schedule group by c3"
},
"style": "rule"
} | {
"index": 2011,
"split": "train"
} | |
Is the end date of the grant with ID 5 earlier than the end date of the grant with ID 9? | tracking_grants_for_research | select t1.c0 < t0.c0 from (select grant_end_date as c0 from grants where grant_id = 5) as t1, (select grant_end_date as c0 from grants where grant_id = 9) 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 t1.c0 < t0.c0 from (select grant_end_date as c0 from grants where grant_id = 5) as t1, (select grant_end_date as c0 from grants where grant_id = 9) as t0"
},
"style": "rule"
} | {
"index": 3150,
"split": "train"
} | |
What are the gender restrictions, dorm IDs, and the maximum dorm ID for dorms with more than four students living in them and a dorm ID greater than 117? | dorm_1 | select t0.gender, t0.dormid as c1, max(t1.dormid) from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid where t1.dormid > 117 group by c1 having count(*) > 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": "dorm_1",
"sql": "select t0.gender, t0.dormid as c1, max(t1.dormid) from dorm as t0 join lives_in as t1 on t0.dormid = t1.dormid where t1.dormid > 117 group by c1 having count(*) > 4"
},
"style": "rule"
} | {
"index": 1142,
"split": "train"
} | |
How many days have passed between an employee's birth date and their hire date? | store_1 | select julianday(t1.c0) - julianday(t0.c3) from (select birth_date as c0 from employees) as t1, (select hire_date as c3 from employees) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select julianday(t1.c0) - julianday(t0.c3) from (select birth_date as c0 from employees) as t1, (select hire_date as c3 from employees) as t0"
},
"style": "rule"
} | {
"index": 3903,
"split": "train"
} | |
For each asset supplied by companies with IDs up to 5, what is the asset's ID and the smallest maintenance contract ID associated with it? | assets_maintenance | select asset_id as c1, min(maintenance_contract_id) from assets where supplier_company_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": "assets_maintenance",
"sql": "select asset_id as c1, min(maintenance_contract_id) from assets where supplier_company_id <= 5 group by c1"
},
"style": "rule"
} | {
"index": 1394,
"split": "train"
} | |
Which fault log entries and contact staff IDs are associated with engineer visits where the required skills to fix the issue have skill IDs of 3 or lower? | assets_maintenance | select t0.fault_log_entry_id, t0.contact_staff_id from engineer_visits as t0 join maintenance_engineers as t1 on t0.engineer_id = t1.engineer_id join engineer_skills as t2 on t1.engineer_id = t2.engineer_id join skills as t3 on t2.skill_id = t3.skill_id join skills_required_to_fix as t4 on t3.skill_id = t4.skill_id whe... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "assets_maintenance",
"sql": "select t0.fault_log_entry_id, t0.contact_staff_id from engineer_visits as t0 join maintenance_engineers as t1 on t0.engineer_id = t1.engineer_id join engineer_skills as t2 on t1.engineer_id = t2.engineer_id join skills as t3 on t2.skill_id = t3.skill_... | {
"index": 259,
"split": "train"
} | |
What is the sales in billions and the ID of the company that has the ID 19? | company_office | select t0.sales_billion from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.company_id = 19 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "company_office",
"sql": "select t0.sales_billion from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.company_id = 19"
},
"style": "rule"
} | {
"index": 998,
"split": "train"
} | |
For each payment type, what are the smallest customer IDs, the number of payments, and the average amount paid, considering only payments less than $505.23 or more than $668.40? Show the top 3 payment types with the highest average amount paid, sorted from highest to lowest. | products_for_hire | select payment_type_code as c2, min(customer_id), count(*), avg(amount_paid) as c0 from payments where amount_paid < 505.23 or amount_paid > 668.4 group by c2 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_for_hire",
"sql": "select payment_type_code as c2, min(customer_id), count(*), avg(amount_paid) as c0 from payments where amount_paid < 505.23 or amount_paid > 668.4 group by c2 order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 1011,
"split": "train"
} | |
Which countries have fewer than four cities that either start with "Ram" or are named "Lancaster," and those countries are listed in reverse alphabetical order? | sakila_1 | select t0.country_id as c0 from country as t0 join city as t1 on t0.country_id = t1.country_id where t1.city like 'Ram%' or t1.city = 'Lancaster' group by c0 having count(*) < 4 order by t0.country desc | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "sakila_1",
"sql": "select t0.country_id as c0 from country as t0 join city as t1 on t0.country_id = t1.country_id where t1.city like 'Ram%' or t1.city = 'Lancaster' group by c0 having count(*) < 4 order by t0.country desc"
},
"style": "rule"
} | {
"index": 1027,
"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": 3939,
"split": "train"
} | |
What are the Electoral Register IDs, their associated cmi cross-reference IDs, and related master customer IDs for rent arrears records where the cmi cross-reference ID is anything other than 2? | local_govt_mdm | select t0.electoral_register_id, t0.cmi_cross_ref_id, t1.master_customer_id from electoral_register as t0 join cmi_cross_references as t1 on t0.cmi_cross_ref_id = t1.cmi_cross_ref_id join rent_arrears as t2 on t1.cmi_cross_ref_id = t2.cmi_cross_ref_id where t2.cmi_cross_ref_id > 2 or t2.cmi_cross_ref_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": "local_govt_mdm",
"sql": "select t0.electoral_register_id, t0.cmi_cross_ref_id, t1.master_customer_id from electoral_register as t0 join cmi_cross_references as t1 on t0.cmi_cross_ref_id = t1.cmi_cross_ref_id join rent_arrears as t2 on t1.cmi_cross_ref_id = t2.cmi_cross_ref_id whe... | {
"index": 1205,
"split": "train"
} | |
What is the difference between the total sum of address IDs for person 131 and 82? | student_assessment | select t0.c0 - 82 from (select sum(t1.address_id) as c0 from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id where t0.person_id = 131 group by t0.person_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": "student_assessment",
"sql": "select t0.c0 - 82 from (select sum(t1.address_id) as c0 from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id where t0.person_id = 131 group by t0.person_id) as t0"
},
"style": "rule"
} | {
"index": 3256,
"split": "train"
} | |
For the five pilots with the highest Pilot IDs, how many different aircraft have each of them operated? | pilot_record | select pilot_id as c0, count(distinct (aircraft_id)) from pilot_record group by c0 order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "pilot_record",
"sql": "select pilot_id as c0, count(distinct (aircraft_id)) from pilot_record group by c0 order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 1429,
"split": "train"
} | |
What are the details and IDs of vehicles used in lessons by customers who paid with a payment method ending in "Card"? | driving_school | select t0.vehicle_details, t0.vehicle_id from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id join customers as t2 on t1.customer_id = t2.customer_id join customer_payments as t3 on t2.customer_id = t3.customer_id where t3.payment_method_code like '%Card' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select t0.vehicle_details, t0.vehicle_id from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id join customers as t2 on t1.customer_id = t2.customer_id join customer_payments as t3 on t2.customer_id = t3.customer_id where t3.payment_metho... | {
"index": 1152,
"split": "train"
} | |
Which suppliers have purchased products with total amounts beginning with '2044', but none of their products are outside the set of products currently listed in order items? | department_store | select anon_1.c1, anon_1.c0 from (select t0.supplier_id as c1, t0.supplier_name as c0 from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id where t1.total_amount_purchased like '2044%' except select t0.supplier_id as c1, t0.supplier_name as c0 from suppliers as t0 join product_suppliers 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": "department_store",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.supplier_id as c1, t0.supplier_name as c0 from suppliers as t0 join product_suppliers as t1 on t0.supplier_id = t1.supplier_id where t1.total_amount_purchased like '2044%' except select t0.supplier_id as c1, t... | {
"index": 2167,
"split": "train"
} | |
What is the total wind speed in mph at station 1, minus 22? | station_weather | select t0.c2 - 22 from (select sum(t1.wind_speed_mph) as c2 from station as t0 join weekly_weather as t1 on t0.id = t1.station_id where t0.id = 1 group by t0.id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "station_weather",
"sql": "select t0.c2 - 22 from (select sum(t1.wind_speed_mph) as c2 from station as t0 join weekly_weather as t1 on t0.id = t1.station_id where t0.id = 1 group by t0.id) as t0"
},
"style": "rule"
} | {
"index": 3253,
"split": "train"
} | |
How many days passed between a policy's closing date and its opening date for policies that were closed on or before January 5, 2017? | insurance_fnol | select julianday(t1.c0) - julianday(t0.c1) from (select date_closed as c0 from customers_policies where date_opened <= '2017-01-05 00:00:00' and date_opened <= '2017-01-05 00:00:00') as t1, (select date_opened as c1 from customers_policies) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_fnol",
"sql": "select julianday(t1.c0) - julianday(t0.c1) from (select date_closed as c0 from customers_policies where date_opened <= '2017-01-05 00:00:00' and date_opened <= '2017-01-05 00:00:00') as t1, (select date_opened as c1 from customers_policies) as t0"
},
... | {
"index": 3820,
"split": "train"
} | |
Which amenities with IDs between 902 and 922 are available in the dorms, and how many times does each of these amenities appear in the student housing records? | dorm_1 | select t0.amenity_name, t0.amenid as c1, count(t1.amenid) from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t1.amenid between 902 and 922 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": "dorm_1",
"sql": "select t0.amenity_name, t0.amenid as c1, count(t1.amenid) from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t1.amenid between 902 and 922 group by c1"
},
"style": "rule"
} | {
"index": 2822,
"split": "train"
} | |
Which climber has the most recent ascension time, and what are their name, time, and points? | climbing | select time as c0, name, points from climber 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": "climbing",
"sql": "select time as c0, name, points from climber order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 1028,
"split": "train"
} | |
Find the user IDs and ranks of reviews made by users whose trust level is between 4 and 6, sorted by user ID. | epinions_1 | select t0.u_id as c1, t0.rank from review as t0 join useracct as t1 on t0.u_id = t1.u_id join trust as t2 on t1.u_id = t2.source_u_id where t2.trust between 4 and 6 order by c1 asc nulls last | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select t0.u_id as c1, t0.rank from review as t0 join useracct as t1 on t0.u_id = t1.u_id join trust as t2 on t1.u_id = t2.source_u_id where t2.trust between 4 and 6 order by c1 asc nulls last"
},
"style": "rule"
} | {
"index": 2547,
"split": "train"
} | |
What are the artist IDs, artist names, and track durations for tracks that have media type ID 3? | chinook_1 | select t0.artistid, t0.name, t2.milliseconds from artist as t0 join album as t1 on t0.artistid = t1.artistid join track as t2 on t1.albumid = t2.albumid join mediatype as t3 on t2.mediatypeid = t3.mediatypeid where t3.mediatypeid = 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "chinook_1",
"sql": "select t0.artistid, t0.name, t2.milliseconds from artist as t0 join album as t1 on t0.artistid = t1.artistid join track as t2 on t1.albumid = t2.albumid join mediatype as t3 on t2.mediatypeid = t3.mediatypeid where t3.mediatypeid = 3"
},
"style": "rule"
} | {
"index": 1049,
"split": "train"
} | |
How many dorms have amenity 930? | dorm_1 | select t0.c1 from (select count(distinct (t1.dormid)) as c1 from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t0.amenid = 930 group by t0.amenid) 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": "dorm_1",
"sql": "select t0.c1 from (select count(distinct (t1.dormid)) as c1 from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t0.amenid = 930 group by t0.amenid) as t0"
},
"style": "rule"
} | {
"index": 3376,
"split": "train"
} | |
List all the different amounts paid by customers in the payments records. | driving_school | select distinct amount_payment from customer_payments | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct amount_payment from customer_payments"
},
"style": "rule"
} | {
"index": 2817,
"split": "train"
} | |
Which authors contributed to the paper with ID 202 but did not contribute to the paper with ID 203? Please provide their author IDs, first names, and last names. | icfp_1 | select anon_1.c1, anon_1.c0, anon_1.c2 from (select t0.authid as c1, t0.fname as c0, t0.lname as c2 from authors as t0 join authorship as t1 on t0.authid = t1.authid join papers as t2 on t1.paperid = t2.paperid where t2.paperid = 202 except select t0.authid as c1, t0.fname as c0, t0.lname as c2 from authors 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": "icfp_1",
"sql": "select anon_1.c1, anon_1.c0, anon_1.c2 from (select t0.authid as c1, t0.fname as c0, t0.lname as c2 from authors as t0 join authorship as t1 on t0.authid = t1.authid join papers as t2 on t1.paperid = t2.paperid where t2.paperid = 202 except select t0.authid as c1... | {
"index": 2713,
"split": "train"
} | |
Can you tell me the top 5 airports operated by airline Y8, showing their maximum year (or attribute Y), how many unique countries they are in, and how many source airports they connect to? | flight_4 | select max(t0.y), count(distinct (t0.country)), count(t1.src_ap) from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.airline = 'Y8' order by count(t0.name) 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": "flight_4",
"sql": "select max(t0.y), count(distinct (t0.country)), count(t1.src_ap) from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.airline = 'Y8' order by count(t0.name) desc limit 5"
},
"style": "rule"
} | {
"index": 2267,
"split": "train"
} | |
What is the percentage change in the average staff member handling rentals for all inventory items between May 31, 2005, at 15:24:19, and July 27, 2005, at 01:08:26? | sakila_1 | select (avg(t0.c2) / cast(avg(t1.c2) as real) - 1) * 100 from (select avg(t1.staff_id) as c2 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t1.rental_date = '2005-05-31 15:24:19' group by t0.inventory_id) as t0, (select t0.inventory_id, avg(t1.staff_id) as c2 from inventory 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": "sakila_1",
"sql": "select (avg(t0.c2) / cast(avg(t1.c2) as real) - 1) * 100 from (select avg(t1.staff_id) as c2 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t1.rental_date = '2005-05-31 15:24:19' group by t0.inventory_id) as t0, (select t0.inv... | {
"index": 3918,
"split": "train"
} | |
Which are the five transaction types with the lowest average transaction amounts? | customers_card_transactions | select transaction_type as c0 from financial_transactions group by c0 order by avg(transaction_amount) 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": "customers_card_transactions",
"sql": "select transaction_type as c0 from financial_transactions group by c0 order by avg(transaction_amount) asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 78,
"split": "train"
} | |
Could you identify the three electoral register entries, including their electoral register IDs, cmi cross reference IDs, related cross reference IDs, and master customer IDs, where the cross reference ID in the rent arrears records is at least 100? Please order these results by the master customer ID from highest to l... | local_govt_mdm | select t0.electoral_register_id, t0.cmi_cross_ref_id, t1.cmi_cross_ref_id, t1.master_customer_id as c2 from electoral_register as t0 join cmi_cross_references as t1 on t0.cmi_cross_ref_id = t1.cmi_cross_ref_id join rent_arrears as t2 on t1.cmi_cross_ref_id = t2.cmi_cross_ref_id where t2.cmi_cross_ref_id >= 100 order by... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_mdm",
"sql": "select t0.electoral_register_id, t0.cmi_cross_ref_id, t1.cmi_cross_ref_id, t1.master_customer_id as c2 from electoral_register as t0 join cmi_cross_references as t1 on t0.cmi_cross_ref_id = t1.cmi_cross_ref_id join rent_arrears as t2 on t1.cmi_cross_ref_i... | {
"index": 1225,
"split": "train"
} | |
What are the course IDs and names for all courses, including those that students with person IDs of 171 or higher have registered for? | student_assessment | select anon_1.c0, anon_1.c1 from (select course_id as c0, course_name as c1 from courses union 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... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 course_id as c0, course_name as c1 from courses union 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 t... | {
"index": 2935,
"split": "train"
} | |
Which movie(s) have their latest release year as 1982, and among those, which one has the earliest of these maximum years? | movie_1 | select title as c1, max(year) as c0 from movie group by c1 having max(year) = 1982 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": "movie_1",
"sql": "select title as c1, max(year) as c0 from movie group by c1 having max(year) = 1982 order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 204,
"split": "train"
} | |
What are the details—including product ID, type code, name, and supplier ID—of the top 10 suppliers associated with product 7, sorted by supplier ID from highest to lowest? | department_store | select t0.product_id, t0.product_type_code, t0.product_name, t1.supplier_id as c0 from products as t0 join product_suppliers as t1 on t0.product_id = t1.product_id where t1.product_id = 7 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": "department_store",
"sql": "select t0.product_id, t0.product_type_code, t0.product_name, t1.supplier_id as c0 from products as t0 join product_suppliers as t1 on t0.product_id = t1.product_id where t1.product_id = 7 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 2274,
"split": "train"
} | |
Which are the first five medicines, including their FDA approval status, trade names, and IDs, that have interactions with enzymes whose product names end with "III"? The list should be sorted by FDA approval status, with null or unknown approvals appearing after the approved medicines. | medicine_enzyme_interaction | select t0.fda_approved as c2, t0.trade_name, t1.medicine_id from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id join enzyme as t2 on t1.enzyme_id = t2.id where t2.product like '%III' order by c2 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "medicine_enzyme_interaction",
"sql": "select t0.fda_approved as c2, t0.trade_name, t1.medicine_id from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id join enzyme as t2 on t1.enzyme_id = t2.id where t2.product like '%III' order by c2 asc nulls last... | {
"index": 99,
"split": "train"
} | |
Among the student course enrollment records, what are the three groups with the fewest enrollments, and what is the total number of enrollments and the sum of course IDs for each of these groups? | e_learning | select count(*) as c0, sum(course_id) from student_course_enrolment order by c0 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select count(*) as c0, sum(course_id) from student_course_enrolment order by c0 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 2335,
"split": "train"
} | |
Which students' IDs, hours they played games, and their sex have sports hours per week that are either less than the total number of sports hours recorded for all students or at least 8 hours per week? | game_1 | select t0.stuid, t0.hours_played, t1.sex from plays_games as t0 join student as t1 on t0.stuid = t1.stuid join sportsinfo as t2 on t1.stuid = t2.stuid, (select count(hoursperweek) as c0 from sportsinfo) as t0 where t2.hoursperweek < t0.c0 or t2.hoursperweek >= 8 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "game_1",
"sql": "select t0.stuid, t0.hours_played, t1.sex from plays_games as t0 join student as t1 on t0.stuid = t1.stuid join sportsinfo as t2 on t1.stuid = t2.stuid, (select count(hoursperweek) as c0 from sportsinfo) as t0 where t2.hoursperweek < t0.c0 or t2.hoursperweek >= 8"... | {
"index": 789,
"split": "train"
} | |
Can you tell me the top 3 premise types, number of premises, and address types for premises where the address type code either contains the letter "n" or is the least common address type in the database, ordered by the number of distinct premise details? | customers_campaigns_ecommerce | select count(distinct (t0.premises_type)), count(distinct (t0.premise_id)), count(distinct (t1.address_type_code)) from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id, (select address_type_code as c0 from customer_addresses group by c0 order by count(*) asc nulls last limit 1) as t0 where... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_campaigns_ecommerce",
"sql": "select count(distinct (t0.premises_type)), count(distinct (t0.premise_id)), count(distinct (t1.address_type_code)) from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id, (select address_type_code as c0 from cust... | {
"index": 462,
"split": "train"
} | |
Among the wineries with a total score sum greater than 78, which winery comes first in alphabetical order? | wine_1 | select sum(score) from wine group by winery having sum(score) > 78 order by winery 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": "wine_1",
"sql": "select sum(score) from wine group by winery having sum(score) > 78 order by winery asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2768,
"split": "train"
} | |
How many days passed between the start and end dates of the grant awarded to organization 10? | tracking_grants_for_research | select julianday(t1.c3) - julianday(t0.c1) from (select grant_start_date as c3 from grants where organisation_id = 10 and organisation_id = 10) as t1, (select grant_end_date as c1 from grants) 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.c1) from (select grant_start_date as c3 from grants where organisation_id = 10 and organisation_id = 10) as t1, (select grant_end_date as c1 from grants) as t0"
},
"style": "rule"
} | {
"index": 3743,
"split": "train"
} | |
Show all the different countries listed in the Addresses table. | customers_and_products_contacts | select distinct country from addresses | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_products_contacts",
"sql": "select distinct country from addresses"
},
"style": "rule"
} | {
"index": 815,
"split": "train"
} | |
When comparing the average product ID for product 15 with the total sum of average product IDs across all products, is the average for product 15 less than that overall sum? | tracking_orders | select t2.c0 < t1.c3 from (select avg(t1.product_id) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t0.product_id = 15 group by t0.product_id) as t2, (select sum(t0.c0) as c3 from (select avg(t1.product_id) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.p... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c0 < t1.c3 from (select avg(t1.product_id) as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t0.product_id = 15 group by t0.product_id) as t2, (select sum(t0.c0) as c3 from (select avg(t1.product_id) as c0 ... | {
"index": 3324,
"split": "train"
} | |
What are the details (Customer ID, Gender, First Name, Order ID, and Product Quantity) of the three order items with product names containing "r" that have the largest quantities? | customers_and_invoices | select t0.customer_id, t0.gender, t0.customer_first_name, t2.order_id, t2.product_quantity as c0 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id join products as t3 on t2.product_id = t3.product_id where t3.product_name like '%r%' order 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": "customers_and_invoices",
"sql": "select t0.customer_id, t0.gender, t0.customer_first_name, t2.order_id, t2.product_quantity as c0 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id join products as t3 on t... | {
"index": 2097,
"split": "train"
} | |
List the names of all races and all tracks, showing any that are present in either category. | race_track | select anon_1.c1 from (select name as c1 from race union select name from track) 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 from (select name as c1 from race union select name from track) as anon_1"
},
"style": "rule"
} | {
"index": 2066,
"split": "train"
} | |
What are the names, IDs, and software platforms of the first three Android devices when listed in reverse alphabetical order? | device | select device as c1, device_id, software_platform as c0 from device where c0 = 'Android' 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": "device",
"sql": "select device as c1, device_id, software_platform as c0 from device where c0 = 'Android' order by c1 desc limit 3"
},
"style": "rule"
} | {
"index": 1990,
"split": "train"
} | |
Show the ten schools with the lowest total budget percentages (both budgeted and invested) and their invested amounts, considering only schools whose endowment is within the total number of schools or with a school ID less than 2, ordered by the lowest total budget percentage budgeted. | school_finance | select t0.total_budget_percent_budgeted as c3, t0.total_budget_percent_invested, t0.invested from budget as t0 join school as t1 on t0.school_id = t1.school_id join endowment as t2 on t1.school_id = t2.school_id, (select count(school_id) as c2 from endowment) as t0 where t2.school_id <= t0.c2 or t2.school_id < 2 order ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "school_finance",
"sql": "select t0.total_budget_percent_budgeted as c3, t0.total_budget_percent_invested, t0.invested from budget as t0 join school as t1 on t0.school_id = t1.school_id join endowment as t2 on t1.school_id = t2.school_id, (select count(school_id) as c2 from endowm... | {
"index": 1167,
"split": "train"
} | |
How many days have passed between each booking's end date (for bookings that started on or after February 27, 2017, at 12:04:35) and the various booking start dates? | products_for_hire | select julianday(t1.c1) - julianday(t0.c3) from (select booking_end_date as c1 from bookings where booking_start_date >= '2017-02-27 12:04:35' and booking_start_date >= '2017-02-27 12:04:35') as t1, (select booking_start_date as c3 from bookings) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_for_hire",
"sql": "select julianday(t1.c1) - julianday(t0.c3) from (select booking_end_date as c1 from bookings where booking_start_date >= '2017-02-27 12:04:35' and booking_start_date >= '2017-02-27 12:04:35') as t1, (select booking_start_date as c3 from bookings) as t0... | {
"index": 3736,
"split": "train"
} | |
Which distinct G values belong to teams that recorded home game attendances either greater than or equal to 1,463,298 or within the range of 137,500 to 2,595,937? | baseball_1 | select distinct t0.g from team as t0 join home_game as t1 on t0.team_id = t1.team_id where t1.attendance >= 1463298 or t1.attendance between 137500 and 2595937 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select distinct t0.g from team as t0 join home_game as t1 on t0.team_id = t1.team_id where t1.attendance >= 1463298 or t1.attendance between 137500 and 2595937"
},
"style": "rule"
} | {
"index": 1012,
"split": "train"
} | |
Is the receipt date of the document with ID 14 later than the receipt date of the document with ID 10? | cre_Doc_Control_Systems | select t1.c0 > t0.c0 from (select receipt_date as c0 from documents where document_id = 14) as t1, (select receipt_date as c0 from documents where document_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": "cre_Doc_Control_Systems",
"sql": "select t1.c0 > t0.c0 from (select receipt_date as c0 from documents where document_id = 14) as t1, (select receipt_date as c0 from documents where document_id = 10) as t0"
},
"style": "rule"
} | {
"index": 3071,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.