question stringlengths 1 606 | db_id stringclasses 139
values | external_knowledge stringclasses 1
value | sql stringlengths 19 1.35k | data_source stringclasses 1
value | prompt listlengths 2 2 | ability stringclasses 1
value | reward_model dict | extra_info dict |
|---|---|---|---|---|---|---|---|---|
Which organizations, including their IDs and formation dates, are connected to individuals whose last names contain the letter "d" or start with the letter "R"? | e_government | select t0.organization_id, t0.date_formed, t1.individual_id from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id join individuals as t2 on t1.individual_id = t2.individual_id where t2.individual_last_name like '%d%' or t2.individual_last_name like 'R%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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, t0.date_formed, t1.individual_id from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id join individuals as t2 on t1.individual_id = t2.individual_id where t2.individual_las... | {
"index": 2946,
"split": "train"
} | |
Which are the first five stadiums, sorted by their ID, including their ID, name, number of home games, and the average game ID of injury accidents that occurred there? | game_injury | select t0.id as c1, t0.name, t0.home_games, avg(t2.game_id) from stadium as t0 join game as t1 on t0.id = t1.stadium_id join injury_accident as t2 on t1.id = t2.game_id 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": "game_injury",
"sql": "select t0.id as c1, t0.name, t0.home_games, avg(t2.game_id) from stadium as t0 join game as t1 on t0.id = t1.stadium_id join injury_accident as t2 on t1.id = t2.game_id group by c1 order by c1 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 188,
"split": "train"
} | |
Which city has the lowest city code, and what is the average age of students in that city? | voter_2 | select city_code as c0, avg(age) from student group by c0 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": "voter_2",
"sql": "select city_code as c0, avg(age) from student group by c0 order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2530,
"split": "train"
} | |
Which submissions have been accepted both in workshop 2 and in other workshops, and what are their scores, submission IDs, and colleges? | workshop_paper | select anon_1.c3, anon_1.c1, anon_1.c0 from (select t0.scores as c3, t0.submission_id as c1, t0.college as c0 from submission as t0 join acceptance as t1 on t0.submission_id = t1.submission_id where (not t1.workshop_id in (select workshop_id as c2 from workshop where c2 = 2)) intersect select t0.scores as c3, t0.submis... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c3, anon_1.c1, anon_1.c0 from (select t0.scores as c3, t0.submission_id as c1, t0.college as c0 from submission as t0 join acceptance as t1 on t0.submission_id = t1.submission_id where (not t1.workshop_id in (select workshop_id as c2 from wo... | {
"index": 1006,
"split": "train"
} | |
What are the details and IDs of the top 5 products with product IDs up to 2, ordered from Z to A by their descriptions? | customers_and_addresses | select t0.product_details as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id <= 2 order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_addresses",
"sql": "select t0.product_details as c0 from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id <= 2 order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 121,
"split": "train"
} | |
What is the difference between the total sum of review item IDs for item 5 and the number 14? | epinions_1 | select t0.c2 - 14 from (select sum(t1.i_id) as c2 from item as t0 join review as t1 on t0.i_id = t1.i_id where t0.i_id = 5 group by t0.i_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select t0.c2 - 14 from (select sum(t1.i_id) as c2 from item as t0 join review as t1 on t0.i_id = t1.i_id where t0.i_id = 5 group by t0.i_id) as t0"
},
"style": "rule"
} | {
"index": 3235,
"split": "train"
} | |
How much more does the total sum of country IDs for country 37 exceed the smallest total sum of country IDs among all countries? | sakila_1 | select t2.c3 - t0.c2 from (select min(t1.c2) as c3 from (select sum(t1.country_id) as c2 from country as t0 join city as t1 on t0.country_id = t1.country_id group by t0.country_id) as t1) as t2, (select t0.country_id, sum(t1.country_id) as c2 from country as t0 join city as t1 on t0.country_id = t1.country_id where 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": "sakila_1",
"sql": "select t2.c3 - t0.c2 from (select min(t1.c2) as c3 from (select sum(t1.country_id) as c2 from country as t0 join city as t1 on t0.country_id = t1.country_id group by t0.country_id) as t1) as t2, (select t0.country_id, sum(t1.country_id) as c2 from country as t0... | {
"index": 3201,
"split": "train"
} | |
Show the age, ID, and name of editors who are associated with journals that have sales of 3421 or less. | journal_committee | select t0.age, t0.editor_id, t0.name from editor as t0 join journal_committee as t1 on t0.editor_id = t1.editor_id join journal as t2 on t1.journal_id = t2.journal_id where t2.sales <= 3421 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "journal_committee",
"sql": "select t0.age, t0.editor_id, t0.name from editor as t0 join journal_committee as t1 on t0.editor_id = t1.editor_id join journal as t2 on t1.journal_id = t2.journal_id where t2.sales <= 3421"
},
"style": "rule"
} | {
"index": 2036,
"split": "train"
} | |
What is the difference between the game ID of injury accident 6 and the smallest game ID among injury accidents that occurred in game 2? | game_injury | select t2.c2 - t0.c1 from (select min(game_id) as c2 from injury_accident where game_id = 2) as t2, (select game_id as c1 from injury_accident where id = 6) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "game_injury",
"sql": "select t2.c2 - t0.c1 from (select min(game_id) as c2 from injury_accident where game_id = 2) as t2, (select game_id as c1 from injury_accident where id = 6) as t0"
},
"style": "rule"
} | {
"index": 3823,
"split": "train"
} | |
How many skills are required to fix faults with Part Fault ID 7? | assets_maintenance | select count(*) from skills_required_to_fix where part_fault_id = 7 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "assets_maintenance",
"sql": "select count(*) from skills_required_to_fix where part_fault_id = 7"
},
"style": "rule"
} | {
"index": 1249,
"split": "train"
} | |
What are the highest invoice numbers for the 10 most recent orders with customer IDs at least 11 and order statuses starting with "Packi"? | tracking_orders | select max(t0.invoice_number) from shipments as t0 join orders as t1 on t0.order_id = t1.order_id where t1.customer_id >= 11 and t1.order_status like 'Packi%' group by t1.order_id order by t1.order_id desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select max(t0.invoice_number) from shipments as t0 join orders as t1 on t0.order_id = t1.order_id where t1.customer_id >= 11 and t1.order_status like 'Packi%' group by t1.order_id order by t1.order_id desc limit 10"
},
"style": "rule"
} | {
"index": 1198,
"split": "train"
} | |
? | journal_committee | select anon_1.c1, anon_1.c2, anon_1.c0 from (select t0.journal_id as c1, t0.sales as c2, t0.date as c0 from journal as t0 join journal_committee as t1 on t0.journal_id = t1.journal_id where t1.editor_id = 1 except select t0.journal_id as c1, t0.sales as c2, t0.date as c0 from journal as t0 join journal_committee as t1 ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "journal_committee",
"sql": "select anon_1.c1, anon_1.c2, anon_1.c0 from (select t0.journal_id as c1, t0.sales as c2, t0.date as c0 from journal as t0 join journal_committee as t1 on t0.journal_id = t1.journal_id where t1.editor_id = 1 except select t0.journal_id as c1, t0.sales a... | {
"index": 2608,
"split": "train"
} | |
Is the sum of the characteristic IDs for product 12 less than 15? | products_gen_characteristics | select t0.c0 < 15 from (select sum(t1.characteristic_id) as c0 from products as t0 join product_characteristics as t1 on t0.product_id = t1.product_id where t0.product_id = 12 group by t0.product_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_gen_characteristics",
"sql": "select t0.c0 < 15 from (select sum(t1.characteristic_id) as c0 from products as t0 join product_characteristics as t1 on t0.product_id = t1.product_id where t0.product_id = 12 group by t0.product_id) as t0"
},
"style": "rule"
} | {
"index": 3346,
"split": "train"
} | |
What are the top 10 artist IDs with the highest number of exhibitions for artists named Larry Nelson who are 50 years old or younger, and what are their average joining years for these artists? | theme_gallery | select artist_id as c2, avg(year_join), count(*) as c1 from artist where age <= 50 and name = 'Larry Nelson' group by c2 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": "theme_gallery",
"sql": "select artist_id as c2, avg(year_join), count(*) as c1 from artist where age <= 50 and name = 'Larry Nelson' group by c2 order by c1 desc limit 10"
},
"style": "rule"
} | {
"index": 1588,
"split": "train"
} | |
Is the date of birth of guest with ID 10 earlier than that of guest with ID 11? | apartment_rentals | select t1.c2 < t0.c2 from (select date_of_birth as c2 from guests where guest_id = 10) as t1, (select date_of_birth as c2 from guests where guest_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": "apartment_rentals",
"sql": "select t1.c2 < t0.c2 from (select date_of_birth as c2 from guests where guest_id = 10) as t1, (select date_of_birth as c2 from guests where guest_id = 11) as t0"
},
"style": "rule"
} | {
"index": 3114,
"split": "train"
} | |
What percentage change is there in the number of unique users with partition IDs less than 23 who posted tweets at 8:00:14 PM on March 9, 2018? | twitter_1 | select (count(distinct (t0.c2)) / cast(count(distinct (t0.c2)) as real) - 1) * 100 from (select max(t1.uid) as c2 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.createdate = '2018-03-09 20:00:14' and t0.partitionid < 23 group by t0.uid) 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 (count(distinct (t0.c2)) / cast(count(distinct (t0.c2)) as real) - 1) * 100 from (select max(t1.uid) as c2 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.createdate = '2018-03-09 20:00:14' and t0.partitionid < 23 group by t0.uid)... | {
"index": 3065,
"split": "train"
} | |
Is the total amount of transactions made with the card linked to customer 4 greater than that of the card linked to customer 2? | customers_card_transactions | select t1.c1 > t0.c1 from (select sum(t1.transaction_amount) as c1 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t0.card_id = 2 group by t0.card_id) as t1, (select t0.card_id, sum(t1.transaction_amount) as c1 from customers_cards as t0 join financial_transactions as t1 on... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select t1.c1 > t0.c1 from (select sum(t1.transaction_amount) as c1 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id where t0.card_id = 2 group by t0.card_id) as t1, (select t0.card_id, sum(t1.transaction... | {
"index": 3543,
"split": "train"
} | |
Which dorms, specifically the one with the highest number of amenities among those linked to dorm 100, have their gender, dorm ID, and the total count of amenities? | dorm_1 | select t0.gender, t0.dormid as c3, count(t1.amenid) from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid, (select dormid as c0 from has_amenity where c0 = 100 group by c0 order by count(*) desc limit 1) as t0 where t1.dormid = t0.c0 group by c3 having count(*) >= 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "dorm_1",
"sql": "select t0.gender, t0.dormid as c3, count(t1.amenid) from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid, (select dormid as c0 from has_amenity where c0 = 100 group by c0 order by count(*) desc limit 1) as t0 where t1.dormid = t0.c0 group by c3 having ... | {
"index": 136,
"split": "train"
} | |
How many unique products are there in the Seeds category? | products_gen_characteristics | select t0.c0 from (select count(distinct (t1.product_id)) as c0 from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code where t0.product_category_code = 'Seeds' group by t0.product_category_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": "products_gen_characteristics",
"sql": "select t0.c0 from (select count(distinct (t1.product_id)) as c0 from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code where t0.product_category_code = 'Seeds' group by t0.product_categor... | {
"index": 3392,
"split": "train"
} | |
For each music festival result, what are the top 10 results based on the highest number of distinct categories, including their average volume and the count of unique categories? | music_4 | select result as c0, avg(volume), count(distinct (category)) as c2 from music_festival group by c0 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": "music_4",
"sql": "select result as c0, avg(volume), count(distinct (category)) as c2 from music_festival group by c0 order by c2 desc limit 10"
},
"style": "rule"
} | {
"index": 1368,
"split": "train"
} | |
What are the countries and their number of cities where films directed by the most frequently occurring director—who made films for studios ending with "iversal" and with titles containing "entl"—are available? | film_rank | select anon_1.c2, anon_1.c1 from (select country as c2, number_cities as c1 from market union select t0.country as c2, t0.number_cities as c1 from market as t0 join film_market_estimation as t1 on t0.market_id = t1.market_id join film as t2 on t1.film_id = t2.film_id, (select director as c0 from film where studio like ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "film_rank",
"sql": "select anon_1.c2, anon_1.c1 from (select country as c2, number_cities as c1 from market union select t0.country as c2, t0.number_cities as c1 from market as t0 join film_market_estimation as t1 on t0.market_id = t1.market_id join film as t2 on t1.film_id = t2.... | {
"index": 2990,
"split": "train"
} | |
Can you list the descriptions of the five functional areas that are associated with documents whose codes start with "706" or are included in the document list, sorted in reverse alphabetical order? | document_management | select t0.functional_area_description as c0 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t1.document_code like '706%' or t1.document_code in (select documents.document_code as c1 from documents) order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "document_management",
"sql": "select t0.functional_area_description as c0 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code where t1.document_code like '706%' or t1.document_code in (select documents.document_cod... | {
"index": 2259,
"split": "train"
} | |
Which cities that hosted matches at the venue with the most events also hosted the match with ID 6, and what are their City IDs, regional populations, and city names? | city_record | select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.city_id as c0, t0.regional_population as c2, t0.city as c1 from city as t0 join hosting_city as t1 on t0.city_id = t1.host_city join match as t2 on t1.match_id = t2.match_id, (select venue as c3 from match group by c3 order by count(*) desc limit 1) as t1 where t2.... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.city_id as c0, t0.regional_population as c2, t0.city as c1 from city as t0 join hosting_city as t1 on t0.city_id = t1.host_city join match as t2 on t1.match_id = t2.match_id, (select venue as c3 from mat... | {
"index": 36,
"split": "train"
} | |
Which are the first three party services where the service name includes the letter "f," showing the service ID, customer ID, and service name, sorted by the service ID? | e_government | select t0.service_id as c1, t0.customer_id, t1.service_name as c0 from party_services as t0 join services as t1 on t0.service_id = t1.service_id where c0 like '%f%' order by c1 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_government",
"sql": "select t0.service_id as c1, t0.customer_id, t1.service_name as c0 from party_services as t0 join services as t1 on t0.service_id = t1.service_id where c0 like '%f%' order by c1 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 918,
"split": "train"
} | |
Show the date, journal ID, work type, and journal ID for all records involving editors whose names end with "ław Grzywna. | journal_committee | select t0.date, t0.journal_id, t1.work_type, t1.journal_id from journal as t0 join journal_committee as t1 on t0.journal_id = t1.journal_id join editor as t2 on t1.editor_id = t2.editor_id where t2.name like '%ław Grzywna' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "journal_committee",
"sql": "select t0.date, t0.journal_id, t1.work_type, t1.journal_id from journal as t0 join journal_committee as t1 on t0.journal_id = t1.journal_id join editor as t2 on t1.editor_id = t2.editor_id where t2.name like '%ław Grzywna'"
},
"style": "rule"
} | {
"index": 581,
"split": "train"
} | |
Among the document types that have more than three documents, which three types have the highest number of total documents, and what are the counts of total documents and unique document names for each, sorted from Z to A by document type code? | document_management | select document_type_code as c2, count(*) as c0, count(distinct (document_name)) from documents group by c2 having c0 > 3 order by c2 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "document_management",
"sql": "select document_type_code as c2, count(*) as c0, count(distinct (document_name)) from documents group by c2 having c0 > 3 order by c2 desc limit 3"
},
"style": "rule"
} | {
"index": 2883,
"split": "train"
} | |
Which role descriptions are assigned to users named 'amelie53' or with usernames containing the letter 'e', selecting only the top five role descriptions in reverse alphabetical order? | document_management | select t0.role_description as c0 from roles as t0 join users as t1 on t0.role_code = t1.role_code where t1.user_name = 'amelie53' or t1.user_name like '%e%' order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "document_management",
"sql": "select t0.role_description as c0 from roles as t0 join users as t1 on t0.role_code = t1.role_code where t1.user_name = 'amelie53' or t1.user_name like '%e%' order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 2644,
"split": "train"
} | |
Which are the first 10 states in alphabetical order, and what is the total number of customers in each of those states? | loan_1 | select state as c0, sum(no_of_customers) from bank group by c0 order by c0 asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "loan_1",
"sql": "select state as c0, sum(no_of_customers) from bank group by c0 order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 2140,
"split": "train"
} | |
List the (up to) ten most recent nomination entries for festival ID 5, showing their festival IDs. | entertainment_awards | select festival_id as c0 from nomination where c0 = 5 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": "entertainment_awards",
"sql": "select festival_id as c0 from nomination where c0 = 5 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 1254,
"split": "train"
} | |
Which coach IDs and names are listed in the coaching staff but are not associated with any players who reside in places ending with the letter "k"? | riding_club | select anon_1.c1, anon_1.c0 from (select coach_id as c1, coach_name as c0 from coach except select t0.coach_id as c1, t0.coach_name as c0 from coach as t0 join player_coach as t1 on t0.coach_id = t1.coach_id join player as t2 on t1.player_id = t2.player_id where t2.residence like '%k') 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": "riding_club",
"sql": "select anon_1.c1, anon_1.c0 from (select coach_id as c1, coach_name as c0 from coach except select t0.coach_id as c1, t0.coach_name as c0 from coach as t0 join player_coach as t1 on t0.coach_id = t1.coach_id join player as t2 on t1.player_id = t2.player_id w... | {
"index": 2422,
"split": "train"
} | |
Show, for each university primary conference, the total number of schools, the maximum enrollment, and the earliest founding year. List the top 10 conferences in reverse alphabetical order. | university_basketball | select primary_conference as c1, count(school_id), max(enrollment), min(founded) from university 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": "university_basketball",
"sql": "select primary_conference as c1, count(school_id), max(enrollment), min(founded) from university group by c1 order by c1 desc limit 10"
},
"style": "rule"
} | {
"index": 619,
"split": "train"
} | |
Find the most recent Service Type Code for the service with ID 5, sorted in reverse alphabetical order, limited to the top one. | local_govt_in_alabama | select service_type_code as c0 from services where service_id = 5 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": "local_govt_in_alabama",
"sql": "select service_type_code as c0 from services where service_id = 5 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 154,
"split": "train"
} | |
Does employee 5's hire date come before their own hire date? | store_1 | select hire_date < hire_date from employees where 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_1",
"sql": "select hire_date < hire_date from employees where id = 5"
},
"style": "rule"
} | {
"index": 3146,
"split": "train"
} | |
Can you list the top 5 colleges, showing their IDs and full names, along with the player IDs and their associated college IDs, for players who bat with a style ending in "B" and who passed away in or after 1918? The list should be sorted by the college ID in order. | baseball_1 | select t0.college_id as c2, t0.name_full, t1.player_id, t1.college_id from college as t0 join player_college as t1 on t0.college_id = t1.college_id join player as t2 on t1.player_id = t2.player_id where t2.bats like '%B' and t2.death_year >= 1918 order by c2 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select t0.college_id as c2, t0.name_full, t1.player_id, t1.college_id from college as t0 join player_college as t1 on t0.college_id = t1.college_id join player as t2 on t1.player_id = t2.player_id where t2.bats like '%B' and t2.death_year >= 1918 order by c2 ... | {
"index": 2797,
"split": "train"
} | |
Which departments have courses starting with "Milt", and what are their budgets and names? Please list them sorted by the average number of credits for these courses. | college_2 | select t0.budget, t0.dept_name as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.title like 'Milt%' group by c0 order by avg(t1.credits) asc nulls last | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_2",
"sql": "select t0.budget, t0.dept_name as c0 from department as t0 join course as t1 on t0.dept_name = t1.dept_name where t1.title like 'Milt%' group by c0 order by avg(t1.credits) asc nulls last"
},
"style": "rule"
} | {
"index": 2352,
"split": "train"
} | |
What are the bottom 10 apartments with the lowest average apartment IDs in buildings with IDs greater than 191, including their average apartment ID, the number of available units, and the apartment ID for each? | apartment_rentals | select avg(t0.apt_id) as c1, count(t0.available_yn), t1.apt_id as c0 from view_unit_status as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.building_id > 191 group by c0 order by c1 asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "apartment_rentals",
"sql": "select avg(t0.apt_id) as c1, count(t0.available_yn), t1.apt_id as c0 from view_unit_status as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.building_id > 191 group by c0 order by c1 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 417,
"split": "train"
} | |
What are the class, track ID, race name, and date for races held at tracks with a seating capacity of exactly 81,687, or at Phoenix International Raceway? | race_track | select anon_1.c3, anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.class as c3, t0.track_id as c2, t0.name as c1, t0.date as c0 from race as t0 join track as t1 on t0.track_id = t1.track_id where t1.seating between 81687.0 and 81687.0 union select t0.class as c3, t0.track_id as c2, t0.name as c1, t0.date as c0 from race... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c3, anon_1.c2, anon_1.c1, anon_1.c0 from (select t0.class as c3, t0.track_id as c2, t0.name as c1, t0.date as c0 from race as t0 join track as t1 on t0.track_id = t1.track_id where t1.seating between 81687.0 and 81687.0 union select t0.class as ... | {
"index": 2865,
"split": "train"
} | |
Which color appears in the fewest number of photos in the Mountain Photos database? | mountain_photos | select t0.c2 as c1, count(distinct (t0.c0)) as c3 from (select color as c2, id as c0 from photos) as t0 group by c1 order by c3 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "mountain_photos",
"sql": "select t0.c2 as c1, count(distinct (t0.c0)) as c3 from (select color as c2, id as c0 from photos) as t0 group by c1 order by c3 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 3668,
"split": "train"
} | |
How much more expensive is the total price range of 3-star hotels compared to the star rating group with the lowest total price range? | cre_Theme_park | select t2.c3 - t0.c1 from (select min(t1.c1) as c3 from (select sum(t1.price_range) as c1 from ref_hotel_star_ratings as t0 join hotels as t1 on t0.star_rating_code = t1.star_rating_code group by t0.star_rating_code) as t1) as t2, (select t0.star_rating_code, sum(t1.price_range) as c1 from ref_hotel_star_ratings as t0 ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Theme_park",
"sql": "select t2.c3 - t0.c1 from (select min(t1.c1) as c3 from (select sum(t1.price_range) as c1 from ref_hotel_star_ratings as t0 join hotels as t1 on t0.star_rating_code = t1.star_rating_code group by t0.star_rating_code) as t1) as t2, (select t0.star_rating_c... | {
"index": 3185,
"split": "train"
} | |
Was order 9 placed after order 1? | tracking_orders | select t1.c1 > t0.c1 from (select date_order_placed as c1 from orders where order_id = 9) as t1, (select date_order_placed as c1 from orders where order_id = 1) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select t1.c1 > t0.c1 from (select date_order_placed as c1 from orders where order_id = 9) as t1, (select date_order_placed as c1 from orders where order_id = 1) as t0"
},
"style": "rule"
} | {
"index": 3104,
"split": "train"
} | |
What is each teacher's first name along with the highest classroom number they are responsible for? | student_1 | select firstname as c0, max(classroom) from teachers 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": "student_1",
"sql": "select firstname as c0, max(classroom) from teachers group by c0"
},
"style": "rule"
} | {
"index": 265,
"split": "train"
} | |
Is the track associated with invoice line 1211 with a lower track ID number than the track associated with invoice line 262? | store_1 | select t1.c0 < t0.c0 from (select track_id as c0 from invoice_lines where id = 1211) as t1, (select track_id as c0 from invoice_lines where id = 262) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select t1.c0 < t0.c0 from (select track_id as c0 from invoice_lines where id = 1211) as t1, (select track_id as c0 from invoice_lines where id = 262) as t0"
},
"style": "rule"
} | {
"index": 3576,
"split": "train"
} | |
What are the aircraft ID, distance, certificate ID, and certificate aircraft ID for the aircraft linked to the employee named Karen Scott with a salary of at least 33,546, where the aircraft has the lowest ID? | flight_1 | select t0.aid as c0, t0.distance, t1.eid, t1.aid from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid where t2.salary >= 33546 and t2.name = 'Karen Scott' 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": "flight_1",
"sql": "select t0.aid as c0, t0.distance, t1.eid, t1.aid from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid where t2.salary >= 33546 and t2.name = 'Karen Scott' order by c0 asc nulls last limit 1"
},
"style": "rule"... | {
"index": 879,
"split": "train"
} | |
Which apartment with four or fewer bedrooms ranks eighth in total guest IDs when sorted from smallest to largest? | apartment_rentals | select t1.c5, t1.c2 as c0 from (select row_number() over (order by t0.c1 asc nulls last) as c5, t0.c3 as c2 from (select t0.apt_id as c3, sum(t1.guest_id) as c1 from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id where t0.bedroom_count <= 4 group by c3) as t0) as t1 where c0 = 8 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "apartment_rentals",
"sql": "select t1.c5, t1.c2 as c0 from (select row_number() over (order by t0.c1 asc nulls last) as c5, t0.c3 as c2 from (select t0.apt_id as c3, sum(t1.guest_id) as c1 from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id where t0.bedro... | {
"index": 3459,
"split": "train"
} | |
Can you tell me the phone numbers, payment method codes, and IDs for all parties, including those who have completed forms with a type code that begins with "Bas"? | e_government | select anon_1.c0, anon_1.c1, anon_1.c2 from (select party_phone as c0, payment_method_code as c1, party_id as c2 from parties union select t0.party_phone as c0, t0.payment_method_code as c1, t0.party_id as c2 from parties as t0 join party_forms as t1 on t0.party_id = t1.party_id join forms as t2 on t1.form_id = t2.form... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c1, anon_1.c2 from (select party_phone as c0, payment_method_code as c1, party_id as c2 from parties union select t0.party_phone as c0, t0.payment_method_code as c1, t0.party_id as c2 from parties as t0 join party_forms as t1 on t0.... | {
"index": 1315,
"split": "train"
} | |
Which are the five most recent product IDs and their corresponding order IDs from customers with IDs 9 and 10, ordered by product ID in descending order? | tracking_orders | select t0.product_id as c1, t1.order_id from order_items as t0 join orders as t1 on t0.order_id = t1.order_id where t1.customer_id between 9 and 10 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": "tracking_orders",
"sql": "select t0.product_id as c1, t1.order_id from order_items as t0 join orders as t1 on t0.order_id = t1.order_id where t1.customer_id between 9 and 10 order by c1 desc limit 5"
},
"style": "rule"
} | {
"index": 1231,
"split": "train"
} | |
How much lower is customer ID 5 compared to 9? | customers_campaigns_ecommerce | select t0.c0 - 9 from (select max(t1.customer_id) as c0 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 5 group by t0.customer_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_campaigns_ecommerce",
"sql": "select t0.c0 - 9 from (select max(t1.customer_id) as c0 from customers as t0 join customer_orders as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 5 group by t0.customer_id) as t0"
},
"style": "rule"
} | {
"index": 3227,
"split": "train"
} | |
Which medicines have trade names and IDs that interact with enzymes producing products that start with "Porphobili" or "Hem"? | medicine_enzyme_interaction | select t0.trade_name, t0.id from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id join enzyme as t2 on t1.enzyme_id = t2.id where t2.product like 'Porphobili%' or t2.product like 'Hem%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.trade_name, t0.id from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id join enzyme as t2 on t1.enzyme_id = t2.id where t2.product like 'Porphobili%' or t2.product like 'Hem%'"
},
"style": "rule"
} | {
"index": 739,
"split": "train"
} | |
What are the top 10 role codes and their descriptions for staff involved in research projects that have outcomes starting with "Pate"? Please list their role codes in reverse alphabetical order along with the associated project staff role codes. | tracking_grants_for_research | select t0.role_code, t0.role_description, t1.role_code as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code join projects as t2 on t1.project_id = t2.project_id join project_outcomes as t3 on t2.project_id = t3.project_id where t3.outcome_code like 'Pate%' 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": "tracking_grants_for_research",
"sql": "select t0.role_code, t0.role_description, t1.role_code as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code join projects as t2 on t1.project_id = t2.project_id join project_outcomes as t3 on t2.project_id = t... | {
"index": 1886,
"split": "train"
} | |
What is the difference in the budget in millions between the movies with IDs 10 and 2? | culture_company | select t1.c1 - t0.c1 from (select budget_million as c1 from movie where movie_id = 2) as t1, (select budget_million as c1 from movie where movie_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": "culture_company",
"sql": "select t1.c1 - t0.c1 from (select budget_million as c1 from movie where movie_id = 2) as t1, (select budget_million as c1 from movie where movie_id = 10) as t0"
},
"style": "rule"
} | {
"index": 3593,
"split": "train"
} | |
How many times did each player with a first name starting with "Te" appear in the all-star list, and what are their player IDs? Please order the results by the number of appearances in descending order. | baseball_1 | select count(*) as c1, t0.player_id as c0 from player as t0 join all_star as t1 on t0.player_id = t1.player_id where t0.name_first like 'Te%' group by c0 order by c1 desc | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select count(*) as c1, t0.player_id as c0 from player as t0 join all_star as t1 on t0.player_id = t1.player_id where t0.name_first like 'Te%' group by c0 order by c1 desc"
},
"style": "rule"
} | {
"index": 287,
"split": "train"
} | |
Which captains, along with their age, rank, ship ID, class, and name, command ships that have types containing both "amax" and "ax"? | ship_1 | select anon_1.c4, anon_1.c2, anon_1.c0, anon_1.c3, anon_1.c1 from (select t0.age as c4, t0.rank as c2, t0.ship_id as c0, t0.class as c3, t0.name as c1 from captain as t0 join ship as t1 on t0.ship_id = t1.ship_id where t1.type like '%amax%' intersect select t0.age as c4, t0.rank as c2, t0.ship_id as c0, t0.class as c3,... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "ship_1",
"sql": "select anon_1.c4, anon_1.c2, anon_1.c0, anon_1.c3, anon_1.c1 from (select t0.age as c4, t0.rank as c2, t0.ship_id as c0, t0.class as c3, t0.name as c1 from captain as t0 join ship as t1 on t0.ship_id = t1.ship_id where t1.type like '%amax%' intersect select t0.ag... | {
"index": 214,
"split": "train"
} | |
Which scientists are assigned to projects with scientist ID 745685214 but not to any projects with scientist ID 332569843? Please provide their names and SSNs. | scientist_1 | select anon_1.c1, anon_1.c0 from (select t0.name as c1, t0.ssn as c0 from scientists as t0 join assignedto as t1 on t0.ssn = t1.scientist where t1.scientist = 745685214 except select t0.name as c1, t0.ssn as c0 from scientists as t0 join assignedto as t1 on t0.ssn = t1.scientist where t1.scientist = 332569843) 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": "scientist_1",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.name as c1, t0.ssn as c0 from scientists as t0 join assignedto as t1 on t0.ssn = t1.scientist where t1.scientist = 745685214 except select t0.name as c1, t0.ssn as c0 from scientists as t0 join assignedto as t1 on ... | {
"index": 2232,
"split": "train"
} | |
Can you find the project ID and details, along with the grant amount and organization ID, for the project linked to documents whose description contains "ula" or starts with "Reg"? Among these, I want the record associated with the lowest organization ID. | tracking_grants_for_research | select t0.project_id, t0.project_details, t2.grant_amount, t2.organisation_id as c0 from projects as t0 join organisations as t1 on t0.organisation_id = t1.organisation_id join grants as t2 on t1.organisation_id = t2.organisation_id join documents as t3 on t2.grant_id = t3.grant_id join document_types as t4 on t3.docum... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.project_details, t2.grant_amount, t2.organisation_id as c0 from projects as t0 join organisations as t1 on t0.organisation_id = t1.organisation_id join grants as t2 on t1.organisation_id = t2.organisation_id join doc... | {
"index": 2096,
"split": "train"
} | |
What are the fleet series, model, and aircraft ID of aircrafts that were flown by pilots who joined in 1999, ordered by fleet series in descending (reverse alphabetical) order? | pilot_record | select t0.fleet_series as c1, t0.model, t0.aircraft_id from aircraft as t0 join pilot_record as t1 on t0.aircraft_id = t1.aircraft_id join pilot as t2 on t1.pilot_id = t2.pilot_id where t2.join_year between 1999 and 1999 order by c1 desc | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "pilot_record",
"sql": "select t0.fleet_series as c1, t0.model, t0.aircraft_id from aircraft as t0 join pilot_record as t1 on t0.aircraft_id = t1.aircraft_id join pilot as t2 on t1.pilot_id = t2.pilot_id where t2.join_year between 1999 and 1999 order by c1 desc"
},
"style": "r... | {
"index": 10,
"split": "train"
} | |
Which building with a status indicating it’s under construction, ranked eighth among such buildings from shortest to tallest, does the ranking identify? | company_office | select t1.c2, t1.c5 as c0 from (select row_number() over (order by stories asc nulls last) as c2, id as c5 from buildings where status like '%ructio%') as t1 where c0 = 8 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "company_office",
"sql": "select t1.c2, t1.c5 as c0 from (select row_number() over (order by stories asc nulls last) as c2, id as c5 from buildings where status like '%ructio%') as t1 where c0 = 8"
},
"style": "rule"
} | {
"index": 3468,
"split": "train"
} | |
Which years are there records for either farms or farm competitions? | farm | select anon_1.c0 from (select year as c0 from farm union select year from farm_competition) 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": "farm",
"sql": "select anon_1.c0 from (select year as c0 from farm union select year from farm_competition) as anon_1"
},
"style": "rule"
} | {
"index": 2091,
"split": "train"
} | |
What is the change in the highest property ID for customer 79 on March 27, 2015? | local_govt_and_lot | select t0.c1 - t0.c1 from (select max(t1.property_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 79 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_and_lot",
"sql": "select t0.c1 - t0.c1 from (select max(t1.property_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 79 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t0"
},
... | {
"index": 3524,
"split": "train"
} | |
What are the address IDs and first names of the staff members who are assigned to lessons with IDs 2 or 9? | driving_school | select t0.staff_address_id, t0.first_name from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t1.lesson_id = 2 or t1.lesson_id = 9 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select t0.staff_address_id, t0.first_name from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t1.lesson_id = 2 or t1.lesson_id = 9"
},
"style": "rule"
} | {
"index": 1017,
"split": "train"
} | |
Which city has the highest number of phone numbers among employees born between January 1968 and May 1970 or between September 1947 and May 1970? Please provide the city name and the total count of phone numbers for that city. | chinook_1 | select city as c0, count(phone) as c1 from employee where birthdate between '1968-01-09 00:00:00' and '1970-05-29 00:00:00' or birthdate between '1947-09-19 00:00:00' and '1970-05-29 00:00:00' group by c0 order by c1 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "chinook_1",
"sql": "select city as c0, count(phone) as c1 from employee where birthdate between '1968-01-09 00:00:00' and '1970-05-29 00:00:00' or birthdate between '1947-09-19 00:00:00' and '1970-05-29 00:00:00' group by c0 order by c1 desc limit 1"
},
"style": "rule"
} | {
"index": 2450,
"split": "train"
} | |
Which debate IDs and venues involve at least one person with negative support equal to 7 and at least one person with affirmative support equal to 4? | debate | select anon_1.c0, anon_1.c1 from (select t0.debate_id as c0, t0.venue as c1 from debate as t0 join debate_people as t1 on t0.debate_id = t1.debate_id where t1.negative = 7 intersect select t0.debate_id as c0, t0.venue as c1 from debate as t0 join debate_people as t1 on t0.debate_id = t1.debate_id where t1.affirmative =... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "debate",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.debate_id as c0, t0.venue as c1 from debate as t0 join debate_people as t1 on t0.debate_id = t1.debate_id where t1.negative = 7 intersect select t0.debate_id as c0, t0.venue as c1 from debate as t0 join debate_people as... | {
"index": 599,
"split": "train"
} | |
When did the staff member with ID 37.0 start working on their most recent project? | tracking_grants_for_research | select t0.date_from, t0.project_id as c1 from project_staff as t0, (select max(project_id) as c3 from project_staff where staff_id = 37.0) as t1 where c1 = t1.c3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select t0.date_from, t0.project_id as c1 from project_staff as t0, (select max(project_id) as c3 from project_staff where staff_id = 37.0) as t1 where c1 = t1.c3"
},
"style": "rule"
} | {
"index": 3799,
"split": "train"
} | |
How many follower-followee relationships are recorded in the database? | twitter_1 | select count(*) from follows | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "twitter_1",
"sql": "select count(*) from follows"
},
"style": "rule"
} | {
"index": 27,
"split": "train"
} | |
Which buildings, identified by their ID, current status, and height, are associated with companies that have the least common market value in billions? | company_office | select anon_1.c0, anon_1.c2, anon_1.c1 from (select id as c0, status as c2, height as c1 from buildings intersect select t0.id as c0, t0.status as c2, t0.height as c1 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, (select market_value_billion 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": "company_office",
"sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select id as c0, status as c2, height as c1 from buildings intersect select t0.id as c0, t0.status as c2, t0.height as c1 from buildings as t0 join office_locations as t1 on t0.id = t1.building_id join companie... | {
"index": 89,
"split": "train"
} | |
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": 3910,
"split": "train"
} | |
Which are the five problem logs with the lowest total of their associated problem IDs, and what is the sum of problem IDs for each, when grouped by problem log? | tracking_software_problems | select problem_log_id as c0, sum(problem_id) as c1 from problem_log group by c0 order by c1 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select problem_log_id as c0, sum(problem_id) as c1 from problem_log group by c0 order by c1 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 1304,
"split": "train"
} | |
Can you tell me the times recorded in both the lap times and the races? | formula_1 | select anon_1.c0 from (select time as c0 from laptimes union select time from races) 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": "formula_1",
"sql": "select anon_1.c0 from (select time as c0 from laptimes union select time from races) as anon_1"
},
"style": "rule"
} | {
"index": 2312,
"split": "train"
} | |
Which submission IDs and scores are not associated with any workshop held in 2008? | workshop_paper | select anon_1.c0, anon_1.c1 from (select submission_id as c0, scores as c1 from submission except select t0.submission_id as c0, t0.scores as c1 from submission as t0 join acceptance as t1 on t0.submission_id = t1.submission_id join workshop as t2 on t1.workshop_id = t2.workshop_id where t2.date like '%2008') 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": "workshop_paper",
"sql": "select anon_1.c0, anon_1.c1 from (select submission_id as c0, scores as c1 from submission except select t0.submission_id as c0, t0.scores as c1 from submission as t0 join acceptance as t1 on t0.submission_id = t1.submission_id join workshop as t2 on t1.w... | {
"index": 66,
"split": "train"
} | |
Who are the five customers with the smallest checking balances, where their savings balance is either different from all checking balances or less than 230,000, sorted by their checking balance? | small_bank_1 | select t0.balance as c1, t0.custid from checking as t0 join accounts as t1 on t0.custid = t1.custid join savings as t2 on t1.custid = t2.custid where (not t2.balance in (select c1 as c1 from checking)) or t2.balance < 230000.0 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": "small_bank_1",
"sql": "select t0.balance as c1, t0.custid from checking as t0 join accounts as t1 on t0.custid = t1.custid join savings as t2 on t1.custid = t2.custid where (not t2.balance in (select c1 as c1 from checking)) or t2.balance < 230000.0 order by c1 asc nulls last lim... | {
"index": 1765,
"split": "train"
} | |
What are the descriptions and codes of document statuses for documents mailed to addresses that include "IT" in their details? | cre_Doc_Control_Systems | select t0.document_status_description, t0.document_status_code from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code join documents_mailed as t2 on t1.document_id = t2.document_id join addresses as t3 on t2.mailed_to_address_id = t3.address_id where t3.address_details ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.document_status_description, t0.document_status_code from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code join documents_mailed as t2 on t1.document_id = t2.document_id join addresses ... | {
"index": 1335,
"split": "train"
} | |
How many total transactions are there, and how many of those transactions are associated with cards whose type codes end with the letter "t"? | customers_card_transactions | select count(*), count(t0.card_id) from financial_transactions as t0 join customers_cards as t1 on t0.card_id = t1.card_id where t1.card_type_code like '%t' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select count(*), count(t0.card_id) from financial_transactions as t0 join customers_cards as t1 on t0.card_id = t1.card_id where t1.card_type_code like '%t'"
},
"style": "rule"
} | {
"index": 2765,
"split": "train"
} | |
What are the names, IDs, and average attendance of the first 5 stadiums when ordered alphabetically, along with the highest game ID associated with injuries at each stadium? | game_injury | select t0.name as c2, t0.id as c0, t0.average_attendance, max(t2.game_id) from stadium as t0 join game as t1 on t0.id = t1.stadium_id join injury_accident as t2 on t1.id = t2.game_id group by c0 order by c2 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "game_injury",
"sql": "select t0.name as c2, t0.id as c0, t0.average_attendance, max(t2.game_id) from stadium as t0 join game as t1 on t0.id = t1.stadium_id join injury_accident as t2 on t1.id = t2.game_id group by c0 order by c2 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 276,
"split": "train"
} | |
Can you tell me the student IDs, their advisors, genders, and majors for students who are not members of any clubs with descriptions that mention 'on campus'? | club_1 | select anon_1.c3, anon_1.c2, anon_1.c1, anon_1.c0 from (select stuid as c3, advisor as c2, sex as c1, major as c0 from student except select t0.stuid as c3, t0.advisor as c2, t0.sex as c1, t0.major as c0 from student as t0 join member_of_club as t1 on t0.stuid = t1.stuid join club as t2 on t1.clubid = t2.clubid where t... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "club_1",
"sql": "select anon_1.c3, anon_1.c2, anon_1.c1, anon_1.c0 from (select stuid as c3, advisor as c2, sex as c1, major as c0 from student except select t0.stuid as c3, t0.advisor as c2, t0.sex as c1, t0.major as c0 from student as t0 join member_of_club as t1 on t0.stuid = ... | {
"index": 67,
"split": "train"
} | |
What is the maximum order ID for customer 7, and what is this customer's name and ID? | customers_campaigns_ecommerce | select max(t0.customer_id), t1.customer_name, t1.customer_id as c2 from customer_orders as t0 join customers as t1 on t0.customer_id = t1.customer_id where c2 = 7 group by c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_campaigns_ecommerce",
"sql": "select max(t0.customer_id), t1.customer_name, t1.customer_id as c2 from customer_orders as t0 join customers as t1 on t0.customer_id = t1.customer_id where c2 = 7 group by c2"
},
"style": "rule"
} | {
"index": 106,
"split": "train"
} | |
What are the titles, categories of books, and the countries where the associated culture companies are incorporated, for book clubs with IDs ending in "5"? | culture_company | select t0.book_title, t0.category, t1.incorporated_in from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where t1.book_club_id like '%5' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "culture_company",
"sql": "select t0.book_title, t0.category, t1.incorporated_in from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where t1.book_club_id like '%5'"
},
"style": "rule"
} | {
"index": 1102,
"split": "train"
} | |
What is the percentage change in the highest average project ID for staff roles ending with "esearcher" between the most recent date in 2016 and the earliest date in 1973? | tracking_grants_for_research | select (max(t0.c2) / cast(max(t1.c2) as real) - 1) * 100 from (select avg(t1.project_id) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t1.date_to = '1973-07-19 04:51:26' and t0.role_code like '%esearcher' group by t0.role_code) as t0, (select t0.role_code, avg(t1.project_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": "tracking_grants_for_research",
"sql": "select (max(t0.c2) / cast(max(t1.c2) as real) - 1) * 100 from (select avg(t1.project_id) as c2 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t1.date_to = '1973-07-19 04:51:26' and t0.role_code like '%es... | {
"index": 3055,
"split": "train"
} | |
What are the five most recent "date to" values for customers whose names start with "Sterling"? | customers_and_products_contacts | select t0.date_to as c0 from customer_address_history as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.customer_name like 'Sterling%' 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": "customers_and_products_contacts",
"sql": "select t0.date_to as c0 from customer_address_history as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.customer_name like 'Sterling%' order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2825,
"split": "train"
} | |
What is the country where the song was released and the gender of the artist whose name includes "Enr"? | music_1 | select t0.country, t1.gender from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where t1.artist_name like '%Enr%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "music_1",
"sql": "select t0.country, t1.gender from song as t0 join artist as t1 on t0.artist_name = t1.artist_name where t1.artist_name like '%Enr%'"
},
"style": "rule"
} | {
"index": 1683,
"split": "train"
} | |
What is the end date of the grant and its ID for the grant with grant ID 11, based on the related documents? | tracking_grants_for_research | select t0.grant_end_date from grants as t0 join documents as t1 on t0.grant_id = t1.grant_id where t1.grant_id = 11 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_end_date from grants as t0 join documents as t1 on t0.grant_id = t1.grant_id where t1.grant_id = 11"
},
"style": "rule"
} | {
"index": 965,
"split": "train"
} | |
What are the five invoices with the smallest account IDs associated with them, where the invoice date was before March 20, 2018, and the order ID was either 13 or 14? These should be sorted by the total transaction amount on each invoice.
---
This version preserves all the crucial details and presents them in a clear... | customers_and_invoices | select min(t0.account_id), t1.invoice_number as c0 from financial_transactions as t0 join invoices as t1 on t0.invoice_number = t1.invoice_number where t1.invoice_date < '2018-03-20 00:21:41' and t1.order_id between 13 and 14 group by c0 order by sum(t0.transaction_amount) asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select min(t0.account_id), t1.invoice_number as c0 from financial_transactions as t0 join invoices as t1 on t0.invoice_number = t1.invoice_number where t1.invoice_date < '2018-03-20 00:21:41' and t1.order_id between 13 and 14 group by c0 order by ... | {
"index": 1286,
"split": "train"
} | |
What are the average attendance and name of each stadium, along with the number of games that had reported injuries? | game_injury | select t0.average_attendance, t0.name, count(t2.game_id) from stadium as t0 join game as t1 on t0.id = t1.stadium_id join injury_accident as t2 on t1.id = t2.game_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": "game_injury",
"sql": "select t0.average_attendance, t0.name, count(t2.game_id) from stadium as t0 join game as t1 on t0.id = t1.stadium_id join injury_accident as t2 on t1.id = t2.game_id group by t0.id"
},
"style": "rule"
} | {
"index": 2585,
"split": "train"
} | |
What are the Volume IDs and Weeks on Top for the volumes created by the most frequently appearing artist in the database? | music_4 | select anon_1.c0, anon_1.c2 from (select volume_id as c0, weeks_on_top as c2 from volume intersect select t0.volume_id as c0, t0.weeks_on_top as c2 from volume as t0 join artist as t1 on t0.artist_id = t1.artist_id, (select artist as c1 from artist group by c1 order by count(*) desc limit 1) as t0 where t1.artist = t0.... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "music_4",
"sql": "select anon_1.c0, anon_1.c2 from (select volume_id as c0, weeks_on_top as c2 from volume intersect select t0.volume_id as c0, t0.weeks_on_top as c2 from volume as t0 join artist as t1 on t0.artist_id = t1.artist_id, (select artist as c1 from artist group by c1 o... | {
"index": 562,
"split": "train"
} | |
Can you list the first ten amenities with IDs above 901, ordered alphabetically by their name, placing any null names at the end? | dorm_1 | select t0.amenity_name as c0 from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t1.amenid > 932 or t1.amenid > 901 order by c0 asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "dorm_1",
"sql": "select t0.amenity_name as c0 from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid where t1.amenid > 932 or t1.amenid > 901 order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 2564,
"split": "train"
} | |
What is the percentage change in the organization associated with service 47 between May 27, 2016, and May 31, 2017? | local_govt_and_lot | select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select t0.organization_id as c1 from services as t0 join organizations as t1 on t0.organization_id = t1.organization_id join things as t2 on t1.organization_id = t2.organization_id join timed_status_of_things as t3 on t2.thing_id = t3.thing_id where t0.service_id = 4... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_and_lot",
"sql": "select (t0.c1 / cast(t1.c1 as real) - 1) * 100 from (select t0.organization_id as c1 from services as t0 join organizations as t1 on t0.organization_id = t1.organization_id join things as t2 on t1.organization_id = t2.organization_id join timed_status... | {
"index": 3818,
"split": "train"
} | |
Which three students have allergies related to animals, including their student IDs, advisors, last names, and their allergy records? Please list the students sorted by their student IDs in descending order. | allergy_1 | select t0.stuid as c3, t0.advisor, t0.lname, t1.stuid from student as t0 join has_allergy as t1 on t0.stuid = t1.stuid join allergy_type as t2 on t1.allergy = t2.allergy where t2.allergytype like '%anim%' order by c3 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "allergy_1",
"sql": "select t0.stuid as c3, t0.advisor, t0.lname, t1.stuid from student as t0 join has_allergy as t1 on t0.stuid = t1.stuid join allergy_type as t2 on t1.allergy = t2.allergy where t2.allergytype like '%anim%' order by c3 desc limit 3"
},
"style": "rule"
} | {
"index": 448,
"split": "train"
} | |
Can you tell me the document structure codes and their descriptions for document structures that are linked to both the most accessed document in the system and the document type with the highest average access count among documents whose names include "ma"? | document_management | select anon_1.c2, anon_1.c1 from (select t0.document_structure_code as c2, t0.document_structure_description as c1 from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code, (select document_code as c0 from documents group by c0 order by sum(access_count) desc limit ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "document_management",
"sql": "select anon_1.c2, anon_1.c1 from (select t0.document_structure_code as c2, t0.document_structure_description as c1 from document_structures as t0 join documents as t1 on t0.document_structure_code = t1.document_structure_code, (select document_code a... | {
"index": 726,
"split": "train"
} | |
What are the IDs, track IDs, and billing states of the first three invoice lines (when ordered by ID) where the billing country ends with "nmark"? | store_1 | select t0.id as c1, t0.track_id, t1.billing_state from invoice_lines as t0 join invoices as t1 on t0.invoice_id = t1.id where t1.billing_country like '%nmark' 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": "store_1",
"sql": "select t0.id as c1, t0.track_id, t1.billing_state from invoice_lines as t0 join invoices as t1 on t0.invoice_id = t1.id where t1.billing_country like '%nmark' order by c1 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 1122,
"split": "train"
} | |
How much higher is the W (wins) of gouldch01 compared to haneyfr01? | baseball_1 | select t1.c0 - t0.c0 from (select w as c0 from manager where player_id = 'haneyfr01') as t1, (select w as c0 from manager where player_id = 'gouldch01') 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": "baseball_1",
"sql": "select t1.c0 - t0.c0 from (select w as c0 from manager where player_id = 'haneyfr01') as t1, (select w as c0 from manager where player_id = 'gouldch01') as t0"
},
"style": "rule"
} | {
"index": 3584,
"split": "train"
} | |
What are the names and market shares of browsers, along with the IDs of the accelerators they are compatible with, for Web Client Accelerators whose client names start with "user"? | browser_web | select t0.name, t0.market_share, t1.accelerator_id from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id join web_client_accelerator as t2 on t1.accelerator_id = t2.id where t2.client like 'user%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "browser_web",
"sql": "select t0.name, t0.market_share, t1.accelerator_id from browser as t0 join accelerator_compatible_browser as t1 on t0.id = t1.browser_id join web_client_accelerator as t2 on t1.accelerator_id = t2.id where t2.client like 'user%'"
},
"style": "rule"
} | {
"index": 1836,
"split": "train"
} | |
What are the descriptions of up to five colors that are associated with products having a typical selling price containing "59", sorted alphabetically by color description with nulls listed last? | products_gen_characteristics | select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.typical_selling_price like '%59%' order by c0 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_gen_characteristics",
"sql": "select t0.color_description as c0 from ref_colors as t0 join products as t1 on t0.color_code = t1.color_code where t1.typical_selling_price like '%59%' order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2389,
"split": "train"
} | |
Which customer's name and ID, along with their highest savings balance, have a savings account with a balance of 230,000, for the customer with ID 3? Show the most recent in reverse alphabetical order by name, limited to one result.
---
This phrasing simplifies and clarifies the intent while maintaining all critical ... | small_bank_1 | select t0.name as c1, t0.custid as c0, max(t1.balance) from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.custid = 3 and t1.balance = 230000.0 group by c0 order by c1 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "small_bank_1",
"sql": "select t0.name as c1, t0.custid as c0, max(t1.balance) from accounts as t0 join savings as t1 on t0.custid = t1.custid where t1.custid = 3 and t1.balance = 230000.0 group by c0 order by c1 desc limit 1"
},
"style": "rule"
} | {
"index": 2368,
"split": "train"
} | |
How many unique addresses are recorded for student 11? | behavior_monitoring | select t0.c0 - 0 from (select count(distinct (t1.student_id)) as c0 from students as t0 join student_addresses as t1 on t0.student_id = t1.student_id where t0.student_id = 11 group by t0.student_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": "behavior_monitoring",
"sql": "select t0.c0 - 0 from (select count(distinct (t1.student_id)) as c0 from students as t0 join student_addresses as t1 on t0.student_id = t1.student_id where t0.student_id = 11 group by t0.student_id) as t0"
},
"style": "rule"
} | {
"index": 3212,
"split": "train"
} | |
What is the difference in total price (in euros) between all products at catalog level 9 and those at level 1 with stock numbers ending with "cp"? | product_catalog | select t1.c2 - t0.c2 from (select sum(t1.price_in_euros) as c2 from catalog_structure as t0 join catalog_contents as t1 on t0.catalog_level_number = t1.catalog_level_number where t0.catalog_level_number = 1 and t1.product_stock_number like '%cp' group by t0.catalog_level_number) as t1, (select t0.catalog_level_number, ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t1.c2 - t0.c2 from (select sum(t1.price_in_euros) as c2 from catalog_structure as t0 join catalog_contents as t1 on t0.catalog_level_number = t1.catalog_level_number where t0.catalog_level_number = 1 and t1.product_stock_number like '%cp' group by... | {
"index": 3617,
"split": "train"
} | |
What are the product IDs, product details, and associated order item product IDs for orders made by customers with IDs over 15 or customers who do not have any contact channels listed? | customers_and_addresses | select t0.product_id, t0.product_details, t1.product_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id join customer_orders as t2 on t1.order_id = t2.order_id where t2.customer_id > 15 or (not t2.customer_id in (select customer_contact_channels.customer_id as c0 from customer_contact_channe... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.product_id, t0.product_details, t1.product_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id join customer_orders as t2 on t1.order_id = t2.order_id where t2.customer_id > 15 or (not t2.customer_id in (selec... | {
"index": 151,
"split": "train"
} | |
Which subjects are linked to courses whose descriptions begin with "Writing in French" or "French"? | e_learning | select t0.subject_name, t0.subject_id, t1.subject_id from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.course_description like 'Writing in French%' or t1.course_description like 'French%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select t0.subject_name, t0.subject_id, t1.subject_id from subjects as t0 join courses as t1 on t0.subject_id = t1.subject_id where t1.course_description like 'Writing in French%' or t1.course_description like 'French%'"
},
"style": "rule"
} | {
"index": 412,
"split": "train"
} | |
How many days passed between the order date and the actual delivery date for the relevant orders? | cre_Drama_Workshop_Groups | select julianday(t1.c3) - julianday(t0.c1) from (select order_date as c3 from customer_orders) as t1, (select actual_delivery_date as c1 from customer_orders where order_date <= '1988-11-13 15:42:13' and order_date <= '1988-11-13 15:42:13') as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Drama_Workshop_Groups",
"sql": "select julianday(t1.c3) - julianday(t0.c1) from (select order_date as c3 from customer_orders) as t1, (select actual_delivery_date as c1 from customer_orders where order_date <= '1988-11-13 15:42:13' and order_date <= '1988-11-13 15:42:13') as ... | {
"index": 3938,
"split": "train"
} | |
What are the test results and dates of the most recent 10 tests taken by the student who has the highest number of test attempts, sorted by the date the tests were taken? | e_learning | select t0.test_result, t0.date_test_taken as c2 from student_tests_taken as t0, (select registration_id as c0 from student_tests_taken group by c0 order by count(*) desc limit 1) as t0 where t0.registration_id = t0.c0 order by c2 asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select t0.test_result, t0.date_test_taken as c2 from student_tests_taken as t0, (select registration_id as c0 from student_tests_taken group by c0 order by count(*) desc limit 1) as t0 where t0.registration_id = t0.c0 order by c2 asc nulls last limit 10"
},... | {
"index": 498,
"split": "train"
} | |
What are the other account details, account names, and transaction types for refund transactions involving accounts with IDs greater than 9? | customers_card_transactions | select t0.other_account_details, t0.account_name, t1.transaction_type as c0 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where c0 = 'Refund' and t1.account_id > 9 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select t0.other_account_details, t0.account_name, t1.transaction_type as c0 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where c0 = 'Refund' and t1.account_id > 9"
},
"style": "rule"
} | {
"index": 1536,
"split": "train"
} | |
How many days did a document stay in a location, based on its move-in and move-out dates within the specified period? | cre_Doc_Tracking_DB | select julianday(t1.c0) - julianday(t0.c2) from (select date_in_location_from as c0 from document_locations) as t1, (select date_in_locaton_to as c2 from document_locations where date_in_location_from between '2009-08-18 03:29:08' and '2010-11-26 19:22:50' and date_in_location_from between '2009-08-18 03:29:08' and '20... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Tracking_DB",
"sql": "select julianday(t1.c0) - julianday(t0.c2) from (select date_in_location_from as c0 from document_locations) as t1, (select date_in_locaton_to as c2 from document_locations where date_in_location_from between '2009-08-18 03:29:08' and '2010-11-26 19:... | {
"index": 3681,
"split": "train"
} | |
What is the percentage increase or decrease in the total supportrepid amount for all customers between February 26, 2010, and February 9, 2010? | chinook_1 | select (sum(t0.c2) / cast(sum(t1.c2) as real) - 1) * 100 from (select t0.supportrepid as c2 from customer as t0 join invoice as t1 on t0.customerid = t1.customerid where t1.invoicedate = '2010-02-09 00:00:00') as t0, (select t0.supportrepid as c2, t0.customerid from customer as t0 join invoice as t1 on t0.customerid = ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "chinook_1",
"sql": "select (sum(t0.c2) / cast(sum(t1.c2) as real) - 1) * 100 from (select t0.supportrepid as c2 from customer as t0 join invoice as t1 on t0.customerid = t1.customerid where t1.invoicedate = '2010-02-09 00:00:00') as t0, (select t0.supportrepid as c2, t0.customeri... | {
"index": 3850,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.