question
stringlengths
1
606
db_id
stringclasses
139 values
external_knowledge
stringclasses
1 value
sql
stringlengths
19
1.35k
data_source
stringclasses
1 value
prompt
listlengths
2
2
ability
stringclasses
1 value
reward_model
dict
extra_info
dict
Did tweet 7 get created after tweet 5?
twitter_1
select t1.c0 > t0.c0 from (select createdate as c0 from tweets where id = 7) as t1, (select createdate as c0 from tweets where id = 5) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "twitter_1", "sql": "select t1.c0 > t0.c0 from (select createdate as c0 from tweets where id = 7) as t1, (select createdate as c0 from tweets where id = 5) as t0" }, "style": "rule" }
{ "index": 3112, "split": "train" }
Is the user ID of the tweet with ID 6 greater than 3?
twitter_1
select uid > 3 from tweets where id = 6
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "twitter_1", "sql": "select uid > 3 from tweets where id = 6" }, "style": "rule" }
{ "index": 3305, "split": "train" }
What are the details and IDs of the first 5 customers when ordered by customer ID, with any missing IDs listed last?
insurance_policies
select customer_details, customer_id as c1 from customers 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": "insurance_policies", "sql": "select customer_details, customer_id as c1 from customers order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2953, "split": "train" }
What are the names and the number of bikes available at station 46, showing the five stations with the fewest bikes available, ordered from least to most?
bike_1
select t0.name, t1.bikes_available as c0 from station as t0 join status as t1 on t0.id = t1.station_id where t1.station_id = 46 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": "bike_1", "sql": "select t0.name, t1.bikes_available as c0 from station as t0 join status as t1 on t0.id = t1.station_id where t1.station_id = 46 order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 1851, "split": "train" }
What are the invoice number, shipment date, order ID, and invoice date of the shipment whose invoice details start with "qu" and has the lowest invoice number?
tracking_orders
select t0.invoice_number as c2, t0.shipment_date, t0.order_id, t1.invoice_date from shipments as t0 join invoices as t1 on t0.invoice_number = t1.invoice_number where t1.invoice_details like 'qu%' order by c2 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_orders", "sql": "select t0.invoice_number as c2, t0.shipment_date, t0.order_id, t1.invoice_date from shipments as t0 join invoices as t1 on t0.invoice_number = t1.invoice_number where t1.invoice_details like 'qu%' order by c2 asc nulls last limit 1" }, "style": "rule...
{ "index": 2281, "split": "train" }
What is the difference in the number of unique documents shipped by the FE shipping agent between two different times or dates?
cre_Doc_Control_Systems
select t0.c2 - t0.c2 from (select count(distinct (t1.document_id)) as c2 from ref_shipping_agents as t0 join documents as t1 on t0.shipping_agent_code = t1.shipping_agent_code where t0.shipping_agent_code = 'FE' and t1.receipt_date = '2017-07-02 17:39:09' group by t0.shipping_agent_code) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Control_Systems", "sql": "select t0.c2 - t0.c2 from (select count(distinct (t1.document_id)) as c2 from ref_shipping_agents as t0 join documents as t1 on t0.shipping_agent_code = t1.shipping_agent_code where t0.shipping_agent_code = 'FE' and t1.receipt_date = '2017-07-02 ...
{ "index": 3993, "split": "train" }
Which players who died in or before 1975 have their Player Id, the year they received an award, and their first names?
baseball_1
select t0.player_id, t0.year, t1.name_first from player_award as t0 join player as t1 on t0.player_id = t1.player_id where t1.death_year <= 1975
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.player_id, t0.year, t1.name_first from player_award as t0 join player as t1 on t0.player_id = t1.player_id where t1.death_year <= 1975" }, "style": "rule" }
{ "index": 1118, "split": "train" }
How many stock entries are recorded in the database?
device
select count(*) from stock
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "device", "sql": "select count(*) from stock" }, "style": "rule" }
{ "index": 975, "split": "train" }
How much smaller is the address ID of customer 11 compared to the highest address ID among addresses with IDs of 3 or higher?
customers_and_addresses
select t2.c0 - t0.c3 from (select max(address_id) as c0 from customer_addresses where address_id >= 3) as t2, (select address_id as c3 from customer_addresses where customer_id = 11) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select t2.c0 - t0.c3 from (select max(address_id) as c0 from customer_addresses where address_id >= 3) as t2, (select address_id as c3 from customer_addresses where customer_id = 11) as t0" }, "style": "rule" }
{ "index": 3875, "split": "train" }
How many days passed between the order date and the actual delivery date for orders delivered before August 22, 1998?
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 actual_delivery_date < '1998-08-22 17:57:32' and actual_delivery_date < '1998-08-22 17:57:32') 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 actual_delivery_date < '1998-08-22 17:57:32' and actual_delivery_date < '1998-08...
{ "index": 3963, "split": "train" }
Can you tell me the number of unique full building names and the total number of building descriptions for buildings with IDs between 191 and 744 or exactly 191, specifically for the set that has the fewest distinct full building names?
apartment_rentals
select count(distinct (t0.building_full_name)) as c0, count(t0.building_description) from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.building_id between 191 and 744 or t1.building_id = 191 order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select count(distinct (t0.building_full_name)) as c0, count(t0.building_description) from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.building_id between 191 and 744 or t1.building_id = 191 order by c0 as...
{ "index": 2786, "split": "train" }
Which paper ID appears most frequently in the database?
icfp_1
select paperid as c2, count(distinct (paperid)) as c1 from papers group by c2 order by c1 desc limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "icfp_1", "sql": "select paperid as c2, count(distinct (paperid)) as c1 from papers group by c2 order by c1 desc limit 1" }, "style": "rule" }
{ "index": 3658, "split": "train" }
How much more savings does customer 1 have compared to customer 5?
small_bank_1
select t1.c0 - t0.c0 from (select balance as c0 from savings where custid = 5) as t1, (select balance as c0 from savings where custid = 1) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select t1.c0 - t0.c0 from (select balance as c0 from savings where custid = 5) as t1, (select balance as c0 from savings where custid = 1) as t0" }, "style": "rule" }
{ "index": 3975, "split": "train" }
What are the details of the lots, their lot IDs, and associated investor IDs for transaction number 3?
tracking_share_transactions
select t0.lot_details, t0.lot_id, t0.investor_id from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id where t1.transaction_id = 3 or t1.transaction_id = 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_share_transactions", "sql": "select t0.lot_details, t0.lot_id, t0.investor_id from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id where t1.transaction_id = 3 or t1.transaction_id = 3" }, "style": "rule" }
{ "index": 977, "split": "train" }
How much older or younger is Dan compared to 45?
network_2
select age - 45 from person where name = 'Dan'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 age - 45 from person where name = 'Dan'" }, "style": "rule" }
{ "index": 3871, "split": "train" }
Can you tell me the building IDs and addresses of apartment buildings that have at least one unit with a building ID of 790 or higher and feature an apartment type code ending with "lat"?
apartment_rentals
select t0.building_id, t0.building_address from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.building_id >= 790 and t1.apt_type_code like '%lat'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "apartment_rentals", "sql": "select t0.building_id, t0.building_address from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.building_id >= 790 and t1.apt_type_code like '%lat'" }, "style": "rule" }
{ "index": 2812, "split": "train" }
For each employee, what is their address, last name, and birth date, and how many invoices (total purchases) has each of them supported?
store_1
select t0.address, t0.last_name, t0.birth_date, count(t2.total) from employees as t0 join customers as t1 on t0.id = t1.support_rep_id join invoices as t2 on t1.id = t2.customer_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.address, t0.last_name, t0.birth_date, count(t2.total) from employees as t0 join customers as t1 on t0.id = t1.support_rep_id join invoices as t2 on t1.id = t2.customer_id group by t0.id" }, "style": "rule" }
{ "index": 1950, "split": "train" }
Which are the top 10 buildings associated with companies that have profits of at least 25.7 billion dollars? For each, tell me its current status, its ID, and how many stories it has, sorted by status in reverse alphabetical order.
company_office
select t0.status as c2, t0.id, t0.stories from buildings as t0 join office_locations as t1 on t0.id = t1.building_id join companies as t2 on t1.company_id = t2.id where t2.profits_billion >= 25.7 order by c2 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "company_office", "sql": "select t0.status as c2, t0.id, t0.stories from buildings as t0 join office_locations as t1 on t0.id = t1.building_id join companies as t2 on t1.company_id = t2.id where t2.profits_billion >= 25.7 order by c2 desc limit 10" }, "style": "rule" }
{ "index": 2973, "split": "train" }
Can you provide a list of each catalog's publisher, name, ID, along with the total of their "next entry" IDs and the combined price in euros for all their contents?
product_catalog
select t0.catalog_publisher, t0.catalog_name, t0.catalog_id as c1, sum(t2.next_entry_id), sum(t2.price_in_euros) from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id join catalog_contents as t2 on t1.catalog_level_number = t2.catalog_level_number 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": "product_catalog", "sql": "select t0.catalog_publisher, t0.catalog_name, t0.catalog_id as c1, sum(t2.next_entry_id), sum(t2.price_in_euros) from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id join catalog_contents as t2 on t1.catalog_level_number = t2...
{ "index": 491, "split": "train" }
Which genders and dorm IDs are associated with amenities having IDs up to 932, and how many such amenities each dorm has, ordered from the dorms with the most to the least?
dorm_1
select t0.gender, t0.dormid as c1 from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where t1.amenid <= 932 group by c1 order by count(*) 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": "dorm_1", "sql": "select t0.gender, t0.dormid as c1 from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where t1.amenid <= 932 group by c1 order by count(*) desc" }, "style": "rule" }
{ "index": 1667, "split": "train" }
What are the height, length, speed, status, and name of roller coasters located in countries that have no other roller coasters, combined with those in country 3?
roller_coaster
select anon_1.c1, anon_1.c4, anon_1.c0, anon_1.c2, anon_1.c5 from (select t0.height as c1, t0.length as c4, t0.speed as c0, t0.status as c2, t0.name as c5 from roller_coaster as t0 join country as t1 on t0.country_id = t1.country_id where (not t1.country_id in (select country_id from roller_coaster)) union select t0.he...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "roller_coaster", "sql": "select anon_1.c1, anon_1.c4, anon_1.c0, anon_1.c2, anon_1.c5 from (select t0.height as c1, t0.length as c4, t0.speed as c0, t0.status as c2, t0.name as c5 from roller_coaster as t0 join country as t1 on t0.country_id = t1.country_id where (not t1.country_...
{ "index": 2276, "split": "train" }
Can you tell me, for each customer contact channel code, the total number of contact records, how many of those records have a non-null channel code, and how many distinct active-to-date values there are, considering only activities that started on or after September 21, 2017? Also, list the first five channel codes al...
customers_and_addresses
select channel_code as c1, count(*), count(channel_code), count(distinct (active_to_date)) from customer_contact_channels where active_from_date >= '2017-09-21 12:41:56' group by c1 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": "customers_and_addresses", "sql": "select channel_code as c1, count(*), count(channel_code), count(distinct (active_to_date)) from customer_contact_channels where active_from_date >= '2017-09-21 12:41:56' group by c1 order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2126, "split": "train" }
Among transaction types where the smallest associated card ID is at least 2, which transaction type appears first in reverse alphabetical order, along with its minimum card ID?
customers_card_transactions
select transaction_type as c0, min(card_id) from financial_transactions group by c0 having min(card_id) >= 2 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": "customers_card_transactions", "sql": "select transaction_type as c0, min(card_id) from financial_transactions group by c0 having min(card_id) >= 2 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 1048, "split": "train" }
How many more or fewer 'Paper' documents were received in the organization on September 26, 1983, compared to July 27, 1996? Please provide the difference in the number of unique document IDs received on those two dates.?
cre_Doc_Control_Systems
select t1.c1 - t0.c1 from (select count(distinct (t1.document_id)) as c1 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'Paper' and t1.receipt_date = '1983-09-26 09:32:56' group by t0.document_type_code) as t1, (select t0.document_type_c...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Control_Systems", "sql": "select t1.c1 - t0.c1 from (select count(distinct (t1.document_id)) as c1 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'Paper' and t1.receipt_date = '1983-09-26 0...
{ "index": 3515, "split": "train" }
What are the card type codes, card numbers, and types of transactions for transactions linked to accounts that have other account details containing "IP"?
customers_card_transactions
select t0.card_type_code, t0.card_number, t1.transaction_type from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id join accounts as t2 on t1.account_id = t2.account_id where t2.other_account_details like '%IP%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t0.card_type_code, t0.card_number, t1.transaction_type from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id join accounts as t2 on t1.account_id = t2.account_id where t2.other_account_details like '%I...
{ "index": 2848, "split": "train" }
Can you list the titles and IDs of items, along with their average review rank, where each review rank is either less than 4 or exactly 1?
epinions_1
select t0.title, t0.i_id as c1, avg(t1.rank) from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.rank < 4 or t1.rank = 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": "epinions_1", "sql": "select t0.title, t0.i_id as c1, avg(t1.rank) from item as t0 join review as t1 on t0.i_id = t1.i_id where t1.rank < 4 or t1.rank = 1 group by c1" }, "style": "rule" }
{ "index": 745, "split": "train" }
What are the earliest compatible years and IDs for up to 10 browsers with a market share of at least 28.96%, sorted from highest to lowest browser ID?
browser_web
select min(t0.compatible_since_year), t1.id as c1 from accelerator_compatible_browser as t0 join browser as t1 on t0.browser_id = t1.id where t1.market_share >= 28.96 group by c1 order by c1 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "browser_web", "sql": "select min(t0.compatible_since_year), t1.id as c1 from accelerator_compatible_browser as t0 join browser as t1 on t0.browser_id = t1.id where t1.market_share >= 28.96 group by c1 order by c1 desc limit 10" }, "style": "rule" }
{ "index": 2104, "split": "train" }
Today, I want to see the first five cities in the database that are located in a specific country with country ID 48. For each of these cities, I need to know the city ID, city name, the country ID they belong to, and the country's name, sorted alphabetically by the country's name.
sakila_1
select t0.city_id, t0.city, t0.country_id, t1.country as c0 from city as t0 join country as t1 on t0.country_id = t1.country_id where t1.country_id = 48 order by c0 asc nulls last limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "sakila_1", "sql": "select t0.city_id, t0.city, t0.country_id, t1.country as c0 from city as t0 join country as t1 on t0.country_id = t1.country_id where t1.country_id = 48 order by c0 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2194, "split": "train" }
How many days passed between the date when a claim was made and when it was settled, for claims with amounts between 43,884 and 89,632?
insurance_policies
select julianday(t1.c3) - julianday(t0.c0) from (select date_claim_settled as c3 from claims) as t1, (select date_claim_made as c0 from claims where amount_claimed between 43884 and 89632 and amount_claimed between 43884 and 89632) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_policies", "sql": "select julianday(t1.c3) - julianday(t0.c0) from (select date_claim_settled as c3 from claims) as t1, (select date_claim_made as c0 from claims where amount_claimed between 43884 and 89632 and amount_claimed between 43884 and 89632) as t0" }, "styl...
{ "index": 3729, "split": "train" }
What is the average address ID associated with address 6?
customer_deliveries
select t0.c0 from (select avg(t1.address_id) as c0 from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id where t0.address_id = 6 group by t0.address_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 from (select avg(t1.address_id) as c0 from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id where t0.address_id = 6 group by t0.address_id) as t0" }, "style": "rule" }
{ "index": 3368, "split": "train" }
Show the member IDs, decoration themes, and rankings in rounds for the members with IDs 1 and 2.
decoration_competition
select member_id as c0, decoration_theme, rank_in_round from round where c0 = 1 or c0 = 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": "decoration_competition", "sql": "select member_id as c0, decoration_theme, rank_in_round from round where c0 = 1 or c0 = 2" }, "style": "rule" }
{ "index": 2818, "split": "train" }
What are the form type codes and form IDs from the forms, as well as the associated party form IDs, for parties whose payment method code includes "sh"?
e_government
select t0.form_type_code, t0.form_id, t1.form_id from forms as t0 join party_forms as t1 on t0.form_id = t1.form_id join parties as t2 on t1.party_id = t2.party_id where t2.payment_method_code like '%sh%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_government", "sql": "select t0.form_type_code, t0.form_id, t1.form_id from forms as t0 join party_forms as t1 on t0.form_id = t1.form_id join parties as t2 on t1.party_id = t2.party_id where t2.payment_method_code like '%sh%'" }, "style": "rule" }
{ "index": 2387, "split": "train" }
For research grants, what are the grant amount and start date, as well as the project ID and project details, for projects whose outcomes have outcome codes beginning with "Pa"?
tracking_grants_for_research
select t0.grant_amount, t0.grant_start_date, t2.project_id, t2.project_details 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 project_outcomes as t3 on t2.project_id = t3.project_id where t3.outcome_code like 'Pa%...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_amount, t0.grant_start_date, t2.project_id, t2.project_details 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 project_...
{ "index": 2372, "split": "train" }
Could you tell me the details and IDs of the five most relevant addresses linked to supplier 2 at address ID 11, ordered from the highest to the lowest supplier ID?
department_store
select t0.address_details, t0.address_id from addresses as t0 join supplier_addresses as t1 on t0.address_id = t1.address_id where t1.address_id = 11 and t1.supplier_id = 2 order by t1.supplier_id desc limit 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "department_store", "sql": "select t0.address_details, t0.address_id from addresses as t0 join supplier_addresses as t1 on t0.address_id = t1.address_id where t1.address_id = 11 and t1.supplier_id = 2 order by t1.supplier_id desc limit 5" }, "style": "rule" }
{ "index": 2887, "split": "train" }
Which films have more than three showtimes per day but are not scheduled on May 20th?
cinema
select anon_1.c1, anon_1.c0 from (select t0.film_id as c1, t0.title as c0 from film as t0 join schedule as t1 on t0.film_id = t1.film_id where t1.show_times_per_day >= 3 except select t0.film_id as c1, t0.title as c0 from film as t0 join schedule as t1 on t0.film_id = t1.film_id where t1.date = '20 May') 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": "cinema", "sql": "select anon_1.c1, anon_1.c0 from (select t0.film_id as c1, t0.title as c0 from film as t0 join schedule as t1 on t0.film_id = t1.film_id where t1.show_times_per_day >= 3 except select t0.film_id as c1, t0.title as c0 from film as t0 join schedule as t1 on t0.film...
{ "index": 808, "split": "train" }
What are the names, file IDs, and genres of songs that belong to genres not associated with any other songs?
music_1
select anon_1.c1, anon_1.c0, anon_1.c2 from (select song_name as c1, f_id as c0, genre_is as c2 from song except select t0.song_name as c1, t0.f_id as c0, t0.genre_is as c2 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where (not t1.g_name in (select c2 as c2 from song))) 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": "music_1", "sql": "select anon_1.c1, anon_1.c0, anon_1.c2 from (select song_name as c1, f_id as c0, genre_is as c2 from song except select t0.song_name as c1, t0.f_id as c0, t0.genre_is as c2 from song as t0 join genre as t1 on t0.genre_is = t1.g_name where (not t1.g_name in (sele...
{ "index": 2857, "split": "train" }
What are the years, faculty names, campus IDs, and campus founding years for faculty linked to campus 8, sorted from the most recent faculty year?
csu_1
select t0.year as c2, t0.faculty, t0.campus, t1.year from faculty as t0 join campuses as t1 on t0.campus = t1.id join degrees as t2 on t1.id = t2.campus where t2.campus = 8 order by c2 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": "csu_1", "sql": "select t0.year as c2, t0.faculty, t0.campus, t1.year from faculty as t0 join campuses as t1 on t0.campus = t1.id join degrees as t2 on t1.id = t2.campus where t2.campus = 8 order by c2 desc" }, "style": "rule" }
{ "index": 673, "split": "train" }
Is the pages per minute color for product ID 5 less than 30?
store_product
select pages_per_minute_color < 30.0 from product where product_id = 5
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_product", "sql": "select pages_per_minute_color < 30.0 from product where product_id = 5" }, "style": "rule" }
{ "index": 3350, "split": "train" }
What are the monthly rental amounts, address IDs, and student IDs of students who had behavior incidents starting between June 9, 2017, and August 29, 2017? Please list the results ordered by monthly rental, with null values displayed last.
behavior_monitoring
select t0.monthly_rental as c2, t0.address_id, t0.student_id, t1.student_id from student_addresses as t0 join students as t1 on t0.student_id = t1.student_id join behavior_incident as t2 on t1.student_id = t2.student_id where t2.date_incident_start between '2017-06-09 18:32:28' and '2017-08-29 20:48:56' order by c2 asc...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.monthly_rental as c2, t0.address_id, t0.student_id, t1.student_id from student_addresses as t0 join students as t1 on t0.student_id = t1.student_id join behavior_incident as t2 on t1.student_id = t2.student_id where t2.date_incident_start b...
{ "index": 2007, "split": "train" }
Which store IDs and store types are associated with districts where the store is in district number 4, but not in districts with smaller IDs?
store_product
select anon_1.c0, anon_1.c1 from (select t0.store_id as c0, t0.type as c1 from store as t0 join store_district as t1 on t0.store_id = t1.store_id where t1.store_id = 4 except select t0.store_id as c0, t0.type as c1 from store as t0 join store_district as t1 on t0.store_id = t1.store_id where t1.district_id < 4) as anon...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c1 from (select t0.store_id as c0, t0.type as c1 from store as t0 join store_district as t1 on t0.store_id = t1.store_id where t1.store_id = 4 except select t0.store_id as c0, t0.type as c1 from store as t0 join store_district as t...
{ "index": 1193, "split": "train" }
What percentage of customer addresses with address ID 3 were associated with orders placed at 2018-03-16 03:16:57?
customers_and_addresses
select (count(t0.address_id) / cast(count(t0.address_id) as real) - 1) * 100 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id where t2.order_date = '2018-03-16 03:16:57' and t0.address_id = 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select (count(t0.address_id) / cast(count(t0.address_id) as real) - 1) * 100 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id where t2.order_date =...
{ "index": 3022, "split": "train" }
What are the host city IDs and themes for farm competitions held in the city with the rarest official name, as well as in cities whose names start with "Grand Falls/Grand-Saul"?
farm
select anon_1.c2, anon_1.c1 from (select t0.host_city_id as c2, t0.theme as c1 from farm_competition as t0 join city as t1 on t0.host_city_id = t1.city_id, (select official_name as c0 from city group by c0 order by count(*) asc nulls last limit 1) as t1 where t1.official_name = t1.c0 union select t0.host_city_id as 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": "farm", "sql": "select anon_1.c2, anon_1.c1 from (select t0.host_city_id as c2, t0.theme as c1 from farm_competition as t0 join city as t1 on t0.host_city_id = t1.city_id, (select official_name as c0 from city group by c0 order by count(*) asc nulls last limit 1) as t1 where t1.of...
{ "index": 211, "split": "train" }
Show the names of all roller coasters and all countries, including any names that appear in either list.
roller_coaster
select anon_1.c0 from (select name as c0 from roller_coaster union select name from country) 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": "roller_coaster", "sql": "select anon_1.c0 from (select name as c0 from roller_coaster union select name from country) as anon_1" }, "style": "rule" }
{ "index": 236, "split": "train" }
Is the maximum author ID for author 5 higher than the maximum author ID for author 14 when considering only their courses in subjects with IDs up to 2?
e_learning
select t1.c2 > t0.c2 from (select max(t1.author_id) as c2 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t0.author_id = 14 and t1.subject_id <= 2 group by t0.author_id) as t1, (select t0.author_id, max(t1.author_id) as c2 from course_authors_and_tutors as t0 join courses as...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_learning", "sql": "select t1.c2 > t0.c2 from (select max(t1.author_id) as c2 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t0.author_id = 14 and t1.subject_id <= 2 group by t0.author_id) as t1, (select t0.author_id, max(t1.author_i...
{ "index": 3546, "split": "train" }
How many records are there for each address in the USA, and what are the country and address ID associated with each one?
customers_and_addresses
select count(*), t0.country as c0, t0.address_id as c2 from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id where c0 = 'USA' group by c2
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_addresses", "sql": "select count(*), t0.country as c0, t0.address_id as c2 from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id where c0 = 'USA' group by c2" }, "style": "rule" }
{ "index": 1630, "split": "train" }
Among people whose names start with "Summer," what is the gender of the first person when sorting the list alphabetically by gender, putting any unknown genders last?
wedding
select is_male as c0 from people where name like 'Summer%' order by c0 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "wedding", "sql": "select is_male as c0 from people where name like 'Summer%' order by c0 asc nulls last limit 1" }, "style": "rule" }
{ "index": 26, "split": "train" }
What are the ID and name of the race track with ID 6, excluding those located in the most frequently occurring location?
race_track
select anon_1.c2, anon_1.c0 from (select t0.track_id as c2, t0.name as c0 from race as t0 join track as t1 on t0.track_id = t1.track_id where t1.track_id = 6 except select t0.track_id as c2, t0.name as c0 from race as t0 join track as t1 on t0.track_id = t1.track_id, (select location as c1 from track group by c1 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": "race_track", "sql": "select anon_1.c2, anon_1.c0 from (select t0.track_id as c2, t0.name as c0 from race as t0 join track as t1 on t0.track_id = t1.track_id where t1.track_id = 6 except select t0.track_id as c2, t0.name as c0 from race as t0 join track as t1 on t0.track_id = t1.t...
{ "index": 1759, "split": "train" }
What are the project codes, names, and hours for projects that also appear in the list of projects associated with the least common scientist name among those with SSN 845657246?
scientist_1
select anon_1.c0, anon_1.c2, anon_1.c3 from (select code as c0, name as c2, hours as c3 from projects intersect select t0.code as c0, t0.name as c2, t0.hours as c3 from projects as t0 join assignedto as t1 on t0.code = t1.project join scientists as t2 on t1.scientist = t2.ssn, (select name as c1 from scientists where s...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "scientist_1", "sql": "select anon_1.c0, anon_1.c2, anon_1.c3 from (select code as c0, name as c2, hours as c3 from projects intersect select t0.code as c0, t0.name as c2, t0.hours as c3 from projects as t0 join assignedto as t1 on t0.code = t1.project join scientists as t2 on t1....
{ "index": 855, "split": "train" }
Which manufacturer founder has the fewest manufacturers, and how many manufacturers does each founder have, including the total count and the count of non-null founders?
manufactory_1
select founder as c0, count(*), count(founder) as c2 from manufacturers group by c0 order by c2 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "manufactory_1", "sql": "select founder as c0, count(*), count(founder) as c2 from manufacturers group by c0 order by c2 asc nulls last limit 1" }, "style": "rule" }
{ "index": 391, "split": "train" }
What are the average total score and the sum of clean and jerk scores among the body builders?
body_builder
select avg(total), sum(clean_jerk) from body_builder
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "body_builder", "sql": "select avg(total), sum(clean_jerk) from body_builder" }, "style": "rule" }
{ "index": 1382, "split": "train" }
Find the customer IDs and address IDs for customers who have contact channels with an active-to date on or after March 14, 2018, 2:56:28 PM.
customers_and_addresses
select t0.customer_id, t0.address_id from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_contact_channels as t2 on t1.customer_id = t2.customer_id where t2.active_to_date >= '2018-03-14 14:56:28'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t0.customer_id, t0.address_id from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_contact_channels as t2 on t1.customer_id = t2.customer_id where t2.active_to_date >= '2018-03-14 14:56:28'" ...
{ "index": 337, "split": "train" }
Which are the three courses with the lowest credits that are offered in semesters containing the letter "g," and what are their credit values and course IDs?
college_2
select t0.credits as c0 from course as t0 join section as t1 on t0.course_id = t1.course_id where t1.semester like '%g%' 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": "college_2", "sql": "select t0.credits as c0 from course as t0 join section as t1 on t0.course_id = t1.course_id where t1.semester like '%g%' order by c0 asc nulls last limit 3" }, "style": "rule" }
{ "index": 2750, "split": "train" }
What are the order details, order id, and customer id for the invoice numbered 7?
customers_and_invoices
select t0.order_details, t0.order_id, t0.customer_id from orders as t0 join invoices as t1 on t0.order_id = t1.order_id where t1.invoice_number = 7
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t0.order_details, t0.order_id, t0.customer_id from orders as t0 join invoices as t1 on t0.order_id = t1.order_id where t1.invoice_number = 7" }, "style": "rule" }
{ "index": 1289, "split": "train" }
What are the five most recent exhibitions (highest Exhibition Ids) along with their highest ticket prices?
theme_gallery
select exhibition_id as c1, max(ticket_price) from exhibition group by c1 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": "theme_gallery", "sql": "select exhibition_id as c1, max(ticket_price) from exhibition group by c1 order by c1 desc limit 5" }, "style": "rule" }
{ "index": 2773, "split": "train" }
What are the city and state or province of addresses, along with customer IDs and lesson prices for lessons involving the most commonly used vehicle details or vehicles with details ending in "k"?
driving_school
select t0.city, t0.state_province_county, t2.customer_id, t2.price from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id join lessons as t2 on t1.customer_id = t2.customer_id join vehicles as t3 on t2.vehicle_id = t3.vehicle_id, (select vehicle_details as c1 from vehicles group by c1 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": "driving_school", "sql": "select t0.city, t0.state_province_county, t2.customer_id, t2.price from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id join lessons as t2 on t1.customer_id = t2.customer_id join vehicles as t3 on t2.vehicle_id = t3.vehicle_...
{ "index": 1596, "split": "train" }
Which staff members have lessons ending with the digit "9" in their lesson times, and what are their date of birth, first name, and staff ID? Please also note that the results are sorted by the total sum of vehicle IDs associated with their lessons, from highest to lowest.
driving_school
select t0.date_of_birth, t0.first_name, t0.staff_id as c0 from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t1.lesson_time like '%9' group by c0 order by sum(t1.vehicle_id) 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": "driving_school", "sql": "select t0.date_of_birth, t0.first_name, t0.staff_id as c0 from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t1.lesson_time like '%9' group by c0 order by sum(t1.vehicle_id) desc" }, "style": "rule" }
{ "index": 1709, "split": "train" }
Among players whose last names end with "sbee," what is the birth country that has the highest average height, and how many players with bats information are there from that country? Please group the data by birth country and sort the results in reverse alphabetical order of the country, then return only the top entry.
baseball_1
select birth_country as c0, avg(height), count(bats) from player where name_last like '%sbee' group by c0 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": "baseball_1", "sql": "select birth_country as c0, avg(height), count(bats) from player where name_last like '%sbee' group by c0 order by c0 desc limit 1" }, "style": "rule" }
{ "index": 1527, "split": "train" }
Can you show me the rank of customer 12 when customers are ordered from highest to lowest based on their average customer ID?
customers_and_invoices
select t1.c2, t1.c3 as c1 from (select row_number() over (order by t0.c0 desc) as c2, t0.c4 as c3 from (select t0.customer_id as c4, avg(t1.customer_id) as c0 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id group by c4) as t0) as t1 where c1 = 12
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "customers_and_invoices", "sql": "select t1.c2, t1.c3 as c1 from (select row_number() over (order by t0.c0 desc) as c2, t0.c4 as c3 from (select t0.customer_id as c4, avg(t1.customer_id) as c0 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id group by c4) a...
{ "index": 3475, "split": "train" }
Which books, along with their book club IDs and publication years, are associated with culture companies that have produced movies grossing at least 543,356 worldwide or movies with gross worldwide higher than or equal to the lowest gross worldwide among all movies?
culture_company
select t0.book_title, t0.book_club_id, t0.year, t1.movie_id, t1.incorporated_in 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 min(gross_worldwide) as c5 from movie) as t0 where t2.gross_worldwide >= 543356 or t2.gross_worldwid...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "culture_company", "sql": "select t0.book_title, t0.book_club_id, t0.year, t1.movie_id, t1.incorporated_in 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 min(gross_worldwide) as c5 from mo...
{ "index": 613, "split": "train" }
Which author or editor, publisher, and book titles are associated with movies that have a budget of less than 6 million or between 44 million and 62 million?
culture_company
select t0.author_or_editor, t0.publisher, t0.book_title 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 where t2.budget_million < 6.0 or t2.budget_million between 44.0 and 62.0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "culture_company", "sql": "select t0.author_or_editor, t0.publisher, t0.book_title 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 where t2.budget_million < 6.0 or t2.budget_million between 44.0 and...
{ "index": 1000, "split": "train" }
Is the receipt date of the document with ID 4 later than the receipt date of the document with ID 20?
cre_Doc_Control_Systems
select t1.c0 > t0.c0 from (select receipt_date as c0 from documents where document_id = 4) as t1, (select receipt_date as c0 from documents where document_id = 20) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "cre_Doc_Control_Systems", "sql": "select t1.c0 > t0.c0 from (select receipt_date as c0 from documents where document_id = 4) as t1, (select receipt_date as c0 from documents where document_id = 20) as t0" }, "style": "rule" }
{ "index": 3070, "split": "train" }
Which project staff members, including their project IDs, start dates, and the related project outcome IDs, are involved in projects that have research outcomes with the most frequently occurring outcome description among those with outcome codes containing "p" or with outcome descriptions that include "ch P"?
tracking_grants_for_research
select t0.project_id, t0.staff_id, t0.date_from, t2.project_id from project_staff as t0 join projects as t1 on t0.project_id = t1.project_id join project_outcomes as t2 on t1.project_id = t2.project_id join research_outcomes as t3 on t2.outcome_code = t3.outcome_code, (select outcome_description as c2 from research_out...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t0.project_id, t0.staff_id, t0.date_from, t2.project_id from project_staff as t0 join projects as t1 on t0.project_id = t1.project_id join project_outcomes as t2 on t1.project_id = t2.project_id join research_outcomes as t3 on t2.outc...
{ "index": 911, "split": "train" }
How much less or more is the total sum of order IDs for product 3 compared to the highest total sum of order IDs among all products?
tracking_orders
select t2.c1 - t0.c3 from (select max(t1.c3) as c1 from (select sum(t1.order_id) as c3 from products as t0 join order_items as t1 on t0.product_id = t1.product_id group by t0.product_id) as t1) as t2, (select t0.product_id, sum(t1.order_id) as c3 from products as t0 join order_items as t1 on t0.product_id = t1.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": "tracking_orders", "sql": "select t2.c1 - t0.c3 from (select max(t1.c3) as c1 from (select sum(t1.order_id) as c3 from products as t0 join order_items as t1 on t0.product_id = t1.product_id group by t0.product_id) as t1) as t2, (select t0.product_id, sum(t1.order_id) as c3 from pr...
{ "index": 3178, "split": "train" }
Which products have been ordered that either have product IDs between 3 and 9 or are 10 and above, and for each of these products, what is their color, ID, and the smallest product ID found in the associated order items?
customers_and_invoices
select t0.product_color, t0.product_id as c2, min(t1.product_id) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id between 3 and 9 or t1.product_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": "customers_and_invoices", "sql": "select t0.product_color, t0.product_id as c2, min(t1.product_id) from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id between 3 and 9 or t1.product_id >= 10 group by c2" }, "style": "rule" }
{ "index": 2291, "split": "train" }
Can you tell me the IDs and the smallest genre IDs for tracks where the composer’s name starts with "Ja," the media type is 1 or less, and whose smallest genre ID is at least 7? I want the top 5 such tracks ordered by their smallest genre ID. --- This version simplifies the language, clarifies the filtering criteria,...
store_1
select id as c0, min(genre_id) as c1 from tracks where composer like 'Ja%' and media_type_id <= 1 group by c0 having min(genre_id) >= 7 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": "store_1", "sql": "select id as c0, min(genre_id) as c1 from tracks where composer like 'Ja%' and media_type_id <= 1 group by c0 having min(genre_id) >= 7 order by c1 asc nulls last limit 5" }, "style": "rule" }
{ "index": 2836, "split": "train" }
How many days have passed between the publication date of catalog 3 and its most recent revision date?
product_catalog
select julianday(t1.c0) - julianday(t0.c2) from (select date_of_latest_revision as c0 from catalogs) as t1, (select date_of_publication as c2 from catalogs where catalog_id = 3 and catalog_id = 3) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "product_catalog", "sql": "select julianday(t1.c0) - julianday(t0.c2) from (select date_of_latest_revision as c0 from catalogs) as t1, (select date_of_publication as c2 from catalogs where catalog_id = 3 and catalog_id = 3) as t0" }, "style": "rule" }
{ "index": 3843, "split": "train" }
What are the most recent 10 unsure rates and their poll sources for candidates, ordered from newest to oldest?
candidate_poll
select unsure_rate, poll_source from candidate order by date 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": "candidate_poll", "sql": "select unsure_rate, poll_source from candidate order by date desc limit 10" }, "style": "rule" }
{ "index": 766, "split": "train" }
Is the OMIM number for enzyme 3 less than 600923?
medicine_enzyme_interaction
select omim < 600923 from enzyme where id = 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "medicine_enzyme_interaction", "sql": "select omim < 600923 from enzyme where id = 3" }, "style": "rule" }
{ "index": 3343, "split": "train" }
What are the different years in which musicals were produced?
musical
select distinct year from musical
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "musical", "sql": "select distinct year from musical" }, "style": "rule" }
{ "index": 366, "split": "train" }
Which matches took place in host cities where the October temperature was either at or below 22.8°C or at or above 28.9°C, and what are the match IDs, years, host cities, along with the host city names and their regional populations?
city_record
select t0.match_id, t0.year, t0.host_city, t1.city, t1.regional_population from hosting_city as t0 join city as t1 on t0.host_city = t1.city_id join temperature as t2 on t1.city_id = t2.city_id where t2.oct <= 22.8 or t2.oct >= 28.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": "city_record", "sql": "select t0.match_id, t0.year, t0.host_city, t1.city, t1.regional_population from hosting_city as t0 join city as t1 on t0.host_city = t1.city_id join temperature as t2 on t1.city_id = t2.city_id where t2.oct <= 22.8 or t2.oct >= 28.9" }, "style": "rule" }
{ "index": 2098, "split": "train" }
What are the address lines and author IDs of the top 3 authors who teach courses with names containing the letter "I" and descriptions including "Chinese Pa," ordered by the most recent course ID?
e_learning
select t0.address_line_1, t0.author_id from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_name like '%I%' and t1.course_description like '%Chinese Pa%' order by t1.course_id 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": "e_learning", "sql": "select t0.address_line_1, t0.author_id from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_name like '%I%' and t1.course_description like '%Chinese Pa%' order by t1.course_id desc limit 3" }, "style": "ru...
{ "index": 2801, "split": "train" }
Which physicians have either received training in procedures or prescribed medications?
hospital_1
select anon_1.c0 from (select physician as c0 from trained_in union select physician from prescribes) 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": "hospital_1", "sql": "select anon_1.c0 from (select physician as c0 from trained_in union select physician from prescribes) as anon_1" }, "style": "rule" }
{ "index": 1629, "split": "train" }
Which are the three earliest FTE academic years and their corresponding total enrollment years, based on the lowest total enrollment figures?
csu_1
select fte_ay, totalenrollment_ay as c1 from enrollments 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": "csu_1", "sql": "select fte_ay, totalenrollment_ay as c1 from enrollments order by c1 asc nulls last limit 3" }, "style": "rule" }
{ "index": 1054, "split": "train" }
What are the starting years of technicians who are part of the NYY team or have a team name that includes "WS"?
machine_repair
select starting_year from technician where team = 'NYY' or team like '%WS%'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "machine_repair", "sql": "select starting_year from technician where team = 'NYY' or team like '%WS%'" }, "style": "rule" }
{ "index": 2327, "split": "train" }
Can you find the difference between the highest savings balance among accounts with at least 999,999,999 and the savings balance of customer 1?
small_bank_1
select t2.c1 - t0.c0 from (select max(balance) as c1 from savings where balance >= 999999999.0) as t2, (select balance as c0 from savings where custid = 1) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "small_bank_1", "sql": "select t2.c1 - t0.c0 from (select max(balance) as c1 from savings where balance >= 999999999.0) as t2, (select balance as c0 from savings where custid = 1) as t0" }, "style": "rule" }
{ "index": 3174, "split": "train" }
What are the names of the three captains with the lowest ship IDs, where they command ships with ID 2, and their minimum ship ID is between 2 and 4?
ship_1
select name as c0 from captain where ship_id between 2 and 2 group by c0 having min(ship_id) between 2 and 4 order by min(ship_id) asc nulls last limit 3
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "ship_1", "sql": "select name as c0 from captain where ship_id between 2 and 2 group by c0 having min(ship_id) between 2 and 4 order by min(ship_id) asc nulls last limit 3" }, "style": "rule" }
{ "index": 823, "split": "train" }
What are the organization IDs involved in contacts, and which organization has the ID 1?
e_government
select t0.organization_id, t1.organization_id as c0 from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where c0 = 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "e_government", "sql": "select t0.organization_id, t1.organization_id as c0 from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where c0 = 1" }, "style": "rule" }
{ "index": 1136, "split": "train" }
What are the top three City IDs with the highest number of February temperature records, where each city has at most around 26 such records, ordered from the most to the least?
city_record
select city_id as c0 from temperature group by c0 having count(distinct (feb)) <= 26.1 order by count(distinct (feb)) 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": "city_record", "sql": "select city_id as c0 from temperature group by c0 having count(distinct (feb)) <= 26.1 order by count(distinct (feb)) desc limit 3" }, "style": "rule" }
{ "index": 1578, "split": "train" }
Is the sales in billions for the company with ID 17 higher than that of the company with ID 8?
company_office
select t1.c2 > t0.c2 from (select sales_billion as c2 from companies where id = 8) as t1, (select sales_billion as c2 from companies where id = 17) 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": "company_office", "sql": "select t1.c2 > t0.c2 from (select sales_billion as c2 from companies where id = 8) as t1, (select sales_billion as c2 from companies where id = 17) as t0" }, "style": "rule" }
{ "index": 3540, "split": "train" }
What is the percentage change in the average high temperature at stations associated with trains arriving at 4:49 compared to those arriving at 06:30, considering only weekly weather data where precipitation is less than 80?
station_weather
select (avg(t0.c0) / cast(avg(t1.c0) as real) - 1) * 100 from (select t0.high_temperature as c0 from weekly_weather as t0 join station as t1 on t0.station_id = t1.id join route as t2 on t1.id = t2.station_id join train as t3 on t2.train_id = t3.id where t3.time = '4:49' and t0.precipitation < 80.0) as t0, (select t0.hi...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "station_weather", "sql": "select (avg(t0.c0) / cast(avg(t1.c0) as real) - 1) * 100 from (select t0.high_temperature as c0 from weekly_weather as t0 join station as t1 on t0.station_id = t1.id join route as t2 on t1.id = t2.station_id join train as t3 on t2.train_id = t3.id where ...
{ "index": 3847, "split": "train" }
What are the ten most recent product IDs equal to 8 in the Product Characteristics table?
products_gen_characteristics
select product_id as c0 from product_characteristics where c0 = 8 order by c0 desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "products_gen_characteristics", "sql": "select product_id as c0 from product_characteristics where c0 = 8 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 1970, "split": "train" }
Which cities and address IDs are shared between all addresses and those linked to people with last names containing "G"?
student_assessment
select anon_1.c0, anon_1.c1 from (select city as c0, address_id as c1 from addresses intersect select t0.city as c0, t0.address_id as c1 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id join people as t2 on t1.person_id = t2.person_id where t2.last_name like '%G%') 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": "student_assessment", "sql": "select anon_1.c0, anon_1.c1 from (select city as c0, address_id as c1 from addresses intersect select t0.city as c0, t0.address_id as c1 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id join people as t2 on t1.person_i...
{ "index": 771, "split": "train" }
Which shops have devices from carriers ending with 'lity', and what are their locations, names, IDs, along with the device IDs in stock?
device
select t0.location, t0.shop_name, t0.shop_id, t1.device_id from shop as t0 join stock as t1 on t0.shop_id = t1.shop_id join device as t2 on t1.device_id = t2.device_id where t2.carrier like '%lity'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "device", "sql": "select t0.location, t0.shop_name, t0.shop_id, t1.device_id from shop as t0 join stock as t1 on t0.shop_id = t1.shop_id join device as t2 on t1.device_id = t2.device_id where t2.carrier like '%lity'" }, "style": "rule" }
{ "index": 1096, "split": "train" }
Which are the first three parks (by name) that hosted games with attendance between 1,070,621 and 2,261,845 in years when there were no postseason games?
baseball_1
select t0.park_name as c0 from park as t0 join home_game as t1 on t0.park_id = t1.park_id where (not t1.year in (select postseason.year as c1 from postseason)) and t1.attendance between 1070621 and 2261845 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": "baseball_1", "sql": "select t0.park_name as c0 from park as t0 join home_game as t1 on t0.park_id = t1.park_id where (not t1.year in (select postseason.year as c1 from postseason)) and t1.attendance between 1070621 and 2261845 order by c0 asc nulls last limit 3" }, "style": "...
{ "index": 2210, "split": "train" }
What are the names of up to 10 products and their interaction types with enzyme ID 1, listed in reverse alphabetical order of the interaction type?
medicine_enzyme_interaction
select t0.product, t1.interaction_type as c0 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.enzyme_id = 1 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": "medicine_enzyme_interaction", "sql": "select t0.product, t1.interaction_type as c0 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.enzyme_id = 1 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 2891, "split": "train" }
Which ten airline or cargo companies with types starting with "Corpora" have the highest combined flight velocities, and what are their IDs?
flight_company
select sum(t0.velocity), t1.id as c0 from flight as t0 join operate_company as t1 on t0.company_id = t1.id where t1.type like 'Corpora%' group by c0 order by count(*) desc limit 10
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "flight_company", "sql": "select sum(t0.velocity), t1.id as c0 from flight as t0 join operate_company as t1 on t0.company_id = t1.id where t1.type like 'Corpora%' group by c0 order by count(*) desc limit 10" }, "style": "rule" }
{ "index": 1711, "split": "train" }
Which three member roles have the highest number of unique members, and how many members are in each of these roles?
performance_attendance
select role as c0, count(distinct (member_id)) as c1 from member 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": "performance_attendance", "sql": "select role as c0, count(distinct (member_id)) as c1 from member group by c0 order by c1 desc limit 3" }, "style": "rule" }
{ "index": 1697, "split": "train" }
What are the hardware colors and character cell sizes for screen modes that are not used by phones featuring chip models with more than 48 Mib of ROM?
phone_1
select anon_1.c0, anon_1.c1 from (select hardware_colours as c0, char_cells as c1 from screen_mode except select t0.hardware_colours as c0, t0.char_cells as c1 from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode join chip_model as t2 on t1.chip_model = t2.model_name where t2.rom_mib > 48.0) as ...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "phone_1", "sql": "select anon_1.c0, anon_1.c1 from (select hardware_colours as c0, char_cells as c1 from screen_mode except select t0.hardware_colours as c0, t0.char_cells as c1 from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode join chip_model as t2 on ...
{ "index": 2761, "split": "train" }
What are the focal lengths, camera lens IDs, brands, photo IDs, and photo names for photos of mountains located in the country with the most mountains or in Kenya?
mountain_photos
select t0.focal_length_mm, t0.id, t0.brand, t1.id, t1.name from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id join mountain as t2 on t1.mountain_id = t2.id, (select country as c2 from mountain group by c2 order by count(*) desc limit 1) as t0 where t2.country = t0.c2 or t2.country = 'Kenya'
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "mountain_photos", "sql": "select t0.focal_length_mm, t0.id, t0.brand, t1.id, t1.name from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id join mountain as t2 on t1.mountain_id = t2.id, (select country as c2 from mountain group by c2 order by count(*) desc limit 1...
{ "index": 1220, "split": "train" }
How many hotels are there for each star rating code and description that starts with "sta" in the hotel star ratings?
cre_Theme_park
select count(t0.price_range), t1.star_rating_description as c2, t1.star_rating_code as c0 from hotels as t0 join ref_hotel_star_ratings as t1 on t0.star_rating_code = t1.star_rating_code where c2 like 'sta%' 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": "cre_Theme_park", "sql": "select count(t0.price_range), t1.star_rating_description as c2, t1.star_rating_code as c0 from hotels as t0 join ref_hotel_star_ratings as t1 on t0.star_rating_code = t1.star_rating_code where c2 like 'sta%' group by c0" }, "style": "rule" }
{ "index": 528, "split": "train" }
Find the tweet ID and the number of unique users who posted that tweet, for the tweet with ID 2, posted between 8:00 PM and 8:01 PM on March 9, 2018.
twitter_1
select id as c0, count(distinct (uid)) from tweets where c0 = 2 and createdate between '2018-03-09 20:00:14' and '2018-03-09 20:01:02' 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": "twitter_1", "sql": "select id as c0, count(distinct (uid)) from tweets where c0 = 2 and createdate between '2018-03-09 20:00:14' and '2018-03-09 20:01:02' group by c0" }, "style": "rule" }
{ "index": 133, "split": "train" }
Can you tell me the names and customer IDs (from the accounts table) along with their checking account IDs for the top 10 customers whose checking balances are either at least 77.0 or exactly 7000.0, ordered by the checking account ID in descending order?
small_bank_1
select t0.name, t0.custid, t1.custid as c0 from accounts as t0 join checking as t1 on t0.custid = t1.custid where t1.balance >= 77.0 or t1.balance = 7000.0 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": "small_bank_1", "sql": "select t0.name, t0.custid, t1.custid as c0 from accounts as t0 join checking as t1 on t0.custid = t1.custid where t1.balance >= 77.0 or t1.balance = 7000.0 order by c0 desc limit 10" }, "style": "rule" }
{ "index": 471, "split": "train" }
Which countries have locations in Canada, but do not have any locations with a state or province that includes "ch"?
hr_1
select anon_1.c0, anon_1.c1 from (select t0.country_name as c0, t0.country_id as c1 from countries as t0 join locations as t1 on t0.country_id = t1.country_id where t1.country_id = 'CA' except select t0.country_name as c0, t0.country_id as c1 from countries as t0 join locations as t1 on t0.country_id = t1.country_id wh...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c0, anon_1.c1 from (select t0.country_name as c0, t0.country_id as c1 from countries as t0 join locations as t1 on t0.country_id = t1.country_id where t1.country_id = 'CA' except select t0.country_name as c0, t0.country_id as c1 from countries as t0 j...
{ "index": 983, "split": "train" }
Did customer 14 become a customer before customer 10?
driving_school
select t1.c2 < t0.c2 from (select date_became_customer as c2 from customers where customer_id = 14) as t1, (select date_became_customer as c2 from customers where customer_id = 10) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "driving_school", "sql": "select t1.c2 < t0.c2 from (select date_became_customer as c2 from customers where customer_id = 14) as t1, (select date_became_customer as c2 from customers where customer_id = 10) as t0" }, "style": "rule" }
{ "index": 3130, "split": "train" }
Which are the details of up to three workshops, including their venue and date, that have accepted submissions with submission IDs of 9 or 5?
workshop_paper
select t0.venue, t0.date, t0.workshop_id, t1.workshop_id, t1.submission_id as c1 from workshop as t0 join acceptance as t1 on t0.workshop_id = t1.workshop_id join submission as t2 on t1.submission_id = t2.submission_id where t2.submission_id = 9 or t2.submission_id = 5 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": "workshop_paper", "sql": "select t0.venue, t0.date, t0.workshop_id, t1.workshop_id, t1.submission_id as c1 from workshop as t0 join acceptance as t1 on t0.workshop_id = t1.workshop_id join submission as t2 on t1.submission_id = t2.submission_id where t2.submission_id = 9 or t2.sub...
{ "index": 2103, "split": "train" }
Did the grant with ID 3 end before the grant with ID 5?
tracking_grants_for_research
select t1.c0 < t0.c0 from (select grant_end_date as c0 from grants where grant_id = 3) as t1, (select grant_end_date as c0 from grants where grant_id = 5) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "tracking_grants_for_research", "sql": "select t1.c0 < t0.c0 from (select grant_end_date as c0 from grants where grant_id = 3) as t1, (select grant_end_date as c0 from grants where grant_id = 5) as t0" }, "style": "rule" }
{ "index": 3822, "split": "train" }
Find the highest-ranking market (or the one with the best rank) in each district that has phones starting with "IP" or "IPh", showing the number of shops and the district, ordered by district alphabetically, and only display the first such market per district.
phone_market
select t0.ranking, t0.num_of_shops, t0.district as c2 from market as t0 join phone_market as t1 on t0.market_id = t1.market_id join phone as t2 on t1.phone_id = t2.phone_id where t2.name like 'IP%' or t2.name like 'IPh%' order by c2 asc nulls last limit 1
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "phone_market", "sql": "select t0.ranking, t0.num_of_shops, t0.district as c2 from market as t0 join phone_market as t1 on t0.market_id = t1.market_id join phone as t2 on t1.phone_id = t2.phone_id where t2.name like 'IP%' or t2.name like 'IPh%' order by c2 asc nulls last limit 1" ...
{ "index": 1219, "split": "train" }
How many days pass between the claim being made and the claim being settled?
insurance_policies
select julianday(t1.c0) - julianday(t0.c3) from (select date_claim_made as c0 from claims) as t1, (select date_claim_settled as c3 from claims) as t0
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "insurance_policies", "sql": "select julianday(t1.c0) - julianday(t0.c3) from (select date_claim_made as c0 from claims) as t1, (select date_claim_settled as c3 from claims) as t0" }, "style": "rule" }
{ "index": 3727, "split": "train" }
Which are the names and IDs of the top 3 media types associated with tracks purchased by the customer with ID 55 (specifically the email they most frequently used) or customers whose emails start with "roberto.alm," ordered by media type ID in descending order?
store_1
select t0.name, t0.id, t1.media_type_id as c3 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id join invoice_lines as t2 on t1.id = t2.track_id join invoices as t3 on t2.invoice_id = t3.id join customers as t4 on t3.customer_id = t4.id, (select email as c1 from customers where id = 55 group by c1 ord...
spider
[ { "content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer...
logic
{ "ground_truth": { "db_id": "store_1", "sql": "select t0.name, t0.id, t1.media_type_id as c3 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id join invoice_lines as t2 on t1.id = t2.track_id join invoices as t3 on t2.invoice_id = t3.id join customers as t4 on t3.customer_id = t4.id, (selec...
{ "index": 1890, "split": "train" }
How much does the minimum characteristic ID for characteristic 12 differ from that of characteristic 15?
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 = 12 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 = 12 group by t0.characteristic_id) as ...
{ "index": 3619, "split": "train" }