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 |
|---|---|---|---|---|---|---|---|---|
How many days passed between the order date and the actual delivery date for order ID 9? | cre_Drama_Workshop_Groups | select julianday(t1.c1) - julianday(t0.c3) from (select actual_delivery_date as c1 from customer_orders) as t1, (select order_date as c3 from customer_orders where order_id = 9 and order_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": "cre_Drama_Workshop_Groups",
"sql": "select julianday(t1.c1) - julianday(t0.c3) from (select actual_delivery_date as c1 from customer_orders) as t1, (select order_date as c3 from customer_orders where order_id = 9 and order_id = 9) as t0"
},
"style": "rule"
} | {
"index": 3895,
"split": "train"
} | |
Which aircraft ID for the model C40LFR appears most frequently in the records? | pilot_record | select t0.c2 as c0, count(distinct (t0.c2)) as c1 from (select aircraft_id as c2 from aircraft where model = 'C40LFR') as t0 group by c0 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": "pilot_record",
"sql": "select t0.c2 as c0, count(distinct (t0.c2)) as c1 from (select aircraft_id as c2 from aircraft where model = 'C40LFR') as t0 group by c0 order by c1 desc limit 1"
},
"style": "rule"
} | {
"index": 3660,
"split": "train"
} | |
Is the smallest characteristic ID associated with characteristic 15 higher than the smallest characteristic ID associated with characteristic 6? | products_gen_characteristics | select t1.c1 > t0.c1 from (select min(t1.characteristic_id) as c1 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t0.characteristic_id = 15 group by t0.characteristic_id) as t1, (select t0.characteristic_id, min(t1.characteristic_id) as c1 from characte... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t1.c1 > t0.c1 from (select min(t1.characteristic_id) as c1 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t0.characteristic_id = 15 group by t0.characteristic_id) as ... | {
"index": 3883,
"split": "train"
} | |
What's the difference in price ranges between hotel 514 and hotel 442? | cre_Theme_park | select t1.c2 - t0.c2 from (select price_range as c2 from hotels where hotel_id = 442) as t1, (select price_range as c2 from hotels where hotel_id = 514) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Theme_park",
"sql": "select t1.c2 - t0.c2 from (select price_range as c2 from hotels where hotel_id = 442) as t1, (select price_range as c2 from hotels where hotel_id = 514) as t0"
},
"style": "rule"
} | {
"index": 3592,
"split": "train"
} | |
What are the top three most common member positions in clubs, and how many members hold each of these positions? | club_1 | select position as c0, count(position) as c1 from member_of_club group by c0 order by c1 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "club_1",
"sql": "select position as c0, count(position) as c1 from member_of_club group by c0 order by c1 desc limit 3"
},
"style": "rule"
} | {
"index": 279,
"split": "train"
} | |
Among products related to product ID 3, what are the top 10 products with the highest average product ID in their regular orders? | customer_deliveries | select avg(t0.product_id) as c0, t1.product_id as c1 from regular_order_products as t0 join products as t1 on t0.product_id = t1.product_id where c1 = 3 group by c1 order by c0 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_deliveries",
"sql": "select avg(t0.product_id) as c0, t1.product_id as c1 from regular_order_products as t0 join products as t1 on t0.product_id = t1.product_id where c1 = 3 group by c1 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 1537,
"split": "train"
} | |
What are the smallest and largest numbers of unique transactions associated with any share lot? | tracking_share_transactions | select min(t0.c1), max(t0.c1) from (select count(distinct (t1.transaction_id)) as c1 from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id group by t0.lot_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": "tracking_share_transactions",
"sql": "select min(t0.c1), max(t0.c1) from (select count(distinct (t1.transaction_id)) as c1 from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id group by t0.lot_id) as t0"
},
"style": "rule"
} | {
"index": 3650,
"split": "train"
} | |
What are the manager IDs, department IDs, and location IDs for departments that have employees hired on or after September 18, 1987, but do not have any employees whose last names begin with "Atkin"? | hr_1 | select anon_1.c1, anon_1.c0, anon_1.c2 from (select t0.manager_id as c1, t0.department_id as c0, t0.location_id as c2 from departments as t0 join employees as t1 on t0.department_id = t1.department_id where t1.hire_date >= '1987-09-18 00:00:00' except select t0.manager_id as c1, t0.department_id as c0, t0.location_id 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": "hr_1",
"sql": "select anon_1.c1, anon_1.c0, anon_1.c2 from (select t0.manager_id as c1, t0.department_id as c0, t0.location_id as c2 from departments as t0 join employees as t1 on t0.department_id = t1.department_id where t1.hire_date >= '1987-09-18 00:00:00' except select t0.man... | {
"index": 735,
"split": "train"
} | |
How many total flights and how many of those flights have a recorded distance for each aircraft with a name that includes "AB 3"? | flight_1 | select count(*), count(t0.distance), t1.aid as c1 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.name like '%AB 3%' group by c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_1",
"sql": "select count(*), count(t0.distance), t1.aid as c1 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.name like '%AB 3%' group by c1"
},
"style": "rule"
} | {
"index": 1499,
"split": "train"
} | |
Can you provide the profits in billion and the company names for the top 10 companies, where their offices are located in buildings with exactly 57 stories? Please list the results sorted in reverse alphabetical order of the company names. | company_office | select t0.profits_billion, t0.name as c0 from companies as t0 join office_locations as t1 on t0.id = t1.company_id join buildings as t2 on t1.building_id = t2.id where t2.stories = 57 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": "company_office",
"sql": "select t0.profits_billion, t0.name as c0 from companies as t0 join office_locations as t1 on t0.id = t1.company_id join buildings as t2 on t1.building_id = t2.id where t2.stories = 57 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 2224,
"split": "train"
} | |
Can you tell me the complaint type codes and staff IDs for all complaints related to product number 119, sorted by customer ID with any missing customer IDs placed last? | customer_complaints | select t0.complaint_type_code, t0.staff_id from complaints as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_id = 119 order by t0.customer_id asc nulls last | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select t0.complaint_type_code, t0.staff_id from complaints as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_id = 119 order by t0.customer_id asc nulls last"
},
"style": "rule"
} | {
"index": 1945,
"split": "train"
} | |
What are the genre IDs, genre names, and album IDs for tracks performed by artists whose names are exactly "Aerosmith & Sierra Leone's Refugee Allstars" or contain the substring "rman"? | chinook_1 | select t0.genreid, t0.name, t1.albumid from genre as t0 join track as t1 on t0.genreid = t1.genreid join album as t2 on t1.albumid = t2.albumid join artist as t3 on t2.artistid = t3.artistid where t3.name = 'Aerosmith & Sierra Leone''s Refugee Allstars' or t3.name like '%rman%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.genreid, t0.name, t1.albumid from genre as t0 join track as t1 on t0.genreid = t1.genreid join album as t2 on t1.albumid = t2.albumid join artist as t3 on t2.artistid = t3.artistid where t3.name = 'Aerosmith & Sierra Leone''s Refugee Allstars' or t3.... | {
"index": 645,
"split": "train"
} | |
What are the station IDs, the number of bikes available, and the station identifiers for the first three stations (sorted by station ID) that are located either east of -122.400862 or west of -122.227424? | bike_1 | select t0.station_id, t0.bikes_available, t1.id as c2 from status as t0 join station as t1 on t0.station_id = t1.id where t1.long > -122.40086200000002 or t1.long < -122.227424 order by c2 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "bike_1",
"sql": "select t0.station_id, t0.bikes_available, t1.id as c2 from status as t0 join station as t1 on t0.station_id = t1.id where t1.long > -122.40086200000002 or t1.long < -122.227424 order by c2 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 112,
"split": "train"
} | |
In which years did either postseason games or regular home games take place? | baseball_1 | select anon_1.c1 from (select year as c1 from postseason union select year from home_game) 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": "baseball_1",
"sql": "select anon_1.c1 from (select year as c1 from postseason union select year from home_game) as anon_1"
},
"style": "rule"
} | {
"index": 2206,
"split": "train"
} | |
Which three of the most frequently occurring headquarters have fewer than 103.3 different sales billion values and sales below the maximum seen in the dataset, ordered by the least number of unique sales billion figures? | company_office | select t0.headquarters as c0 from companies as t0, (select headquarters as c0 from companies group by c0 order by count(*) desc limit 1) as t1, (select max(sales_billion) as c1 from companies) as t0 where c0 = t1.c0 and t0.sales_billion < t0.c1 group by c0 having count(distinct (t0.sales_billion)) < 103.3 order by coun... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.headquarters as c0 from companies as t0, (select headquarters as c0 from companies group by c0 order by count(*) desc limit 1) as t1, (select max(sales_billion) as c1 from companies) as t0 where c0 = t1.c0 and t0.sales_billion < t0.c1 group by c... | {
"index": 866,
"split": "train"
} | |
What are the airport IDs and pilot names of flights where the velocity is at least as high as the total number of different velocities recorded, and the flights are operated by companies with IDs of 9 or higher? | flight_company | select t0.id, t1.pilot from airport as t0 join flight as t1 on t0.id = t1.airport_id, (select count(distinct (velocity)) as c0 from flight) as t0 where t1.velocity >= t0.c0 and t1.company_id >= 9 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_company",
"sql": "select t0.id, t1.pilot from airport as t0 join flight as t1 on t0.id = t1.airport_id, (select count(distinct (velocity)) as c0 from flight) as t0 where t1.velocity >= t0.c0 and t1.company_id >= 9"
},
"style": "rule"
} | {
"index": 161,
"split": "train"
} | |
Is the creation date of tweet 5 earlier than that of tweet 6? | twitter_1 | select t1.c1 < t0.c1 from (select createdate as c1 from tweets where id = 5) as t1, (select createdate as c1 from tweets where id = 6) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "twitter_1",
"sql": "select t1.c1 < t0.c1 from (select createdate as c1 from tweets where id = 5) as t1, (select createdate as c1 from tweets where id = 6) as t0"
},
"style": "rule"
} | {
"index": 3156,
"split": "train"
} | |
Can you list the publisher, author or editor, and year for each book club, along with the book club ID and the company name from the Culture Company database, where the associated movies have either a budget equal to the number of distinct budgets less than or equal to 62 million from before 2001, or a budget under 6 m... | culture_company | select t0.publisher, t0.author_or_editor, t0.year, t1.book_club_id, t1.company_name as c5 from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id join movie as t2 on t1.movie_id = t2.movie_id, (select count(distinct (budget_million)) as c3 from movie where budget_million <= 62.0 and year < ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "culture_company",
"sql": "select t0.publisher, t0.author_or_editor, t0.year, t1.book_club_id, t1.company_name as c5 from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id join movie as t2 on t1.movie_id = t2.movie_id, (select count(distinct (budget_m... | {
"index": 1910,
"split": "train"
} | |
Can you list the channel codes and contact numbers from the Customer Contact Channels table, sorted by customer ID with any missing IDs appearing last? | customers_and_addresses | select channel_code, contact_number from customer_contact_channels order by customer_id asc nulls last | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_addresses",
"sql": "select channel_code, contact_number from customer_contact_channels order by customer_id asc nulls last"
},
"style": "rule"
} | {
"index": 2795,
"split": "train"
} | |
Can you show the profits in billions, headquarters, and IDs for companies that have fewer than four office locations, but only if their offices are located in existing buildings or specifically in building number 11? | company_office | select t0.profits_billion, t0.headquarters, t0.id as c0 from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.building_id in (select buildings.id as c2 from buildings) or t1.building_id = 11 group by c0 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": "company_office",
"sql": "select t0.profits_billion, t0.headquarters, t0.id as c0 from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.building_id in (select buildings.id as c2 from buildings) or t1.building_id = 11 group by c0 having count(*) < 4"
... | {
"index": 1274,
"split": "train"
} | |
Which staff members authorized the closure of problems related to products with IDs less than 4? Please provide their staff IDs. | tracking_software_problems | select t0.staff_id from staff as t0 join problems as t1 on t0.staff_id = t1.closure_authorised_by_staff_id where t1.product_id < 4 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t0.staff_id from staff as t0 join problems as t1 on t0.staff_id = t1.closure_authorised_by_staff_id where t1.product_id < 4"
},
"style": "rule"
} | {
"index": 2408,
"split": "train"
} | |
What is the difference between the bike ID for trip 903780 and 213? | bike_1 | select bike_id - 213 from trip where id = 903780 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "bike_1",
"sql": "select bike_id - 213 from trip where id = 903780"
},
"style": "rule"
} | {
"index": 3213,
"split": "train"
} | |
What is the party ID and the number of hosts for the party with ID 5 that is located in a place containing the letter "m"? | party_host | select party_id as c1, count(number_of_hosts) from party where location like '%m%' and c1 = 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": "party_host",
"sql": "select party_id as c1, count(number_of_hosts) from party where location like '%m%' and c1 = 5 group by c1"
},
"style": "rule"
} | {
"index": 1173,
"split": "train"
} | |
What are the capacities, locations, opening years, and cinema IDs of cinemas that are scheduled to show the film with ID 5? | cinema | select anon_1.c0, anon_1.c2, anon_1.c3, anon_1.c1 from (select capacity as c0, location as c2, openning_year as c3, cinema_id as c1 from cinema intersect select t0.capacity as c0, t0.location as c2, t0.openning_year as c3, t0.cinema_id as c1 from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id join film... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c2, anon_1.c3, anon_1.c1 from (select capacity as c0, location as c2, openning_year as c3, cinema_id as c1 from cinema intersect select t0.capacity as c0, t0.location as c2, t0.openning_year as c3, t0.cinema_id as c1 from cinema as t0 joi... | {
"index": 1130,
"split": "train"
} | |
How many skills with skill ID 1 are there for each skill description? | assets_maintenance | select skill_description as c1, count(skill_description) from skills where skill_id = 1 or skill_id = 1 group by c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "assets_maintenance",
"sql": "select skill_description as c1, count(skill_description) from skills where skill_id = 1 or skill_id = 1 group by c1"
},
"style": "rule"
} | {
"index": 40,
"split": "train"
} | |
How many unique organizations classified as 'RES' have details that start with the letter "i"? | tracking_grants_for_research | select t0.c2 from (select count(distinct (t1.organisation_id)) as c2 from organisation_types as t0 join organisations as t1 on t0.organisation_type = t1.organisation_type where t0.organisation_type = 'RES' and t1.organisation_details like 'i%' group by t0.organisation_type) 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 t0.c2 from (select count(distinct (t1.organisation_id)) as c2 from organisation_types as t0 join organisations as t1 on t0.organisation_type = t1.organisation_type where t0.organisation_type = 'RES' and t1.organisation_details like 'i... | {
"index": 3402,
"split": "train"
} | |
Did the booking with ID 9 start after the booking with ID 13? | products_for_hire | select t1.c1 > t0.c1 from (select booking_start_date as c1 from bookings where booking_id = 9) as t1, (select booking_start_date as c1 from bookings where booking_id = 13) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_for_hire",
"sql": "select t1.c1 > t0.c1 from (select booking_start_date as c1 from bookings where booking_id = 9) as t1, (select booking_start_date as c1 from bookings where booking_id = 13) as t0"
},
"style": "rule"
} | {
"index": 3093,
"split": "train"
} | |
What is the percentage change in the number of unique customer events for customer 19 associated with the move-in date of March 27, 2015 at noon? | local_govt_and_lot | select (t0.c2 / cast(t0.c2 as real) - 1) * 100 from (select count(distinct (t1.customer_event_id)) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_and_lot",
"sql": "select (t0.c2 / cast(t0.c2 as real) - 1) * 100 from (select count(distinct (t1.customer_event_id)) as c2 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2015-03-27 12... | {
"index": 3920,
"split": "train"
} | |
What was the change in the number of followers for user 1 between the evening of March 9, 2018, and early morning of March 12, 2018? | twitter_1 | select t1.c0 - t0.c0 from (select t0.followers as c0 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.createdate = '2018-03-09 20:00:14') as t1, (select t0.followers as c0, t0.uid from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.createdate = '201... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "twitter_1",
"sql": "select t1.c0 - t0.c0 from (select t0.followers as c0 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.createdate = '2018-03-09 20:00:14') as t1, (select t0.followers as c0, t0.uid from user_profiles as t0 join tweets as t1 ... | {
"index": 3536,
"split": "train"
} | |
Which customers currently living at the most common address, and what is the average of their past address IDs along with their customer number and customer ID? | customers_and_products_contacts | select avg(t0.address_id), t1.customer_number, t1.customer_id as c1 from customer_address_history as t0 join customers as t1 on t0.customer_id = t1.customer_id, (select customer_address as c2 from customers group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.customer_address = t0.c2 group by c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_products_contacts",
"sql": "select avg(t0.address_id), t1.customer_number, t1.customer_id as c1 from customer_address_history as t0 join customers as t1 on t0.customer_id = t1.customer_id, (select customer_address as c2 from customers group by c2 order by count(*) a... | {
"index": 1718,
"split": "train"
} | |
What is the difference in the maximum user ID for user 1's tweets between March 12th at 2:30 AM and March 9th at 8 PM in 2018? | twitter_1 | select t1.c2 - t0.c2 from (select max(t1.uid) as c2 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.createdate = '2018-03-12 02:30:30' group by t0.uid) as t1, (select t0.uid, max(t1.uid) as c2 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.cre... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c2 - t0.c2 from (select max(t1.uid) as c2 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.createdate = '2018-03-12 02:30:30' group by t0.uid) as t1, (select t0.uid, max(t1.uid) as c2 from user_profiles as t0 join... | {
"index": 3535,
"split": "train"
} | |
How many days passed between the start and end dates of grants that had a grant amount less than 24.7? | tracking_grants_for_research | select julianday(t1.c2) - julianday(t0.c0) from (select grant_end_date as c2 from grants) as t1, (select grant_start_date as c0 from grants where grant_amount < 24.7 and grant_amount < 24.7) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select julianday(t1.c2) - julianday(t0.c0) from (select grant_end_date as c2 from grants) as t1, (select grant_start_date as c0 from grants where grant_amount < 24.7 and grant_amount < 24.7) as t0"
},
"style": "rule"
} | {
"index": 3745,
"split": "train"
} | |
What is the birth date of the person with ID 6 at the time they were tallest? | entrepreneur | select t0.date_of_birth, t0.height as c1 from people as t0, (select max(height) as c0 from people where people_id = 6) as t1 where c1 = t1.c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "entrepreneur",
"sql": "select t0.date_of_birth, t0.height as c1 from people as t0, (select max(height) as c0 from people where people_id = 6) as t1 where c1 = t1.c0"
},
"style": "rule"
} | {
"index": 3770,
"split": "train"
} | |
What is the market share of the browser with ID 2? | browser_web | select market_share from browser where 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": "browser_web",
"sql": "select market_share from browser where id = 2"
},
"style": "rule"
} | {
"index": 3359,
"split": "train"
} | |
Can you tell me the room count, building ID, and bedroom count for the first five apartments rented to guests whose gender code ends with "e", ordered by the number of rooms? | apartment_rentals | select t0.room_count as c1, t0.building_id, t0.bedroom_count from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.gender_code like '%e' 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": "apartment_rentals",
"sql": "select t0.room_count as c1, t0.building_id, t0.bedroom_count from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.gender_code like '%e' order by c1 asc nulls last limit 5"
... | {
"index": 2775,
"split": "train"
} | |
What are the five lowest support rates among candidates from the most frequently used poll source? | candidate_poll | select t0.support_rate as c1 from candidate as t0, (select poll_source as c0 from candidate group by c0 order by count(*) desc limit 1) as t0 where t0.poll_source = t0.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": "candidate_poll",
"sql": "select t0.support_rate as c1 from candidate as t0, (select poll_source as c0 from candidate group by c0 order by count(*) desc limit 1) as t0 where t0.poll_source = t0.c0 order by c1 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 875,
"split": "train"
} | |
Show the departure times and train IDs for trains that serve stations with main services on the Main Line. | train_station | select anon_1.c0, anon_1.c1 from (select time as c0, train_id as c1 from train intersect select t0.time as c0, t0.train_id as c1 from train as t0 join train_station as t1 on t0.train_id = t1.train_id join station as t2 on t1.station_id = t2.station_id where t2.main_services like '%Main Line') 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": "train_station",
"sql": "select anon_1.c0, anon_1.c1 from (select time as c0, train_id as c1 from train intersect select t0.time as c0, t0.train_id as c1 from train as t0 join train_station as t1 on t0.train_id = t1.train_id join station as t2 on t1.station_id = t2.station_id wher... | {
"index": 1958,
"split": "train"
} | |
Which five invoice lines have the lowest maximum track IDs among invoices numbered between 117 and 178, when grouped by their line ID and sorted in order? | store_1 | select max(track_id) from invoice_lines where invoice_id between 117 and 178 group by id order by id asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select max(track_id) from invoice_lines where invoice_id between 117 and 178 group by id order by id asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 1962,
"split": "train"
} | |
How far is the highest country ID linked to country 24558 from 21518? | soccer_1 | select t0.c1 - 21518 from (select max(t1.country_id) as c1 from country as t0 join league as t1 on t0.id = t1.country_id where t0.id = 24558 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": "soccer_1",
"sql": "select t0.c1 - 21518 from (select max(t1.country_id) as c1 from country as t0 join league as t1 on t0.id = t1.country_id where t0.id = 24558 group by t0.id) as t0"
},
"style": "rule"
} | {
"index": 3252,
"split": "train"
} | |
What are the complaint status codes, dates when complaints were raised, and staff IDs for customers whose phone numbers start with "044," ordered by complaint status code with any missing statuses at the end? | customer_complaints | select t0.complaint_status_code as c2, t0.date_complaint_raised, t0.staff_id from complaints as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.phone_number like '044%' 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": "customer_complaints",
"sql": "select t0.complaint_status_code as c2, t0.date_complaint_raised, t0.staff_id from complaints as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.phone_number like '044%' order by c2 asc nulls last"
},
"style": "rule"
} | {
"index": 906,
"split": "train"
} | |
Can you list the first five movies along with their IDs, titles, directors, and ratings (including rating IDs and stars) where the reviewer’s name starts with "Elizabeth Th," sorted by movie ID? | movie_1 | select t0.mid as c1, t0.title, t0.director, t1.mid, t1.stars from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid where t2.name like 'Elizabeth Th%' 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": "movie_1",
"sql": "select t0.mid as c1, t0.title, t0.director, t1.mid, t1.stars from movie as t0 join rating as t1 on t0.mid = t1.mid join reviewer as t2 on t1.rid = t2.rid where t2.name like 'Elizabeth Th%' order by c1 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2111,
"split": "train"
} | |
Can you tell me the names of the departments, their heads, and department IDs, along with the treatments they offer, where the treatments are relatively inexpensive—specifically, treatments priced below the lowest cost among procedures costing at least 5600 or procedures costing 25 or less, or simply treatments costing... | hospital_1 | select t0.name, t0.head, t0.departmentid, t2.treatment from department as t0 join physician as t1 on t0.head = t1.employeeid join trained_in as t2 on t1.employeeid = t2.physician join procedures as t3 on t2.treatment = t3.code, (select min(cost) as c1 from procedures where cost >= 5600.0 or cost <= 25.0) as t0 where t3... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "hospital_1",
"sql": "select t0.name, t0.head, t0.departmentid, t2.treatment from department as t0 join physician as t1 on t0.head = t1.employeeid join trained_in as t2 on t1.employeeid = t2.physician join procedures as t3 on t2.treatment = t3.code, (select min(cost) as c1 from pr... | {
"index": 2443,
"split": "train"
} | |
What are the lowest-ranked reviews, their ratings, and the user IDs of the reviewers, for users who trust users with IDs up to 2? Show the first five such entries ordered by user ID. | epinions_1 | select t0.rank, t0.rating, t1.u_id as c2 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.target_u_id <= 2 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": "epinions_1",
"sql": "select t0.rank, t0.rating, t1.u_id as c2 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.target_u_id <= 2 order by c2 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2255,
"split": "train"
} | |
Is the architect who built the mill with ID 3 assigned an architect ID that is less than the average architect ID of all mills built after 1819? | architecture | select t2.c3 < t1.c0 from (select architect_id as c3 from mill where id = 3) as t2, (select avg(architect_id) as c0 from mill where built_year > 1819) as t1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "architecture",
"sql": "select t2.c3 < t1.c0 from (select architect_id as c3 from mill where id = 3) as t2, (select avg(architect_id) as c0 from mill where built_year > 1819) as t1"
},
"style": "rule"
} | {
"index": 3307,
"split": "train"
} | |
Does the grant with ID 15 have an end date that is after its own end date? | tracking_grants_for_research | select grant_end_date > grant_end_date from grants where grant_id = 15 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select grant_end_date > grant_end_date from grants where grant_id = 15"
},
"style": "rule"
} | {
"index": 3103,
"split": "train"
} | |
What are the grape varieties and their colors used in wines from appellations with number 52, excluding those from regions whose counties include "do"? | wine_1 | select anon_1.c1, anon_1.c0 from (select t0.grape as c1, t0.color as c0 from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.no = 52 except select t0.grape as c1, t0.color as c0 from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellatio... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c1, anon_1.c0 from (select t0.grape as c1, t0.color as c0 from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.no = 52 except select t0.grape as c1, t0.color as c0 from grapes as ... | {
"index": 1326,
"split": "train"
} | |
Could you tell me the highest maximum page size and corresponding product ID for the products with IDs 6 or 1, ordered by the product name alphabetically, showing only the top result? | store_product | select t0.max_page_size from product as t0 join store_product as t1 on t0.product_id = t1.product_id where t1.product_id = 6 or t1.product_id = 1 order by t0.product 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_product",
"sql": "select t0.max_page_size from product as t0 join store_product as t1 on t0.product_id = t1.product_id where t1.product_id = 6 or t1.product_id = 1 order by t0.product asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2729,
"split": "train"
} | |
What are the unique movie IDs, company names, and book club IDs associated with the culture companies? | culture_company | select distinct movie_id, company_name, book_club_id from culture_company | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct movie_id, company_name, book_club_id from culture_company"
},
"style": "rule"
} | {
"index": 2997,
"split": "train"
} | |
What is the total sum of premise IDs for premise 6? | customers_campaigns_ecommerce | select t0.c2 from (select sum(t1.premise_id) as c2 from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id where t0.premise_id = 6 group by t0.premise_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_campaigns_ecommerce",
"sql": "select t0.c2 from (select sum(t1.premise_id) as c2 from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id where t0.premise_id = 6 group by t0.premise_id) as t0"
},
"style": "rule"
} | {
"index": 3372,
"split": "train"
} | |
Which are the top 10 aircrafts that have flown at most two times on flights covering either exactly 6900 units of distance or more than 30 units, sorted by the number of such flights? | flight_1 | select count(*) as c0, t0.aid as c1 from aircraft as t0 join flight as t1 on t0.aid = t1.aid where t0.distance = 6900 or t0.distance > 30 group by c1 having c0 <= 2 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": "flight_1",
"sql": "select count(*) as c0, t0.aid as c1 from aircraft as t0 join flight as t1 on t0.aid = t1.aid where t0.distance = 6900 or t0.distance > 30 group by c1 having c0 <= 2 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 1650,
"split": "train"
} | |
When did the customer with the highest ID less than or equal to 4 place their orders? | department_store | select t0.order_date, t0.customer_id as c2 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where customer_id <= 4) as t1 where c2 = t1.c3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select t0.order_date, t0.customer_id as c2 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where customer_id <= 4) as t1 where c2 = t1.c3"
},
"style": "rule"
} | {
"index": 3764,
"split": "train"
} | |
Which grants have started after a certain date, and what are their grant IDs, along with details and IDs of the organizations involved in projects that have task IDs greater than 7? Please list the results sorted by the grant start date, placing any null start dates at the end. | tracking_grants_for_research | select t0.grant_start_date as c2, t0.grant_id, t1.organisation_details, t1.organisation_id from grants as t0 join organisations as t1 on t0.organisation_id = t1.organisation_id join projects as t2 on t1.organisation_id = t2.organisation_id join tasks as t3 on t2.project_id = t3.project_id where t3.project_id > 7 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": "tracking_grants_for_research",
"sql": "select t0.grant_start_date as c2, t0.grant_id, t1.organisation_details, t1.organisation_id from grants as t0 join organisations as t1 on t0.organisation_id = t1.organisation_id join projects as t2 on t1.organisation_id = t2.organisation_id j... | {
"index": 606,
"split": "train"
} | |
What is the highest user ID less than or equal to 2 who reviewed item 7? | epinions_1 | select t0.c1 from (select max(t1.u_id) as c1 from item as t0 join review as t1 on t0.i_id = t1.i_id where t0.i_id = 7 and t1.u_id <= 2 group by t0.i_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": "epinions_1",
"sql": "select t0.c1 from (select max(t1.u_id) as c1 from item as t0 join review as t1 on t0.i_id = t1.i_id where t0.i_id = 7 and t1.u_id <= 2 group by t0.i_id) as t0"
},
"style": "rule"
} | {
"index": 3380,
"split": "train"
} | |
What is the difference in length between the bridge with ID 10 and the longest bridge designed by the architect with ID 5? | architecture | select t2.c0 - t0.c2 from (select max(length_feet) as c0 from bridge where architect_id = 5) as t2, (select length_feet as c2 from bridge where 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": "architecture",
"sql": "select t2.c0 - t0.c2 from (select max(length_feet) as c0 from bridge where architect_id = 5) as t2, (select length_feet as c2 from bridge where id = 10) as t0"
},
"style": "rule"
} | {
"index": 3157,
"split": "train"
} | |
For each payment method used in invoices, what are the three highest product IDs associated with that payment method, sorted from the largest to the smallest? | cre_Drama_Workshop_Groups | select payment_method_code as c0, max(product_id) as c1 from invoices group by c0 order by c1 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Drama_Workshop_Groups",
"sql": "select payment_method_code as c0, max(product_id) as c1 from invoices group by c0 order by c1 desc limit 3"
},
"style": "rule"
} | {
"index": 890,
"split": "train"
} | |
What are the unique combinations of card IDs and account IDs for transactions linked to accounts whose names include "2" or start with "38"? | customers_card_transactions | select distinct t0.card_id, t0.account_id from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.account_name like '%2%' or t1.account_name like '38%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct t0.card_id, t0.account_id from financial_transactions as t0 join accounts as t1 on t0.account_id = t1.account_id where t1.account_name like '%2%' or t1.account_name like '38%'"
},
"style": "rule"
} | {
"index": 1497,
"split": "train"
} | |
What are the ages of the three youngest individuals who are friends with either Bob or Zach? | network_2 | select t0.age as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.friend = 'Bob' or t1.friend = 'Zach' 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": "network_2",
"sql": "select t0.age as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.friend = 'Bob' or t1.friend = 'Zach' order by c0 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 2673,
"split": "train"
} | |
What are the structure codes and access counts of documents that have sections starting with "befo"? | document_management | select t0.document_structure_code, t0.access_count from documents as t0 join document_sections as t1 on t0.document_code = t1.document_code where t1.section_title like 'befo%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "document_management",
"sql": "select t0.document_structure_code, t0.access_count from documents as t0 join document_sections as t1 on t0.document_code = t1.document_code where t1.section_title like 'befo%'"
},
"style": "rule"
} | {
"index": 1369,
"split": "train"
} | |
Which heads, managing departments with rankings between greater than 2 and less than 15, have their names and birth states? | department_management | select anon_1.c1, anon_1.c0 from (select t0.name as c1, t0.born_state as c0 from head as t0 join management as t1 on t0.head_id = t1.head_id join department as t2 on t1.department_id = t2.department_id where t2.ranking > 2 intersect select t0.name as c1, t0.born_state as c0 from head as t0 join management as t1 on t0.h... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_management",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.name as c1, t0.born_state as c0 from head as t0 join management as t1 on t0.head_id = t1.head_id join department as t2 on t1.department_id = t2.department_id where t2.ranking > 2 intersect select t0.name ... | {
"index": 2933,
"split": "train"
} | |
Which authors or editors are associated with book clubs that are linked to companies whose names start with "Ca"? | culture_company | select t0.author_or_editor from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where t1.company_name like 'Ca%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "culture_company",
"sql": "select t0.author_or_editor from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where t1.company_name like 'Ca%'"
},
"style": "rule"
} | {
"index": 637,
"split": "train"
} | |
When was the course with the highest course ID among enrollments on or after November 13, 2017, completed? | e_learning | select t0.date_of_completion, t0.course_id as c1 from student_course_enrolment as t0, (select max(course_id) as c3 from student_course_enrolment where date_of_enrolment >= '2017-11-13 12:49:33') as t1 where c1 = t1.c3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select t0.date_of_completion, t0.course_id as c1 from student_course_enrolment as t0, (select max(course_id) as c3 from student_course_enrolment where date_of_enrolment >= '2017-11-13 12:49:33') as t1 where c1 = t1.c3"
},
"style": "rule"
} | {
"index": 3815,
"split": "train"
} | |
Is the average product ID for product 4 less than 6? | customer_deliveries | select t0.c0 < 6.0 from (select avg(t1.product_id) as c0 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t0.product_id = 4 group by t0.product_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_deliveries",
"sql": "select t0.c0 < 6.0 from (select avg(t1.product_id) as c0 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t0.product_id = 4 group by t0.product_id) as t0"
},
"style": "rule"
} | {
"index": 3872,
"split": "train"
} | |
Which station IDs are associated with station companies that have a station ID of 1, listed in descending order of station ID? | gas_company | select station_id as c0 from station_company where c0 = 1 order by c0 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": "gas_company",
"sql": "select station_id as c0 from station_company where c0 = 1 order by c0 desc"
},
"style": "rule"
} | {
"index": 1847,
"split": "train"
} | |
Can you provide the state, province, or county name along with the address ID for all addresses associated with customer address history entries that have an address ID less than the highest address ID in the history? | customers_and_products_contacts | select t0.state_province_county, t1.address_id as c0 from addresses as t0 join customer_address_history as t1 on t0.address_id = t1.address_id, (select max(address_id) as c2 from customer_address_history) as t0 where c0 < t0.c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_products_contacts",
"sql": "select t0.state_province_county, t1.address_id as c0 from addresses as t0 join customer_address_history as t1 on t0.address_id = t1.address_id, (select max(address_id) as c2 from customer_address_history) as t0 where c0 < t0.c2"
},
"s... | {
"index": 909,
"split": "train"
} | |
Can you tell me the first five invoices for customers in NSW, showing the billing state and customer ID, sorted so that the customers with email addresses later in the alphabet appear first? | store_1 | select t0.billing_state, t0.customer_id from invoices as t0 join customers as t1 on t0.customer_id = t1.id where t1.state = 'NSW' order by t1.email desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select t0.billing_state, t0.customer_id from invoices as t0 join customers as t1 on t0.customer_id = t1.id where t1.state = 'NSW' order by t1.email desc limit 5"
},
"style": "rule"
} | {
"index": 2218,
"split": "train"
} | |
What are the store and product IDs for all products sold in stores located within the district that has store ID 2? | store_product | select t0.store_id, t0.product_id, t1.store_id from store_product as t0 join store as t1 on t0.store_id = t1.store_id join store_district as t2 on t1.store_id = t2.store_id where t2.store_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": "store_product",
"sql": "select t0.store_id, t0.product_id, t1.store_id from store_product as t0 join store as t1 on t0.store_id = t1.store_id join store_district as t2 on t1.store_id = t2.store_id where t2.store_id = 2"
},
"style": "rule"
} | {
"index": 1333,
"split": "train"
} | |
Which activities with IDs of 782 or higher have their names and IDs listed, along with the average of their activity IDs? | activity_1 | select t0.activity_name, t0.actid as c2, avg(t1.actid) from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.actid >= 782 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": "activity_1",
"sql": "select t0.activity_name, t0.actid as c2, avg(t1.actid) from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid where t1.actid >= 782 group by c2"
},
"style": "rule"
} | {
"index": 1751,
"split": "train"
} | |
Can you determine the difference between the highest apartment ID found among apartments with more than four bedrooms (taking the smallest of these maximum IDs) and the maximum apartment ID for apartment number 10? | apartment_rentals | select t2.c0 - t0.c2 from (select min(t1.c2) as c0 from (select max(t1.apt_id) as c2 from apartments as t0 join view_unit_status as t1 on t0.apt_id = t1.apt_id where t0.bedroom_count > 4 group by t0.apt_id) as t1) as t2, (select t0.apt_id, max(t1.apt_id) as c2 from apartments as t0 join view_unit_status as t1 on t0.apt... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "apartment_rentals",
"sql": "select t2.c0 - t0.c2 from (select min(t1.c2) as c0 from (select max(t1.apt_id) as c2 from apartments as t0 join view_unit_status as t1 on t0.apt_id = t1.apt_id where t0.bedroom_count > 4 group by t0.apt_id) as t1) as t2, (select t0.apt_id, max(t1.apt_i... | {
"index": 3180,
"split": "train"
} | |
Which students and their registration IDs are enrolled in courses where they have both taken tests on or before March 25, 2018, at noon twelve minutes and eight seconds, and earned test results starting with "P"? | e_learning | select anon_1.c1, anon_1.c0 from (select t0.student_id as c1, t0.registration_id as c0 from student_course_enrolment as t0 join student_tests_taken as t1 on t0.registration_id = t1.registration_id where t1.date_test_taken <= '2018-03-25 12:00:08' intersect select t0.student_id as c1, t0.registration_id as c0 from stude... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.student_id as c1, t0.registration_id as c0 from student_course_enrolment as t0 join student_tests_taken as t1 on t0.registration_id = t1.registration_id where t1.date_test_taken <= '2018-03-25 12:00:08' intersect se... | {
"index": 2214,
"split": "train"
} | |
How many trains have the train ID of 1? | train_station | select count(*) from train where train_id = 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": "train_station",
"sql": "select count(*) from train where train_id = 1"
},
"style": "rule"
} | {
"index": 1677,
"split": "train"
} | |
Which players have their name, points, and player ID, and are also members of the club with ID 4? | sports_competition | select anon_1.c0, anon_1.c1, anon_1.c2 from (select name as c0, points as c1, player_id as c2 from player intersect select t0.name as c0, t0.points as c1, t0.player_id as c2 from player as t0 join club as t1 on t0.club_id = t1.club_id where t1.club_id = 4) as anon_1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "sports_competition",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select name as c0, points as c1, player_id as c2 from player intersect select t0.name as c0, t0.points as c1, t0.player_id as c2 from player as t0 join club as t1 on t0.club_id = t1.club_id where t1.club_id... | {
"index": 1901,
"split": "train"
} | |
What are the three team names with the fewest appearances for the team with ID 5? | match_season | select name as c0 from team where team_id = 5 group by c0 order by count(name) 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": "match_season",
"sql": "select name as c0 from team where team_id = 5 group by c0 order by count(name) asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 2154,
"split": "train"
} | |
For each customer, what is their support representative's ID, company name, phone number, and the total number of tracks purchased? | store_1 | select t0.support_rep_id, t0.company, t0.phone, count(t2.track_id) from customers as t0 join invoices as t1 on t0.id = t1.customer_id join invoice_lines as t2 on t1.id = t2.invoice_id group by t0.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": "store_1",
"sql": "select t0.support_rep_id, t0.company, t0.phone, count(t2.track_id) from customers as t0 join invoices as t1 on t0.id = t1.customer_id join invoice_lines as t2 on t1.id = t2.invoice_id group by t0.id"
},
"style": "rule"
} | {
"index": 2902,
"split": "train"
} | |
What are the total sum of staff IDs, the average lesson price, and the total number of lessons for customers born between May 23, 1996, and September 18, 1998, focusing on the customer with the fewest lessons? | driving_school | select sum(t0.staff_id), avg(t0.price), count(t0.lesson_time) as c1 from lessons as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_of_birth between '1996-05-23 01:21:54' and '1998-09-18 04:45:01' 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": "driving_school",
"sql": "select sum(t0.staff_id), avg(t0.price), count(t0.lesson_time) as c1 from lessons as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_of_birth between '1996-05-23 01:21:54' and '1998-09-18 04:45:01' order by c1 asc nulls last limit ... | {
"index": 222,
"split": "train"
} | |
For students whose advisors are either above 1121 or at most 7271, what are their first names and the average of their advisor IDs? | restaurant_1 | select fname as c1, avg(advisor) from student where advisor > 1121 or advisor <= 7271 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": "restaurant_1",
"sql": "select fname as c1, avg(advisor) from student where advisor > 1121 or advisor <= 7271 group by c1"
},
"style": "rule"
} | {
"index": 2928,
"split": "train"
} | |
What is the total sum of the founding years of institutions located in building number five? | protein_institute | select t0.c1 from (select sum(t1.founded) as c1 from building as t0 join institution as t1 on t0.building_id = t1.building_id where t0.building_id = 5 group by t0.building_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": "protein_institute",
"sql": "select t0.c1 from (select sum(t1.founded) as c1 from building as t0 join institution as t1 on t0.building_id = t1.building_id where t0.building_id = 5 group by t0.building_id) as t0"
},
"style": "rule"
} | {
"index": 3393,
"split": "train"
} | |
Which employee has the highest number of circulation history entries? List their employee ID, name, and role code. | cre_Doc_Control_Systems | select t0.employee_id, t0.employee_name, t0.role_code from employees as t0 join circulation_history as t1 on t0.employee_id = t1.employee_id, (select employee_id as c1 from circulation_history group by c1 order by count(*) desc limit 1) as t0 where t1.employee_id = t0.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Control_Systems",
"sql": "select t0.employee_id, t0.employee_name, t0.role_code from employees as t0 join circulation_history as t1 on t0.employee_id = t1.employee_id, (select employee_id as c1 from circulation_history group by c1 order by count(*) desc limit 1) as t0 whe... | {
"index": 2656,
"split": "train"
} | |
Are there more than 5 bikes currently available at station 41? | bike_1 | select bikes_available > 5 from status where station_id = 41 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "bike_1",
"sql": "select bikes_available > 5 from status where station_id = 41"
},
"style": "rule"
} | {
"index": 3288,
"split": "train"
} | |
What is the highest authorship position for each author, listed in order of their author IDs? | icfp_1 | select max(authorder) from authorship group by authid order by authid 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": "icfp_1",
"sql": "select max(authorder) from authorship group by authid order by authid asc nulls last"
},
"style": "rule"
} | {
"index": 775,
"split": "train"
} | |
Find the F1 and F2 values from the follows relationships, along with the names and emails of users who tweeted between March 9th, 2018, and March 12th, 2018. | twitter_1 | select t0.f1, t0.f2, t1.name, t1.email from follows as t0 join user_profiles as t1 on t0.f2 = t1.uid join tweets as t2 on t1.uid = t2.uid where t2.createdate between '2018-03-09 20:00:14' and '2018-03-12 02:30:30' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "twitter_1",
"sql": "select t0.f1, t0.f2, t1.name, t1.email from follows as t0 join user_profiles as t1 on t0.f2 = t1.uid join tweets as t2 on t1.uid = t2.uid where t2.createdate between '2018-03-09 20:00:14' and '2018-03-12 02:30:30'"
},
"style": "rule"
} | {
"index": 2256,
"split": "train"
} | |
How much lower is the wind speed on station 1 on Tuesday compared to the highest wind speed recorded across all weekly weather data with wind speeds of 17 mph or less? | station_weather | select t2.c3 - t0.c2 from (select max(wind_speed_mph) as c3 from weekly_weather where wind_speed_mph <= 17) as t2, (select wind_speed_mph as c2 from weekly_weather where station_id = 1 and day_of_week = 'Tuesday') 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 t2.c3 - t0.c2 from (select max(wind_speed_mph) as c3 from weekly_weather where wind_speed_mph <= 17) as t2, (select wind_speed_mph as c2 from weekly_weather where station_id = 1 and day_of_week = 'Tuesday') as t0"
},
"style": "rule"
} | {
"index": 3175,
"split": "train"
} | |
What are the names, IDs, and prices of products that are involved in events with product IDs less than 10, but are not involved in any events with product IDs between 6 and 34? | solvency_ii | select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.product_name as c2, t0.product_id as c0, t0.product_price as c1 from products as t0 join products_in_events as t1 on t0.product_id = t1.product_id where t1.product_id < 10 except select t0.product_name as c2, t0.product_id as c0, t0.product_price as c1 from product... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "solvency_ii",
"sql": "select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.product_name as c2, t0.product_id as c0, t0.product_price as c1 from products as t0 join products_in_events as t1 on t0.product_id = t1.product_id where t1.product_id < 10 except select t0.product_name a... | {
"index": 116,
"split": "train"
} | |
What are the chromosome, porphyria status, and enzyme ID for the top 5 enzymes involved in the least common drug-enzyme interaction, sorted by porphyria status from Z to A? | medicine_enzyme_interaction | select t0.chromosome, t0.porphyria as c1 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id, (select interaction_type as c2 from medicine_enzyme_interaction group by c2 order by count(*) asc nulls last limit 1) as t0 where t1.interaction_type = t0.c2 order by c1 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": "medicine_enzyme_interaction",
"sql": "select t0.chromosome, t0.porphyria as c1 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id, (select interaction_type as c2 from medicine_enzyme_interaction group by c2 order by count(*) asc nulls last limit 1) a... | {
"index": 2861,
"split": "train"
} | |
Which five classes with students who earned a grade of 'B' are taught by professors, and for each, what is the professor's employee number, their department code, and the class's professor number, ordered by professor number? | college_1 | select t0.emp_num, t0.dept_code, t2.prof_num as c2 from professor as t0 join employee as t1 on t0.emp_num = t1.emp_num join class as t2 on t1.emp_num = t2.prof_num join enroll as t3 on t2.class_code = t3.class_code where t3.enroll_grade = 'B' 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": "college_1",
"sql": "select t0.emp_num, t0.dept_code, t2.prof_num as c2 from professor as t0 join employee as t1 on t0.emp_num = t1.emp_num join class as t2 on t1.emp_num = t2.prof_num join enroll as t3 on t2.class_code = t3.class_code where t3.enroll_grade = 'B' order by c2 asc n... | {
"index": 1463,
"split": "train"
} | |
Among stations 62 and 25, what is the smallest number of bikes that have been available at each station, and specifically, what is the lowest minimum bikes available between these two stations? | bike_1 | select min(t0.bikes_available) from status as t0 join station as t1 on t0.station_id = t1.id where t1.id = 62 or t1.id = 25 group by t1.id order by t1.id asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "bike_1",
"sql": "select min(t0.bikes_available) from status as t0 join station as t1 on t0.station_id = t1.id where t1.id = 62 or t1.id = 25 group by t1.id order by t1.id asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2726,
"split": "train"
} | |
Can you tell me, for each station located at a longitude less than or equal to -122.106758, how many different bike availability numbers have been recorded, along with the station's longitude and ID, but only for stations that have more than one status update? | bike_1 | select count(distinct (t0.bikes_available)), t1.long as c1, t1.id as c2 from status as t0 join station as t1 on t0.station_id = t1.id where c1 <= -122.10675800000001 group by c2 having count(*) > 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "bike_1",
"sql": "select count(distinct (t0.bikes_available)), t1.long as c1, t1.id as c2 from status as t0 join station as t1 on t0.station_id = t1.id where c1 <= -122.10675800000001 group by c2 having count(*) > 1"
},
"style": "rule"
} | {
"index": 2623,
"split": "train"
} | |
For third-party companies whose names start with "White," what is the lowest company ID, and what is their company type and ID? | assets_maintenance | select min(t0.company_id), t1.company_type, t1.company_id as c0 from maintenance_engineers as t0 join third_party_companies as t1 on t0.company_id = t1.company_id where t1.company_name like 'White%' 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": "assets_maintenance",
"sql": "select min(t0.company_id), t1.company_type, t1.company_id as c0 from maintenance_engineers as t0 join third_party_companies as t1 on t0.company_id = t1.company_id where t1.company_name like 'White%' group by c0"
},
"style": "rule"
} | {
"index": 2522,
"split": "train"
} | |
What is the highest price of the product with ID 14, considering all suppliers who provide this product, and sorted by the total value purchased from each supplier? | department_store | select max(t0.product_price) from products as t0 join product_suppliers as t1 on t0.product_id = t1.product_id where t1.product_id = 14 and t1.supplier_id in (select suppliers.supplier_id as c1 from suppliers) order by sum(t1.total_value_purchased) 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": "department_store",
"sql": "select max(t0.product_price) from products as t0 join product_suppliers as t1 on t0.product_id = t1.product_id where t1.product_id = 14 and t1.supplier_id in (select suppliers.supplier_id as c1 from suppliers) order by sum(t1.total_value_purchased) desc... | {
"index": 1686,
"split": "train"
} | |
Find the different numbers of factories that manufacturers have. | manufacturer | select distinct num_of_factories from manufacturer | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "manufacturer",
"sql": "select distinct num_of_factories from manufacturer"
},
"style": "rule"
} | {
"index": 1762,
"split": "train"
} | |
When was the most recent log entry made for the problem with the highest Problem Id? | tracking_software_problems | select t0.log_entry_date, t0.problem_id as c1 from problem_log as t0, (select max(problem_id) as c0 from problem_log) as t1 where c1 = t1.c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t0.log_entry_date, t0.problem_id as c1 from problem_log as t0, (select max(problem_id) as c0 from problem_log) as t1 where c1 = t1.c0"
},
"style": "rule"
} | {
"index": 3849,
"split": "train"
} | |
Which player with a potential between 69 and 91 has the highest Player Api Id? | soccer_1 | select t0.player_api_id as c0 from player as t0 join player_attributes as t1 on t0.player_api_id = t1.player_api_id where t1.potential between 69 and 91 order by c0 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "soccer_1",
"sql": "select t0.player_api_id as c0 from player as t0 join player_attributes as t1 on t0.player_api_id = t1.player_api_id where t1.potential between 69 and 91 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 1993,
"split": "train"
} | |
What are the last names, email addresses, and associated address IDs of the top five teachers linked to students living at addresses with IDs greater than or equal to 19 or between 8 and 13, sorted alphabetically by the teachers' last names? | behavior_monitoring | select t0.last_name as c0, t0.email_address, t1.address_id from teachers as t0 join addresses as t1 on t0.address_id = t1.address_id join student_addresses as t2 on t1.address_id = t2.address_id where t2.address_id >= 19 or t2.address_id between 8 and 13 order by c0 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "behavior_monitoring",
"sql": "select t0.last_name as c0, t0.email_address, t1.address_id from teachers as t0 join addresses as t1 on t0.address_id = t1.address_id join student_addresses as t2 on t1.address_id = t2.address_id where t2.address_id >= 19 or t2.address_id between 8 an... | {
"index": 630,
"split": "train"
} | |
What are the first five section IDs from the Document Sections Images table, sorted in ascending order, with any missing IDs appearing at the end? | document_management | select section_id as c0 from document_sections_images order by c0 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "document_management",
"sql": "select section_id as c0 from document_sections_images order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2325,
"split": "train"
} | |
What are the smallest and largest account IDs involved in transaction number 15? | customers_and_invoices | select min(account_id), max(account_id) from financial_transactions where transaction_id = 15 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select min(account_id), max(account_id) from financial_transactions where transaction_id = 15"
},
"style": "rule"
} | {
"index": 3638,
"split": "train"
} | |
Can you tell me the earliest three years in which players with height greater than or equal to the number of players named Billy Hassler or with last names containing 'ic' received awards? | baseball_1 | select t0.year as c1 from player_award as t0 join player as t1 on t0.player_id = t1.player_id, (select count(height) as c0 from player where name_first = 'Billy' and name_last = 'Hassler' or name_last like '%ic%') as t0 where t1.height >= t0.c0 order by c1 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select t0.year as c1 from player_award as t0 join player as t1 on t0.player_id = t1.player_id, (select count(height) as c0 from player where name_first = 'Billy' and name_last = 'Hassler' or name_last like '%ic%') as t0 where t1.height >= t0.c0 order by c1 as... | {
"index": 2345,
"split": "train"
} | |
How much higher or lower is the maximum song rating in the 'tagore' genre compared to the maximum rating in the 'modern' genre? | music_1 | select t1.c1 - t0.c1 from (select max(t1.rating) as c1 from genre as t0 join song as t1 on t0.g_name = t1.genre_is where t0.g_name = 'tagore' group by t0.g_name) as t1, (select t0.g_name, max(t1.rating) as c1 from genre as t0 join song as t1 on t0.g_name = t1.genre_is where t0.g_name = 'modern' group by t0.g_name) 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": "music_1",
"sql": "select t1.c1 - t0.c1 from (select max(t1.rating) as c1 from genre as t0 join song as t1 on t0.g_name = t1.genre_is where t0.g_name = 'tagore' group by t0.g_name) as t1, (select t0.g_name, max(t1.rating) as c1 from genre as t0 join song as t1 on t0.g_name = t1.ge... | {
"index": 3615,
"split": "train"
} | |
Which parts with fault ID 10 have been logged, and for each, what is the part name, part ID, and the smallest part ID associated with that fault? | assets_maintenance | select t0.part_name, t0.part_id as c2, min(t1.part_id) from parts as t0 join part_faults as t1 on t0.part_id = t1.part_id where t1.part_fault_id = 10 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": "assets_maintenance",
"sql": "select t0.part_name, t0.part_id as c2, min(t1.part_id) from parts as t0 join part_faults as t1 on t0.part_id = t1.part_id where t1.part_fault_id = 10 group by c2"
},
"style": "rule"
} | {
"index": 185,
"split": "train"
} | |
Is the country ID of the league with ID 17642 higher than the total number of leagues? | soccer_1 | select t2.c3 > t1.c0 from (select country_id as c3 from league where id = 17642) as t2, (select count(country_id) as c0 from league) as t1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "soccer_1",
"sql": "select t2.c3 > t1.c0 from (select country_id as c3 from league where id = 17642) as t2, (select count(country_id) as c0 from league) as t1"
},
"style": "rule"
} | {
"index": 3281,
"split": "train"
} | |
Can you tell me the different transaction types, including their descriptions and codes, for transactions made by investors who either don't have any lots registered or have an investor ID less than 20? | tracking_share_transactions | select distinct t0.transaction_type_description, t0.transaction_type_code from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where (not t1.investor_id in (select lots.investor_id as c0 from lots)) or t1.investor_id < 20 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct t0.transaction_type_description, t0.transaction_type_code from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where (not t1.investor_id in (select lots.investor_id as... | {
"index": 1808,
"split": "train"
} | |
For each Female Id married to the male with id 1, what are the Female Ids and the total sum of the years of their weddings? | wedding | select female_id as c0, sum(year) from wedding where male_id = 1 group by c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "wedding",
"sql": "select female_id as c0, sum(year) from wedding where male_id = 1 group by c0"
},
"style": "rule"
} | {
"index": 820,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.