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 are the latest ten activity IDs from the Faculty Participates In records where the activity ID is at most 773 and the faculty ID is greater than 1177, listed in descending order? | activity_1 | select actid as c0 from faculty_participates_in where c0 <= 773 and facid > 1177 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": "activity_1",
"sql": "select actid as c0 from faculty_participates_in where c0 <= 773 and facid > 1177 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 2982,
"split": "train"
} | |
Which artist joined between 1981 and 1988 and has the earliest year of joining? What is their artist ID and country? | theme_gallery | select artist_id, country, year_join as c0 from artist where c0 between 1981 and 1988 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": "theme_gallery",
"sql": "select artist_id, country, year_join as c0 from artist where c0 between 1981 and 1988 order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 783,
"split": "train"
} | |
What are the names, IDs, and market shares of the three browsers with the smallest market share that are compatible with web client accelerators whose client includes "Al," sorted so that the browsers with the lowest market share are listed last? | browser_web | select t0.name, t0.id, t0.market_share as c0 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 '%Al%' order by c0 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "browser_web",
"sql": "select t0.name, t0.id, t0.market_share as c0 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 '%Al%' order by c0 asc nulls last limit 3"
... | {
"index": 2835,
"split": "train"
} | |
Which are the top 10 catalogs with the highest maximum product prices, including their publication date, catalog name, catalog ID, and the maximum price of products in each catalog? | product_catalog | select t0.date_of_publication, t0.catalog_name, t0.catalog_id as c3, max(t2.price_in_dollars) as c1 from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id join catalog_contents as t2 on t1.catalog_level_number = t2.catalog_level_number group by c3 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": "product_catalog",
"sql": "select t0.date_of_publication, t0.catalog_name, t0.catalog_id as c3, max(t2.price_in_dollars) as c1 from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id join catalog_contents as t2 on t1.catalog_level_number = t2.catalog_leve... | {
"index": 2505,
"split": "train"
} | |
What are the invoice numbers from the first three shipments with invoice numbers less than 10 and order IDs between 12 and 13? | tracking_orders | select t0.invoice_number, t1.invoice_number as c1 from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where c1 < 10 and t1.order_id between 12 and 13 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": "tracking_orders",
"sql": "select t0.invoice_number, t1.invoice_number as c1 from invoices as t0 join shipments as t1 on t0.invoice_number = t1.invoice_number where c1 < 10 and t1.order_id between 12 and 13 order by c1 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 1707,
"split": "train"
} | |
What are the customer ID and savings account balance of the customer with ID 6 whose name contains the letter 'o'? | small_bank_1 | select t0.custid, t0.balance, t1.custid as c0 from savings as t0 join accounts as t1 on t0.custid = t1.custid where c0 = 6 and t1.name like '%o%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.custid, t0.balance, t1.custid as c0 from savings as t0 join accounts as t1 on t0.custid = t1.custid where c0 = 6 and t1.name like '%o%'"
},
"style": "rule"
} | {
"index": 221,
"split": "train"
} | |
For aircraft with a distance over 1502 or exactly 2605, how many flights have been scheduled for each, and what is their distance? Show the first five aircraft sorted by their id. | flight_1 | select count(t0.distance), t1.distance as c1 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where c1 > 1502 or c1 = 2605 group by t1.aid order by t1.aid 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": "flight_1",
"sql": "select count(t0.distance), t1.distance as c1 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where c1 > 1502 or c1 = 2605 group by t1.aid order by t1.aid asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2720,
"split": "train"
} | |
Can you provide the Location IDs, Addresses, and Names for all locations, including those that are associated with attractions featuring a garden? | cre_Theme_park | select anon_1.c1, anon_1.c2, anon_1.c0 from (select location_id as c1, address as c2, location_name as c0 from locations union select t0.location_id as c1, t0.address as c2, t0.location_name as c0 from locations as t0 join tourist_attractions as t1 on t0.location_id = t1.location_id join tourist_attraction_features 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": "cre_Theme_park",
"sql": "select anon_1.c1, anon_1.c2, anon_1.c0 from (select location_id as c1, address as c2, location_name as c0 from locations union select t0.location_id as c1, t0.address as c2, t0.location_name as c0 from locations as t0 join tourist_attractions as t1 on t0.... | {
"index": 2517,
"split": "train"
} | |
Did the document with ID 1 arrive before the document with ID 24? | cre_Doc_Control_Systems | select t1.c2 < t0.c2 from (select receipt_date as c2 from documents where document_id = 1) as t1, (select receipt_date as c2 from documents where document_id = 24) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Control_Systems",
"sql": "select t1.c2 < t0.c2 from (select receipt_date as c2 from documents where document_id = 1) as t1, (select receipt_date as c2 from documents where document_id = 24) as t0"
},
"style": "rule"
} | {
"index": 3119,
"split": "train"
} | |
Show the IDs and names of people whose records match those of individuals who work at the most uncommon headquarters location among companies named Wells Fargo or starting with "Volkswa". | company_employee | select anon_1.c0, anon_1.c2 from (select people_id as c0, name as c2 from people intersect select t0.people_id as c0, t0.name as c2 from people as t0 join employment as t1 on t0.people_id = t1.people_id join company as t2 on t1.company_id = t2.company_id, (select headquarters as c1 from company where name = 'Wells Farg... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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_employee",
"sql": "select anon_1.c0, anon_1.c2 from (select people_id as c0, name as c2 from people intersect select t0.people_id as c0, t0.name as c2 from people as t0 join employment as t1 on t0.people_id = t1.people_id join company as t2 on t1.company_id = t2.company_i... | {
"index": 2128,
"split": "train"
} | |
Is the average product ID for product 4 greater than the total number of products with a price of at least 7111.68, based on their average product IDs? | customer_deliveries | select t2.c0 > t1.c1 from (select avg(t1.product_id) as c0 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t0.product_id = 4 group by t0.product_id) as t2, (select count(t0.c0) as c1 from (select avg(t1.product_id) as c0 from products as t0 join regular_order_products 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": "customer_deliveries",
"sql": "select t2.c0 > t1.c1 from (select avg(t1.product_id) as c0 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t0.product_id = 4 group by t0.product_id) as t2, (select count(t0.c0) as c1 from (select avg(t1.pr... | {
"index": 3268,
"split": "train"
} | |
Was the guest with ID 14 born after themselves? | apartment_rentals | select date_of_birth > date_of_birth from guests where guest_id = 14 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 date_of_birth > date_of_birth from guests where guest_id = 14"
},
"style": "rule"
} | {
"index": 3821,
"split": "train"
} | |
What are the ten catalog structures with the fewest number of distinct prices in dollars, where the catalog level name starts with "P", sorted by increasing count of unique prices? | product_catalog | select count(distinct (t0.price_in_dollars)) as c2, t1.catalog_level_name as c1, t1.catalog_level_number as c0 from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where c1 like 'P%' group by 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": "product_catalog",
"sql": "select count(distinct (t0.price_in_dollars)) as c2, t1.catalog_level_name as c1, t1.catalog_level_number as c0 from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where c1 like 'P%' group by c0 or... | {
"index": 2691,
"split": "train"
} | |
On which date was the payment amount at its highest among all payments made on or before July 31, 2017? | insurance_policies | select t0.date_payment_made, t0.amount_payment as c2 from payments as t0, (select max(amount_payment) as c1 from payments where date_payment_made <= '2017-07-31 00:00:00') as t1 where c2 = t1.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_policies",
"sql": "select t0.date_payment_made, t0.amount_payment as c2 from payments as t0, (select max(amount_payment) as c1 from payments where date_payment_made <= '2017-07-31 00:00:00') as t1 where c2 = t1.c1"
},
"style": "rule"
} | {
"index": 3783,
"split": "train"
} | |
How many days are between the booking's end date and start date for bookings with a refund amount between 130.87 and 183.68? | products_for_hire | select julianday(t1.c1) - julianday(t0.c3) from (select booking_end_date as c1 from bookings where amount_of_refund between 130.87 and 183.68 and amount_of_refund between 130.87 and 183.68) as t1, (select booking_start_date as c3 from bookings) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_for_hire",
"sql": "select julianday(t1.c1) - julianday(t0.c3) from (select booking_end_date as c1 from bookings where amount_of_refund between 130.87 and 183.68 and amount_of_refund between 130.87 and 183.68) as t1, (select booking_start_date as c3 from bookings) as t0"
... | {
"index": 3983,
"split": "train"
} | |
Is the percentage change in total property IDs for customer 19 at the move-in date of September 27, 2016, greater than the overall percentage change in property IDs across all customers on that same date? | local_govt_and_lot | select abs((t2.c3 / cast(t2.c3 as real) - 1) * 100) > t1.c1 from (select sum(t1.property_id) as c3 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2016-09-27 12:00:00' group by t0.customer_id) as t2, (select abs((sum(t0.c3) / cast(sum(... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 abs((t2.c3 / cast(t2.c3 as real) - 1) * 100) > t1.c1 from (select sum(t1.property_id) as c3 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 19 and t1.date_moved_in = '2016-09-27 12:00:00... | {
"index": 3442,
"split": "train"
} | |
Which five apartments have bookings associated with guests whose gender code ends with "ale"? For each, include the apartment number, the number of rooms, and the booking status code, ordered by apartment number from highest to lowest. | apartment_rentals | select t0.apt_number as c2, t0.room_count, t1.booking_status_code from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.gender_code like '%ale' order by c2 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": "apartment_rentals",
"sql": "select t0.apt_number as c2, t0.room_count, t1.booking_status_code from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.gender_code like '%ale' order by c2 desc limit 5"
}... | {
"index": 707,
"split": "train"
} | |
Which channels have programs that either originate from Hunan or come from the most common origin overall? For those channels, what are the owner, channel name, and their share of viewing? | program_share | select t0.owner, t0.name, t0.share_in_percent from channel as t0 join broadcast as t1 on t0.channel_id = t1.channel_id join program as t2 on t1.program_id = t2.program_id, (select origin as c2 from program group by c2 order by count(*) asc nulls last limit 1) as t0 where t2.origin like '%Hunan%' or t2.origin = t0.c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "program_share",
"sql": "select t0.owner, t0.name, t0.share_in_percent from channel as t0 join broadcast as t1 on t0.channel_id = t1.channel_id join program as t2 on t1.program_id = t2.program_id, (select origin as c2 from program group by c2 order by count(*) asc nulls last limit... | {
"index": 1489,
"split": "train"
} | |
Which customer and their card number are associated with the account details that are the least common among all accounts, selecting the card with the highest card number in case of ties? | customers_card_transactions | select t0.customer_id, t0.card_number as c1 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id join accounts as t2 on t1.account_id = t2.account_id, (select other_account_details as c0 from accounts group by c0 order by count(*) asc nulls last limit 1) as t0 where t2.other_account_d... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.customer_id, t0.card_number as c1 from customers_cards as t0 join financial_transactions as t1 on t0.card_id = t1.card_id join accounts as t2 on t1.account_id = t2.account_id, (select other_account_details as c0 from accounts group ... | {
"index": 506,
"split": "train"
} | |
Which are the top five students, sorted in reverse alphabetical order by login name, along with their personal names, student IDs, and the number of courses they are enrolled in, where the course ID is either less than the sum of all course IDs or less than 9? | e_learning | select t0.login_name as c2, t0.personal_name, t0.student_id as c3, count(t1.student_id) from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id, (select sum(course_id) as c1 from student_course_enrolment) as t0 where t1.course_id < t0.c1 or t1.course_id < 9 group by c3 order by c2 desc ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select t0.login_name as c2, t0.personal_name, t0.student_id as c3, count(t1.student_id) from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id, (select sum(course_id) as c1 from student_course_enrolment) as t0 where t1.course... | {
"index": 2548,
"split": "train"
} | |
Find out if the percentage change in the minimum user ID for user 1 between March 9, 2018, and March 12, 2018, is greater than the percentage change in the number of users with at least 100 followers over the same period.? | twitter_1 | select t5.c3 > t2.c1 from (select abs((t3.c4 / cast(t4.c4 as real) - 1) * 100) as c3 from (select min(t1.uid) as c4 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.createdate = '2018-03-09 20:00:14' group by t0.uid) as t3, (select min(t1.uid) as c4 from user_profiles as t0 join twe... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t5.c3 > t2.c1 from (select abs((t3.c4 / cast(t4.c4 as real) - 1) * 100) as c3 from (select min(t1.uid) as c4 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 1 and t1.createdate = '2018-03-09 20:00:14' group by t0.uid) as t3,... | {
"index": 3456,
"split": "train"
} | |
Can you list the ten characteristics with IDs between 6 and 10 that have the fewest associated products, including their names and IDs? | products_gen_characteristics | select t0.characteristic_name, t0.characteristic_id as c1 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.characteristic_id between 6 and 10 group by c1 order by count(*) 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": "products_gen_characteristics",
"sql": "select t0.characteristic_name, t0.characteristic_id as c1 from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.characteristic_id between 6 and 10 group by c1 order by count(*) ... | {
"index": 209,
"split": "train"
} | |
What are the family names of students who enrolled before November 13, 2017, at 12:49:33? | e_learning | select t0.family_name from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_enrolment < '2017-11-13 12:49:33' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.family_name from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_enrolment < '2017-11-13 12:49:33'"
},
"style": "rule"
} | {
"index": 1072,
"split": "train"
} | |
What is the percentage change in the number of unique documents for all document types between August 24, 1983, and October 28, 2005? | cre_Docs_and_Epenses | select (count(t0.c1) / cast(count(t1.c1) as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c1 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.document_date = '2005-10-28 03:17:16' group by t0.document_type_code) as t0, (select t0.document_t... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Docs_and_Epenses",
"sql": "select (count(t0.c1) / cast(count(t1.c1) as real) - 1) * 100 from (select count(distinct (t1.document_id)) as c1 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.document_date = '2005-10-28... | {
"index": 3012,
"split": "train"
} | |
Which branch's membership fee, address, and opening year are associated with members who have a level below 6 or whose level is less than or equal to the average level of members who are at level 4 or below, specifically including those at level 2? | shop_membership | select t0.membership_amount, t0.address_road, t0.open_year from branch as t0 join purchase as t1 on t0.branch_id = t1.branch_id join member as t2 on t1.member_id = t2.member_id, (select avg(level) as c2 from member where level <= 4 or level between 2 and 2) as t0 where t2.level < 6 or t2.level <= t0.c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "shop_membership",
"sql": "select t0.membership_amount, t0.address_road, t0.open_year from branch as t0 join purchase as t1 on t0.branch_id = t1.branch_id join member as t2 on t1.member_id = t2.member_id, (select avg(level) as c2 from member where level <= 4 or level between 2 and... | {
"index": 2531,
"split": "train"
} | |
Which album ID is the most common among albums by artists with IDs less than or equal to 21? | chinook_1 | select t0.c1 as c0, count(distinct (t0.c1)) as c2 from (select albumid as c1 from album where artistid <= 21) as t0 group by c0 order by c2 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "chinook_1",
"sql": "select t0.c1 as c0, count(distinct (t0.c1)) as c2 from (select albumid as c1 from album where artistid <= 21) as t0 group by c0 order by c2 desc limit 1"
},
"style": "rule"
} | {
"index": 3653,
"split": "train"
} | |
What are the names of the playlists with IDs 11 or 13? | store_1 | select t0.name from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id where t1.playlist_id = 11 or t1.playlist_id = 13 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select t0.name from playlists as t0 join playlist_tracks as t1 on t0.id = t1.playlist_id where t1.playlist_id = 11 or t1.playlist_id = 13"
},
"style": "rule"
} | {
"index": 2687,
"split": "train"
} | |
Which activity with an ID between 782 and 784 has the lowest activity ID, and what are its ID and name? | activity_1 | select t0.actid as c1, t0.activity_name from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.actid between 782 and 784 order by c1 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "activity_1",
"sql": "select t0.actid as c1, t0.activity_name from activity as t0 join participates_in as t1 on t0.actid = t1.actid where t1.actid between 782 and 784 order by c1 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2996,
"split": "train"
} | |
Show all details of departments that were created in the year 1953. | department_management | select * from department where creation = '1953' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_management",
"sql": "select * from department where creation = '1953'"
},
"style": "rule"
} | {
"index": 115,
"split": "train"
} | |
What is the percentage change in the smallest number of employees in any role between those born on October 14, 1980, and those born on April 4, 1973? | cre_Doc_Tracking_DB | select (min(t0.c1) / cast(min(t1.c1) as real) - 1) * 100 from (select count(distinct (t1.employee_id)) as c1 from roles as t0 join employees as t1 on t0.role_code = t1.role_code where t1.date_of_birth = '1973-04-04 21:41:22' group by t0.role_code) as t0, (select t0.role_code, count(distinct (t1.employee_id)) as c1 from... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Tracking_DB",
"sql": "select (min(t0.c1) / cast(min(t1.c1) as real) - 1) * 100 from (select count(distinct (t1.employee_id)) as c1 from roles as t0 join employees as t1 on t0.role_code = t1.role_code where t1.date_of_birth = '1973-04-04 21:41:22' group by t0.role_code) as... | {
"index": 3010,
"split": "train"
} | |
How many document status descriptions are there for documents shipped by agents whose codes end with "S" and received on November 5, 1973, at 9:48:53 PM? | cre_Doc_Control_Systems | select count(t0.document_status_description) from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t1.shipping_agent_code like '%S' and t1.receipt_date = '1973-11-05 21:48:53' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(t0.document_status_description) from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t1.shipping_agent_code like '%S' and t1.receipt_date = '1973-11-05 21:48:53'"
},
"styl... | {
"index": 1844,
"split": "train"
} | |
List the descriptions and codes of the top 3 transaction types associated with investors whose IDs are between 3 and 14, ordered by the transaction type code in descending (reverse alphabetical) order. | tracking_share_transactions | select t0.transaction_type_description, t0.transaction_type_code as c0 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.investor_id between 3 and 14 order by c0 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select t0.transaction_type_description, t0.transaction_type_code as c0 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.investor_id between 3 and 14 order by c0 desc limi... | {
"index": 2766,
"split": "train"
} | |
Which third-party companies, with maintenance contracts starting between May 4, 2017, and September 19, 2017, have a contract with company ID 11? What are their names and types? | assets_maintenance | select t0.company_name, t0.company_type from third_party_companies as t0 join maintenance_contracts as t1 on t0.company_id = t1.maintenance_contract_company_id where t1.contract_start_date between '2017-05-04 13:39:18' and '2017-09-19 17:57:17' and t1.maintenance_contract_company_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": "assets_maintenance",
"sql": "select t0.company_name, t0.company_type from third_party_companies as t0 join maintenance_contracts as t1 on t0.company_id = t1.maintenance_contract_company_id where t1.contract_start_date between '2017-05-04 13:39:18' and '2017-09-19 17:57:17' and t1... | {
"index": 1655,
"split": "train"
} | |
Can you tell me the total temperature reading for October in each city? | city_record | select city_id as c1, sum(oct) from temperature group by c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "city_record",
"sql": "select city_id as c1, sum(oct) from temperature group by c1"
},
"style": "rule"
} | {
"index": 1837,
"split": "train"
} | |
Which shops have specific location and opening date details, excluding those that stock the device with ID 6? | device | select anon_1.c1, anon_1.c0 from (select location as c1, open_date as c0 from shop except select t0.location as c1, t0.open_date as c0 from shop as t0 join stock as t1 on t0.shop_id = t1.shop_id join device as t2 on t1.device_id = t2.device_id where t2.device_id = 6) 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": "device",
"sql": "select anon_1.c1, anon_1.c0 from (select location as c1, open_date as c0 from shop except select t0.location as c1, t0.open_date as c0 from shop as t0 join stock as t1 on t0.shop_id = t1.shop_id join device as t2 on t1.device_id = t2.device_id where t2.device_id ... | {
"index": 389,
"split": "train"
} | |
Which are the top 3 genres with the highest genre IDs, along with the track names and media type IDs from albums where the artist ID is greater than 150 or the artist ID exists in the artist list? | chinook_1 | select t0.genreid as c4, t0.name, t1.name, t1.mediatypeid from genre as t0 join track as t1 on t0.genreid = t1.genreid join album as t2 on t1.albumid = t2.albumid where t2.artistid > 150 or t2.artistid in (select artist.artistid as c0 from artist) order by c4 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": "chinook_1",
"sql": "select t0.genreid as c4, t0.name, t1.name, t1.mediatypeid from genre as t0 join track as t1 on t0.genreid = t1.genreid join album as t2 on t1.albumid = t2.albumid where t2.artistid > 150 or t2.artistid in (select artist.artistid as c0 from artist) order by c4 ... | {
"index": 1691,
"split": "train"
} | |
Which city IDs and country IDs are included when listing all cities combined with those located in country 32? | sakila_1 | select anon_1.c0, anon_1.c1 from (select city_id as c0, country_id as c1 from city union select t0.city_id as c0, t0.country_id as c1 from city as t0 join country as t1 on t0.country_id = t1.country_id where t1.country_id = 32) 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": "sakila_1",
"sql": "select anon_1.c0, anon_1.c1 from (select city_id as c0, country_id as c1 from city union select t0.city_id as c0, t0.country_id as c1 from city as t0 join country as t1 on t0.country_id = t1.country_id where t1.country_id = 32) as anon_1"
},
"style": "rule"... | {
"index": 1609,
"split": "train"
} | |
What are the descriptions and codes of research outcomes, along with the outcome codes from project outcomes, for projects associated with any organization? These projects should have the detail 'vel'.
---
This version simplifies the language, clarifies the relationships between tables (research outcomes, project out... | tracking_grants_for_research | select t0.outcome_description, t0.outcome_code, t1.outcome_code from research_outcomes as t0 join project_outcomes as t1 on t0.outcome_code = t1.outcome_code join projects as t2 on t1.project_id = t2.project_id where t2.organisation_id in (select organisations.organisation_id as c0 from organisations) and t2.project_de... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select t0.outcome_description, t0.outcome_code, t1.outcome_code from research_outcomes as t0 join project_outcomes as t1 on t0.outcome_code = t1.outcome_code join projects as t2 on t1.project_id = t2.project_id where t2.organisation_id in (s... | {
"index": 2518,
"split": "train"
} | |
What are the Employee ID and salary of the employee with the eid 390487451? | flight_1 | select t0.eid, t0.salary from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 390487451 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.eid, t0.salary from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 390487451"
},
"style": "rule"
} | {
"index": 2606,
"split": "train"
} | |
Is the smallest product ID in order 13 greater than 3? | department_store | select t0.c0 > 3 from (select min(t1.product_id) as c0 from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t0.order_id = 13 group by t0.order_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": "department_store",
"sql": "select t0.c0 > 3 from (select min(t1.product_id) as c0 from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t0.order_id = 13 group by t0.order_id) as t0"
},
"style": "rule"
} | {
"index": 3294,
"split": "train"
} | |
What are the nicknames, the dates they left the staff, their staff IDs, and the number of unique prices associated with lessons having lesson ID 8 for each staff member? | driving_school | select t0.nickname, t0.date_left_staff, t0.staff_id as c1, count(distinct (t1.price)) from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t1.lesson_id = 8 group by c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select t0.nickname, t0.date_left_staff, t0.staff_id as c1, count(distinct (t1.price)) from staff as t0 join lessons as t1 on t0.staff_id = t1.staff_id where t1.lesson_id = 8 group by c1"
},
"style": "rule"
} | {
"index": 1763,
"split": "train"
} | |
Show the host, location, and total attendance for the top 5 performances attended by the member with ID 2, including their member ID, sorted in descending order of member ID. | performance_attendance | select t0.host, t0.location, t0.attendance, t1.member_id as c2 from performance as t0 join member_attendance as t1 on t0.performance_id = t1.performance_id join member as t2 on t1.member_id = t2.member_id where t2.member_id = 2 order by c2 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": "performance_attendance",
"sql": "select t0.host, t0.location, t0.attendance, t1.member_id as c2 from performance as t0 join member_attendance as t1 on t0.performance_id = t1.performance_id join member as t2 on t1.member_id = t2.member_id where t2.member_id = 2 order by c2 desc li... | {
"index": 2859,
"split": "train"
} | |
What is the average low temperature at station 2 on weeks when the wind speed is at least 8 miles per hour? | station_weather | select t0.c2 from (select avg(t1.low_temperature) as c2 from station as t0 join weekly_weather as t1 on t0.id = t1.station_id where t0.id = 2 and t1.wind_speed_mph >= 8 group by t0.id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "station_weather",
"sql": "select t0.c2 from (select avg(t1.low_temperature) as c2 from station as t0 join weekly_weather as t1 on t0.id = t1.station_id where t0.id = 2 and t1.wind_speed_mph >= 8 group by t0.id) as t0"
},
"style": "rule"
} | {
"index": 3994,
"split": "train"
} | |
What is the highest estimated market value and its corresponding type from the film market estimations, when sorted alphabetically by type and limited to the top result? | film_rank | select high_estimate, type as c1 from film_market_estimation order by c1 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "film_rank",
"sql": "select high_estimate, type as c1 from film_market_estimation order by c1 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2605,
"split": "train"
} | |
What are the membership amounts, names, and address roads of branches that have registered members but haven't made any purchases, excluding those with branch IDs starting with "8"? | shop_membership | select anon_1.c2, anon_1.c1, anon_1.c3 from (select t0.membership_amount as c2, t0.name as c1, t0.address_road as c3 from branch as t0 join membership_register_branch as t1 on t0.branch_id = t1.branch_id where (not t1.branch_id in (select branch_id from purchase)) except select t0.membership_amount as c2, t0.name as c1... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "shop_membership",
"sql": "select anon_1.c2, anon_1.c1, anon_1.c3 from (select t0.membership_amount as c2, t0.name as c1, t0.address_road as c3 from branch as t0 join membership_register_branch as t1 on t0.branch_id = t1.branch_id where (not t1.branch_id in (select branch_id from ... | {
"index": 2226,
"split": "train"
} | |
Can you determine the difference between the average product ID values for product 6 and product 4 in the regular orders? | customer_deliveries | select t1.c0 - t0.c0 from (select avg(t1.product_id) as c0 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t0.product_id = 6 group by t0.product_id) as t1, (select t0.product_id, avg(t1.product_id) as c0 from products as t0 join regular_order_products as t1 on t0.product_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": "customer_deliveries",
"sql": "select t1.c0 - t0.c0 from (select avg(t1.product_id) as c0 from products as t0 join regular_order_products as t1 on t0.product_id = t1.product_id where t0.product_id = 6 group by t0.product_id) as t1, (select t0.product_id, avg(t1.product_id) as c0 f... | {
"index": 3595,
"split": "train"
} | |
Which are the top 10 countries, ending with "tes," that have the most artists, ordered by the number of artists who joined from each country? | theme_gallery | select country as c0 from artist where c0 like '%tes' group by c0 order by count(year_join) 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 country as c0 from artist where c0 like '%tes' group by c0 order by count(year_join) desc limit 10"
},
"style": "rule"
} | {
"index": 910,
"split": "train"
} | |
For employees whose job code ends with 'RK', how many days elapsed between their hire date and their date of birth? | college_1 | select julianday(t1.c2) - julianday(t0.c0) from (select emp_hiredate as c2 from employee where emp_jobcode like '%RK' and emp_jobcode like '%RK') as t1, (select emp_dob as c0 from employee) 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": "college_1",
"sql": "select julianday(t1.c2) - julianday(t0.c0) from (select emp_hiredate as c2 from employee where emp_jobcode like '%RK' and emp_jobcode like '%RK') as t1, (select emp_dob as c0 from employee) as t0"
},
"style": "rule"
} | {
"index": 3675,
"split": "train"
} | |
For each paper title, what are the first five titles (with paper IDs 201 or 202) that have the most unique titles, listed in alphabetical order? | icfp_1 | select title as c0, count(distinct (title)) from papers where paperid = 202 or paperid = 201 group by c0 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": "icfp_1",
"sql": "select title as c0, count(distinct (title)) from papers where paperid = 202 or paperid = 201 group by c0 order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 1318,
"split": "train"
} | |
Which budget types and their descriptions are associated with expenses labeled as 'SF', but do not include the document with ID 240? | cre_Docs_and_Epenses | select anon_1.c0, anon_1.c1 from (select t0.budget_type_description as c0, t0.budget_type_code as c1 from ref_budget_codes as t0 join documents_with_expenses as t1 on t0.budget_type_code = t1.budget_type_code where t1.budget_type_code = 'SF' except select t0.budget_type_description as c0, t0.budget_type_code as c1 from... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Docs_and_Epenses",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.budget_type_description as c0, t0.budget_type_code as c1 from ref_budget_codes as t0 join documents_with_expenses as t1 on t0.budget_type_code = t1.budget_type_code where t1.budget_type_code = 'SF' except ... | {
"index": 229,
"split": "train"
} | |
When did the log entries occur for the activity assigned to the staff member with the highest staff ID on or after June 21, 1993? | tracking_software_problems | select t0.log_entry_date, t0.assigned_to_staff_id as c1 from problem_log as t0, (select max(assigned_to_staff_id) as c2 from problem_log where log_entry_date >= '1993-06-21 22:33:35') as t1 where c1 = t1.c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t0.log_entry_date, t0.assigned_to_staff_id as c1 from problem_log as t0, (select max(assigned_to_staff_id) as c2 from problem_log where log_entry_date >= '1993-06-21 22:33:35') as t1 where c1 = t1.c2"
},
"style": "rule"
} | {
"index": 3804,
"split": "train"
} | |
How many customers have cell mobile phone numbers, and how many unique first names are there among customers living in cities whose names start with "La"? | driving_school | select count(t0.cell_mobile_phone_number), count(distinct (t0.first_name)) from customers as t0 join addresses as t1 on t0.customer_address_id = t1.address_id where t1.city like 'La%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(t0.cell_mobile_phone_number), count(distinct (t0.first_name)) from customers as t0 join addresses as t1 on t0.customer_address_id = t1.address_id where t1.city like 'La%'"
},
"style": "rule"
} | {
"index": 1831,
"split": "train"
} | |
What is the percentage change in the average customer ID for customer 114 who filed complaints related to "Product Unusa" between July 11, 1987, and August 6, 1977? | customer_complaints | select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select avg(t1.customer_id) as c2 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 114 and t1.date_complaint_raised = '1977-08-06 00:31:19' and t1.complaint_type_code like '%Product Unusa%' group by t0.customer_id) a... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select (t0.c2 / cast(t1.c2 as real) - 1) * 100 from (select avg(t1.customer_id) as c2 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 114 and t1.date_complaint_raised = '1977-08-06 00:31:19' and t1... | {
"index": 3414,
"split": "train"
} | |
Which student(s) with last names starting with "Sm" have the highest GPA, and what is their date of birth? | college_1 | select t0.stu_dob, t0.stu_gpa as c1 from student as t0, (select max(stu_gpa) as c0 from student where stu_lname like 'Sm%') as t1 where c1 = t1.c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_1",
"sql": "select t0.stu_dob, t0.stu_gpa as c1 from student as t0, (select max(stu_gpa) as c0 from student where stu_lname like 'Sm%') as t1 where c1 = t1.c0"
},
"style": "rule"
} | {
"index": 3812,
"split": "train"
} | |
Which students, along with their city codes and dorm IDs, live in dorms that have amenities with amenity IDs greater than 904 or less than 932? | dorm_1 | select t0.city_code, t0.lname, t1.dormid, t1.stuid from student as t0 join lives_in as t1 on t0.stuid = t1.stuid join dorm as t2 on t1.dormid = t2.dormid join has_amenity as t3 on t2.dormid = t3.dormid where t3.amenid > 904 or t3.amenid < 932 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.city_code, t0.lname, t1.dormid, t1.stuid from student as t0 join lives_in as t1 on t0.stuid = t1.stuid join dorm as t2 on t1.dormid = t2.dormid join has_amenity as t3 on t2.dormid = t3.dormid where t3.amenid > 904 or t3.amenid < 932"
},
"style": "ru... | {
"index": 942,
"split": "train"
} | |
What are the last name and middle name of the individual, their ID, the organization they contacted, and the date of contact for the contact record associated with organizations that have either the least common or the most common UK VAT number, ordered by the individual's last name in reverse alphabetical order, consi... | e_government | select t0.individual_last_name as c1, t0.individual_middle_name, t0.individual_id, t1.organization_id, t1.date_contact_to from individuals as t0 join organization_contact_individuals as t1 on t0.individual_id = t1.individual_id join organizations as t2 on t1.organization_id = t2.organization_id, (select uk_vat_number a... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_government",
"sql": "select t0.individual_last_name as c1, t0.individual_middle_name, t0.individual_id, t1.organization_id, t1.date_contact_to from individuals as t0 join organization_contact_individuals as t1 on t0.individual_id = t1.individual_id join organizations as t2 on t... | {
"index": 2957,
"split": "train"
} | |
List the names and IDs of all people, including those who have worked in companies related to "king" industries. | company_employee | select anon_1.c1, anon_1.c0 from (select name as c1, people_id as c0 from people union select t0.name as c1, t0.people_id as c0 from people as t0 join employment as t1 on t0.people_id = t1.people_id join company as t2 on t1.company_id = t2.company_id where t2.industry like '%king%') 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": "company_employee",
"sql": "select anon_1.c1, anon_1.c0 from (select name as c1, people_id as c0 from people union select t0.name as c1, t0.people_id as c0 from people as t0 join employment as t1 on t0.people_id = t1.people_id join company as t2 on t1.company_id = t2.company_id wh... | {
"index": 1352,
"split": "train"
} | |
What are the different airline IDs, destination airports, and destination airport IDs for routes starting from airports with longitude less than 89.1738815308? | flight_4 | select distinct t0.alid, t0.dst_ap, t0.dst_apid from routes as t0 join airports as t1 on t0.src_apid = t1.apid where t1.x < 89.1738815308 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_4",
"sql": "select distinct t0.alid, t0.dst_ap, t0.dst_apid from routes as t0 join airports as t1 on t0.src_apid = t1.apid where t1.x < 89.1738815308"
},
"style": "rule"
} | {
"index": 2258,
"split": "train"
} | |
Which date was the order placed by the customer with the highest customer ID among those who have a pending order? | department_store | select t0.order_date, t0.customer_id as c2 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where order_status_code = 'Pending') as t1 where c2 = t1.c3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select t0.order_date, t0.customer_id as c2 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where order_status_code = 'Pending') as t1 where c2 = t1.c3"
},
"style": "rule"
} | {
"index": 3763,
"split": "train"
} | |
Which countries have both roller coasters located in countries with IDs of 3 or higher and roller coasters that have a status indicating they are operational (status containing "p"), and what are their languages, names, and areas? | roller_coaster | select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.languages as c2, t0.name as c0, t0.area as c1 from country as t0 join roller_coaster as t1 on t0.country_id = t1.country_id where t1.country_id >= 3 intersect select t0.languages as c2, t0.name as c0, t0.area as c1 from country as t0 join roller_coaster as t1 on 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": "roller_coaster",
"sql": "select anon_1.c2, anon_1.c0, anon_1.c1 from (select t0.languages as c2, t0.name as c0, t0.area as c1 from country as t0 join roller_coaster as t1 on t0.country_id = t1.country_id where t1.country_id >= 3 intersect select t0.languages as c2, t0.name as c0,... | {
"index": 2508,
"split": "train"
} | |
Which enzymes that have interactions with a type including "to" and also directly interact with enzyme ID 6 have specific OMIM identifiers and products? | medicine_enzyme_interaction | select anon_1.c0, anon_1.c1 from (select t0.omim as c0, t0.product as c1 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.interaction_type like '%to%' intersect select t0.omim as c0, t0.product as c1 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_i... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c1 from (select t0.omim as c0, t0.product as c1 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.interaction_type like '%to%' intersect select t0.omim as c0, t0.product as c1 f... | {
"index": 2914,
"split": "train"
} | |
Identify the login names and author IDs of the three course authors or tutors with the highest maximum author ID, considering only the courses whose names start with "Japanese. | e_learning | select t0.login_name, t0.author_id as c1, max(t1.author_id) as c2 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_name like 'Japanese%' group by c1 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": "e_learning",
"sql": "select t0.login_name, t0.author_id as c1, max(t1.author_id) as c2 from course_authors_and_tutors as t0 join courses as t1 on t0.author_id = t1.author_id where t1.course_name like 'Japanese%' group by c1 order by c2 desc limit 3"
},
"style": "rule"
} | {
"index": 302,
"split": "train"
} | |
Did the song "Ami opar hoye" have a release date that is after its own release date? | music_1 | select releasedate > releasedate from song where song_name = 'Ami opar hoye' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 releasedate > releasedate from song where song_name = 'Ami opar hoye'"
},
"style": "rule"
} | {
"index": 3088,
"split": "train"
} | |
Is the transaction date for transaction 14 earlier than the transaction date for transaction 5? | tracking_share_transactions | select t1.c1 < t0.c1 from (select date_of_transaction as c1 from transactions where transaction_id = 14) as t1, (select date_of_transaction as c1 from transactions where transaction_id = 5) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select t1.c1 < t0.c1 from (select date_of_transaction as c1 from transactions where transaction_id = 14) as t1, (select date_of_transaction as c1 from transactions where transaction_id = 5) as t0"
},
"style": "rule"
} | {
"index": 3153,
"split": "train"
} | |
Is the date of birth of customer 9 earlier than that of customer 11? | driving_school | select t1.c0 < t0.c0 from (select date_of_birth as c0 from customers where customer_id = 9) as t1, (select date_of_birth as c0 from customers where customer_id = 11) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select t1.c0 < t0.c0 from (select date_of_birth as c0 from customers where customer_id = 9) as t1, (select date_of_birth as c0 from customers where customer_id = 11) as t0"
},
"style": "rule"
} | {
"index": 3131,
"split": "train"
} | |
Find the local authority and network name of stations where the weekly precipitation is exactly 60.0. | station_weather | select t0.local_authority, t0.network_name from station as t0 join weekly_weather as t1 on t0.id = t1.station_id where t1.precipitation = 60.0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "station_weather",
"sql": "select t0.local_authority, t0.network_name from station as t0 join weekly_weather as t1 on t0.id = t1.station_id where t1.precipitation = 60.0"
},
"style": "rule"
} | {
"index": 1070,
"split": "train"
} | |
How many savings accounts does customer 5 have? | small_bank_1 | select count(*) from savings where custid = 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 count(*) from savings where custid = 5"
},
"style": "rule"
} | {
"index": 2570,
"split": "train"
} | |
What is the percentage change in the total of the highest order IDs for all customer orders with IDs over 6 between March 1, 2018, at 1:44 AM and March 5, 2018, at 8:47 AM? | customers_and_invoices | select (sum(t0.c1) / cast(sum(t1.c1) as real) - 1) * 100 from (select max(t1.order_id) as c1 from orders as t0 join invoices as t1 on t0.order_id = t1.order_id where t1.invoice_date = '2018-03-05 08:47:33' and t0.customer_id > 6 group by t0.order_id) as t0, (select t0.order_id, max(t1.order_id) as c1 from orders as t0 ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select (sum(t0.c1) / cast(sum(t1.c1) as real) - 1) * 100 from (select max(t1.order_id) as c1 from orders as t0 join invoices as t1 on t0.order_id = t1.order_id where t1.invoice_date = '2018-03-05 08:47:33' and t0.customer_id > 6 group by t0.order_... | {
"index": 3024,
"split": "train"
} | |
How does the total sum of staff IDs associated with product 117 on February 10, 1973, compare to the total on July 18, 2002? | customer_complaints | select t1.c2 - t0.c2 from (select sum(t1.staff_id) as c2 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 117 and t1.date_complaint_raised = '1973-02-10 22:55:56' group by t0.product_id) as t1, (select t0.product_id, sum(t1.staff_id) as c2 from products as t0 join complai... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select t1.c2 - t0.c2 from (select sum(t1.staff_id) as c2 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 117 and t1.date_complaint_raised = '1973-02-10 22:55:56' group by t0.product_id) as t1, (select ... | {
"index": 3516,
"split": "train"
} | |
For the companies with offices located in building 6 or building 8, what are their profits in billions, assets in billions, and their headquarters locations? | company_office | select t0.profits_billion, t0.assets_billion, t0.headquarters from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.building_id = 6 or t1.building_id = 8 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "company_office",
"sql": "select t0.profits_billion, t0.assets_billion, t0.headquarters from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.building_id = 6 or t1.building_id = 8"
},
"style": "rule"
} | {
"index": 2119,
"split": "train"
} | |
Which zip codes have recorded trip data, weather data, or both? | bike_1 | select anon_1.c0 from (select zip_code as c0 from trip union select zip_code from weather) 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": "bike_1",
"sql": "select anon_1.c0 from (select zip_code as c0 from trip union select zip_code from weather) as anon_1"
},
"style": "rule"
} | {
"index": 2680,
"split": "train"
} | |
What are the user IDs and names of users, along with the reviewer user IDs and item IDs for reviews of items whose titles end with "lue hoodie" or "ampoo"? | epinions_1 | select t0.u_id, t0.name, t1.u_id, t1.i_id from useracct as t0 join review as t1 on t0.u_id = t1.u_id join item as t2 on t1.i_id = t2.i_id where t2.title like '%lue hoodie' or t2.title like '%ampoo' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select t0.u_id, t0.name, t1.u_id, t1.i_id from useracct as t0 join review as t1 on t0.u_id = t1.u_id join item as t2 on t1.i_id = t2.i_id where t2.title like '%lue hoodie' or t2.title like '%ampoo'"
},
"style": "rule"
} | {
"index": 2574,
"split": "train"
} | |
Can you identify the Policy IDs and customer phone numbers for policies that were opened on or after July 7, 2016, or within the period from April 11, 2016, to July 22, 2016? | insurance_fnol | select t0.policy_id, t0.customer_phone from available_policies as t0 join customers_policies as t1 on t0.policy_id = t1.policy_id where t1.date_opened >= '2016-07-07 00:00:00' or t1.date_opened between '2016-04-11 00:00:00' and '2016-07-22 00:00:00' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_fnol",
"sql": "select t0.policy_id, t0.customer_phone from available_policies as t0 join customers_policies as t1 on t0.policy_id = t1.policy_id where t1.date_opened >= '2016-07-07 00:00:00' or t1.date_opened between '2016-04-11 00:00:00' and '2016-07-22 00:00:00'"
},... | {
"index": 956,
"split": "train"
} | |
Can you identify the five customers, including their country, address ID, and name, who have ordered products with ID 2 or less than or equal to 3, listed in reverse alphabetical order by their names? | customers_and_addresses | select t0.country, t0.address_id, t2.customer_name as c1 from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id join customers as t2 on t1.customer_id = t2.customer_id join customer_orders as t3 on t2.customer_id = t3.customer_id join order_items as t4 on t3.order_id = t4.order_id where t4.... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.country, t0.address_id, t2.customer_name as c1 from addresses as t0 join customer_addresses as t1 on t0.address_id = t1.address_id join customers as t2 on t1.customer_id = t2.customer_id join customer_orders as t3 on t2.customer_id = t3... | {
"index": 1989,
"split": "train"
} | |
What is the Job Title, maximum salary for that role, employee ID, and employee salary for the first employee when listing jobs at departments located in areas with location IDs up to 1800, sorted alphabetically by job title? | hr_1 | select t0.job_title as c3, t0.max_salary, t1.employee_id, t1.salary from jobs as t0 join employees as t1 on t0.job_id = t1.job_id join departments as t2 on t1.department_id = t2.department_id where t2.location_id <= 1800 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": "hr_1",
"sql": "select t0.job_title as c3, t0.max_salary, t1.employee_id, t1.salary from jobs as t0 join employees as t1 on t0.job_id = t1.job_id join departments as t2 on t1.department_id = t2.department_id where t2.location_id <= 1800 order by c3 asc nulls last limit 1"
},
"... | {
"index": 1189,
"split": "train"
} | |
How does person with ID 131 rank when listing all individuals by their total person ID sum in descending order? | student_assessment | select t1.c1, t1.c5 as c4 from (select row_number() over (order by t0.c0 desc) as c1, t0.c3 as c5 from (select t0.person_id as c3, sum(t1.person_id) as c0 from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id group by c3) as t0) as t1 where c4 = 131 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "student_assessment",
"sql": "select t1.c1, t1.c5 as c4 from (select row_number() over (order by t0.c0 desc) as c1, t0.c3 as c5 from (select t0.person_id as c3, sum(t1.person_id) as c0 from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id group by c3) as t0)... | {
"index": 3506,
"split": "train"
} | |
Show the last five member IDs along with their average rank in rounds and the number of unique rounds they participated in, sorted by member ID in descending order. | decoration_competition | select member_id as c0, avg(rank_in_round), count(distinct (member_id)) from round group by c0 order by c0 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "decoration_competition",
"sql": "select member_id as c0, avg(rank_in_round), count(distinct (member_id)) from round group by c0 order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 1948,
"split": "train"
} | |
What are the user ID, partition ID, and name of the user who follows the least common user, and among those, the one with the highest user ID? | twitter_1 | select t0.uid as c1, t0.partitionid, t0.name from user_profiles as t0 join follows as t1 on t0.uid = t1.f2, (select f1 as c3 from follows group by c3 order by count(*) asc nulls last limit 1) as t0 where t1.f1 = t0.c3 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": "twitter_1",
"sql": "select t0.uid as c1, t0.partitionid, t0.name from user_profiles as t0 join follows as t1 on t0.uid = t1.f2, (select f1 as c3 from follows group by c3 order by count(*) asc nulls last limit 1) as t0 where t1.f1 = t0.c3 order by c1 desc limit 1"
},
"style": ... | {
"index": 970,
"split": "train"
} | |
Which students named "Anne%" have the highest GPA, and what are their dates of birth? | college_1 | select t0.stu_dob, t0.stu_gpa as c1 from student as t0, (select max(stu_gpa) as c0 from student where stu_fname like 'Anne%') as t1 where c1 = t1.c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_1",
"sql": "select t0.stu_dob, t0.stu_gpa as c1 from student as t0, (select max(stu_gpa) as c0 from student where stu_fname like 'Anne%') as t1 where c1 = t1.c0"
},
"style": "rule"
} | {
"index": 3748,
"split": "train"
} | |
Who are the individuals with known height and name who both participated in incidents where more than 16 people were injured and are from the country with the highest number of perpetrator incidents? | perpetrator | select anon_1.c0, anon_1.c2 from (select t0.height as c0, t0.name as c2 from people as t0 join perpetrator as t1 on t0.people_id = t1.people_id where t1.injured > 16 intersect select t0.height as c0, t0.name as c2 from people as t0 join perpetrator as t1 on t0.people_id = t1.people_id, (select country as c1 from perpet... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "perpetrator",
"sql": "select anon_1.c0, anon_1.c2 from (select t0.height as c0, t0.name as c2 from people as t0 join perpetrator as t1 on t0.people_id = t1.people_id where t1.injured > 16 intersect select t0.height as c0, t0.name as c2 from people as t0 join perpetrator as t1 on ... | {
"index": 2999,
"split": "train"
} | |
Show the names of colleges and the number of their locations that are in Western Ontario, listed in reverse alphabetical order of the college names. | decoration_competition | select name as c0, count(college_location) from college where college_location = 'Western Ontario' group by c0 order by c0 desc | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "decoration_competition",
"sql": "select name as c0, count(college_location) from college where college_location = 'Western Ontario' group by c0 order by c0 desc"
},
"style": "rule"
} | {
"index": 2153,
"split": "train"
} | |
How much larger is the Part ID used in asset 5 compared to the one used in asset 14? | assets_maintenance | select t1.c2 - t0.c2 from (select part_id as c2 from asset_parts where asset_id = 14) as t1, (select part_id as c2 from asset_parts where asset_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": "assets_maintenance",
"sql": "select t1.c2 - t0.c2 from (select part_id as c2 from asset_parts where asset_id = 14) as t1, (select part_id as c2 from asset_parts where asset_id = 5) as t0"
},
"style": "rule"
} | {
"index": 3583,
"split": "train"
} | |
Who are the last five students listed when you order all students by their first names from Z to A, and what classroom are they in? | student_1 | select lastname, classroom from list order by firstname desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "student_1",
"sql": "select lastname, classroom from list order by firstname desc limit 5"
},
"style": "rule"
} | {
"index": 623,
"split": "train"
} | |
Which students, with enrollments between student IDs 2 and 14, also completed a course on or after March 10, 2018, and what are their login names, middle names, and most recent logon dates? | e_learning | select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.login_name as c0, t0.middle_name as c1, t0.date_of_latest_logon as c2 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.student_id between 2 and 14 intersect select t0.login_name as c0, t0.middle_name as c1, t0.date_o... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.login_name as c0, t0.middle_name as c1, t0.date_of_latest_logon as c2 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.student_id between 2 and 14 intersec... | {
"index": 363,
"split": "train"
} | |
Show the state or province from the locations table, along with the total number of locations and the number of unique cities in each state or province, ordered alphabetically by state or province, and display only the first result. | hr_1 | select state_province as c0, count(*), count(distinct (city)) from locations 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": "hr_1",
"sql": "select state_province as c0, count(*), count(distinct (city)) from locations group by c0 order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2065,
"split": "train"
} | |
How many unique orders are there, what is the highest product ID, and what are the product type code and product ID for each product whose name ends with "gucci"? | customers_and_products_contacts | select count(distinct (t0.order_id)), max(t0.product_id), t1.product_type_code, t1.product_id as c2 from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_name like '%gucci' group by c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_products_contacts",
"sql": "select count(distinct (t0.order_id)), max(t0.product_id), t1.product_type_code, t1.product_id as c2 from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_name like '%gucci' group by c2"
},
"style... | {
"index": 2169,
"split": "train"
} | |
Which are the top 5 customers, sorted alphabetically in reverse, along with their details and IDs, who have placed the most orders with the most common order status, and whose customer IDs are between 9 and 11? | tracking_orders | select t0.customer_details as c1, t0.customer_id as c2, count(t1.customer_id) from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id, (select order_status as c3 from orders group by c3 order by count(*) desc limit 1) as t0 where t1.order_status = t0.c3 and t1.customer_id between 9 and 11 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": "tracking_orders",
"sql": "select t0.customer_details as c1, t0.customer_id as c2, count(t1.customer_id) from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id, (select order_status as c3 from orders group by c3 order by count(*) desc limit 1) as t0 where t1.ord... | {
"index": 218,
"split": "train"
} | |
What is the average representative ID and the number of elections held on each date when the votes received were at least 12,422 or 13,049? | election_representative | select date as c2, avg(representative_id), count(date) from election where votes >= 13049.0 or votes >= 12422.0 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": "election_representative",
"sql": "select date as c2, avg(representative_id), count(date) from election where votes >= 13049.0 or votes >= 12422.0 group by c2"
},
"style": "rule"
} | {
"index": 1935,
"split": "train"
} | |
What are the name, nationality, and ID of the architect with ID 4 who has built three or fewer mills? | architecture | select t0.name, t0.nationality, t0.id as c0 from architect as t0 join mill as t1 on t0.id = t1.architect_id where t1.architect_id between 4 and 4 group by c0 having count(*) <= 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "architecture",
"sql": "select t0.name, t0.nationality, t0.id as c0 from architect as t0 join mill as t1 on t0.id = t1.architect_id where t1.architect_id between 4 and 4 group by c0 having count(*) <= 3"
},
"style": "rule"
} | {
"index": 626,
"split": "train"
} | |
Can you list the connection types, operating systems, and names of all web client accelerators, excluding those that support the browser with id 1? | browser_web | select anon_1.c1, anon_1.c0, anon_1.c2 from (select connection as c1, operating_system as c0, name as c2 from web_client_accelerator except select t0.connection as c1, t0.operating_system as c0, t0.name as c2 from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id join b... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c1, anon_1.c0, anon_1.c2 from (select connection as c1, operating_system as c0, name as c2 from web_client_accelerator except select t0.connection as c1, t0.operating_system as c0, t0.name as c2 from web_client_accelerator as t0 join accelerato... | {
"index": 1984,
"split": "train"
} | |
Who are the top 10 participants (by details in reverse alphabetical order) involved in the least common types of events, and what are their participant details, types, and IDs? | local_govt_in_alabama | select t0.participant_details as c1, t0.participant_type_code, t0.participant_id from participants as t0 join participants_in_events as t1 on t0.participant_id = t1.participant_id join events as t2 on t1.event_id = t2.event_id, (select event_details as c3 from events group by c3 order by count(*) 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": "local_govt_in_alabama",
"sql": "select t0.participant_details as c1, t0.participant_type_code, t0.participant_id from participants as t0 join participants_in_events as t1 on t0.participant_id = t1.participant_id join events as t2 on t1.event_id = t2.event_id, (select event_detail... | {
"index": 2778,
"split": "train"
} | |
What is the address, full name, and building ID of the building that contains the apartment with ID 15, when sorted by the building's full name in reverse alphabetical order, showing only the top result? | apartment_rentals | select t0.building_address, t0.building_full_name as c0 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.apt_id = 15 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": "apartment_rentals",
"sql": "select t0.building_address, t0.building_full_name as c0 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.apt_id = 15 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 63,
"split": "train"
} | |
Can you list the five most recent movies directed by someone with "George" in their name, released before 1982, and show their directors and release years? | movie_1 | select director as c1, year as c0 from movie where c1 like '%George%' and c0 < 1982 order by title 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": "movie_1",
"sql": "select director as c1, year as c0 from movie where c1 like '%George%' and c0 < 1982 order by title desc limit 5"
},
"style": "rule"
} | {
"index": 1966,
"split": "train"
} | |
What is the branch ID and total number of customers for the branch with the lowest branch ID among those that have fewer than 203 customers? | loan_1 | select branch_id as c0, sum(no_of_customers) from bank group by c0 having sum(no_of_customers) < 203 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": "loan_1",
"sql": "select branch_id as c0, sum(no_of_customers) from bank group by c0 having sum(no_of_customers) < 203 order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2742,
"split": "train"
} | |
What are the ten fault descriptions that are least frequently recorded, considering only the fault log entries with the highest number of staff recordings or fault log ID 2? List these descriptions sorted by the fewest unique fault occurrence dates. | assets_maintenance | select t0.fault_description as c1 from fault_log as t0, (select fault_log_entry_id as c0 from fault_log group by c0 order by count(recorded_by_staff_id) desc limit 1) as t0 where t0.fault_log_entry_id = t0.c0 or t0.fault_log_entry_id = 2 group by c1 order by count(distinct (t0.fault_log_entry_datetime)) 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": "assets_maintenance",
"sql": "select t0.fault_description as c1 from fault_log as t0, (select fault_log_entry_id as c0 from fault_log group by c0 order by count(recorded_by_staff_id) desc limit 1) as t0 where t0.fault_log_entry_id = t0.c0 or t0.fault_log_entry_id = 2 group by c1 o... | {
"index": 2346,
"split": "train"
} | |
What are the profits in billions, company IDs, and sales in billions for companies that operate stations located at places ending with 'll', combined with companies that are associated with any station listed in the station-company relationships? | gas_company | select anon_1.c2, anon_1.c1, anon_1.c3 from (select t0.profits_billion as c2, t0.company_id as c1, t0.sales_billion as c3 from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id where t2.location like '%ll' union select t0.profits_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": "gas_company",
"sql": "select anon_1.c2, anon_1.c1, anon_1.c3 from (select t0.profits_billion as c2, t0.company_id as c1, t0.sales_billion as c3 from company as t0 join station_company as t1 on t0.company_id = t1.company_id join gas_station as t2 on t1.station_id = t2.station_id w... | {
"index": 1411,
"split": "train"
} | |
What are the IDs of the top 10 camera lenses with a focal length of less than 42.5mm that have taken at least two mountain photos, sorted by the smallest lens ID in descending order? | mountain_photos | select t0.id as c0 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t0.focal_length_mm < 42.5 group by c0 having count(*) >= 2 order by min(t1.camera_lens_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": "mountain_photos",
"sql": "select t0.id as c0 from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t0.focal_length_mm < 42.5 group by c0 having count(*) >= 2 order by min(t1.camera_lens_id) desc limit 10"
},
"style": "rule"
} | {
"index": 2149,
"split": "train"
} | |
What are the Left Office, Party Name, Party ID, and Region ID for all parties, including those in regions with the most common label? | party_people | select anon_1.c3, anon_1.c4, anon_1.c0, anon_1.c2 from (select left_office as c3, party_name as c4, party_id as c0, region_id as c2 from party union select t0.left_office as c3, t0.party_name as c4, t0.party_id as c0, t0.region_id as c2 from party as t0 join region as t1 on t0.region_id = t1.region_id, (select label 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": "party_people",
"sql": "select anon_1.c3, anon_1.c4, anon_1.c0, anon_1.c2 from (select left_office as c3, party_name as c4, party_id as c0, region_id as c2 from party union select t0.left_office as c3, t0.party_name as c4, t0.party_id as c0, t0.region_id as c2 from party as t0 joi... | {
"index": 1197,
"split": "train"
} | |
What is the difference between the average product ID in order 15 and the average product ID in order 9? | tracking_orders | select t1.c0 - t0.c0 from (select avg(t1.product_id) as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t0.order_id = 15 group by t0.order_id) as t1, (select t0.order_id, avg(t1.product_id) as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t0.order_id = 9 g... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c0 - t0.c0 from (select avg(t1.product_id) as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t0.order_id = 15 group by t0.order_id) as t1, (select t0.order_id, avg(t1.product_id) as c0 from orders as t0 join orde... | {
"index": 3629,
"split": "train"
} | |
Show me the list of names that appear either as race names or track names. | race_track | select anon_1.c1 from (select name as c1 from race union select name from track) as anon_1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "race_track",
"sql": "select anon_1.c1 from (select name as c1 from race union select name from track) as anon_1"
},
"style": "rule"
} | {
"index": 2114,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.