question stringlengths 1 606 | db_id stringclasses 139
values | external_knowledge stringclasses 1
value | sql stringlengths 19 1.35k | data_source stringclasses 1
value | prompt listlengths 2 2 | ability stringclasses 1
value | reward_model dict | extra_info dict |
|---|---|---|---|---|---|---|---|---|
How many branches have a name different from "Popert"? | shop_membership | select count(*) from branch where name != 'Popert' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(*) from branch where name != 'Popert'"
},
"style": "rule"
} | {
"index": 1426,
"split": "train"
} | |
Which students' first names and genders visited restaurants of type 1? Please include the restaurant ID and the student ID for each visit.
---? | restaurant_1 | select t0.fname, t0.sex, t1.resid, t1.stuid from student as t0 join visits_restaurant as t1 on t0.stuid = t1.stuid join restaurant as t2 on t1.resid = t2.resid join type_of_restaurant as t3 on t2.resid = t3.resid where t3.restypeid >= 1 or t3.restypeid between 1 and 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": "restaurant_1",
"sql": "select t0.fname, t0.sex, t1.resid, t1.stuid from student as t0 join visits_restaurant as t1 on t0.stuid = t1.stuid join restaurant as t2 on t1.resid = t2.resid join type_of_restaurant as t3 on t2.resid = t3.resid where t3.restypeid >= 1 or t3.restypeid betw... | {
"index": 350,
"split": "train"
} | |
List the first three players alphabetically by name, showing for each their total height, the number of birthdays recorded, and the highest player API ID. | soccer_1 | select player_name as c2, sum(height), count(birthday), max(player_api_id) from player group by c2 order by c2 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "soccer_1",
"sql": "select player_name as c2, sum(height), count(birthday), max(player_api_id) from player group by c2 order by c2 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 1435,
"split": "train"
} | |
Can you list the UK VAT number, organization name, and organization ID for organizations that had contact with individuals after March 5th, 2018, and also specify the organization ID from the contact records where the contact end date is later than that timestamp? | e_government | select t0.uk_vat_number, t0.organization_name, t0.organization_id, t1.organization_id from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where t1.date_contact_to > '2018-03-05 19:29:24' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.uk_vat_number, t0.organization_name, t0.organization_id, t1.organization_id from organizations as t0 join organization_contact_individuals as t1 on t0.organization_id = t1.organization_id where t1.date_contact_to > '2018-03-05 19:29:24'"
},
"s... | {
"index": 1526,
"split": "train"
} | |
What are the problem IDs for issues reported after May 20, 1970, where the number of unique staff members who authorized the closure is 14 or fewer? Please list these problems sorted by their problem ID. | tracking_software_problems | select count(distinct (closure_authorised_by_staff_id)) from problems where date_problem_reported > '1970-05-20 15:38:46' group by problem_id having count(distinct (closure_authorised_by_staff_id)) <= 14 order by problem_id asc nulls last | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select count(distinct (closure_authorised_by_staff_id)) from problems where date_problem_reported > '1970-05-20 15:38:46' group by problem_id having count(distinct (closure_authorised_by_staff_id)) <= 14 order by problem_id asc nulls last"
}... | {
"index": 1076,
"split": "train"
} | |
Can you tell me the IDs of the genres and the durations in milliseconds for the first 10 tracks named "The Refugee" whose genre IDs are less than or equal to the average genre ID across all tracks, sorted by their duration? | store_1 | select t0.id, t1.milliseconds as c2 from genres as t0 join tracks as t1 on t0.id = t1.genre_id, (select avg(genre_id) as c1 from tracks) as t0 where t1.genre_id <= t0.c1 and t1.name = 'The Refugee' 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": "store_1",
"sql": "select t0.id, t1.milliseconds as c2 from genres as t0 join tracks as t1 on t0.id = t1.genre_id, (select avg(genre_id) as c1 from tracks) as t0 where t1.genre_id <= t0.c1 and t1.name = 'The Refugee' order by c2 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 2915,
"split": "train"
} | |
Which companies have profits, market value, and headquarters located in buildings that are marked as 'old'? | company_office | select t0.profits_billion, t0.market_value_billion, t0.headquarters from companies as t0 join office_locations as t1 on t0.id = t1.company_id join buildings as t2 on t1.building_id = t2.id where t2.status like '%old%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.market_value_billion, t0.headquarters from companies as t0 join office_locations as t1 on t0.id = t1.company_id join buildings as t2 on t1.building_id = t2.id where t2.status like '%old%'"
},
"style": "rule"
} | {
"index": 2174,
"split": "train"
} | |
Which publisher, author or editor, year, and book club are associated with book clubs that also have connections through a culture company and movies, where the movie's release year isn't listed among the years of any book club? | culture_company | select anon_1.c0, anon_1.c2, anon_1.c1, anon_1.c3 from (select publisher as c0, author_or_editor as c2, year as c1, book_club_id as c3 from book_club intersect select t0.publisher as c0, t0.author_or_editor as c2, t0.year as c1, t0.book_club_id as c3 from book_club as t0 join culture_company as t1 on t0.book_club_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": "culture_company",
"sql": "select anon_1.c0, anon_1.c2, anon_1.c1, anon_1.c3 from (select publisher as c0, author_or_editor as c2, year as c1, book_club_id as c3 from book_club intersect select t0.publisher as c0, t0.author_or_editor as c2, t0.year as c1, t0.book_club_id as c3 fro... | {
"index": 1521,
"split": "train"
} | |
Can you show me the valid start dates and card types for accounts whose names begin with "338" and that have the most common "Regular" account details among accounts with that detail? | customers_card_transactions | select t0.date_valid_from, t0.card_type_code 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 c1 from accounts where c1 = 'Regular' group by c1 order by count(*) desc limit 1) as t0 where t2.acc... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.date_valid_from, t0.card_type_code 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 c1 from accounts where... | {
"index": 702,
"split": "train"
} | |
How many days passed between the latest revision date and the publication date for catalogs published by entities including " & Kau"? | product_catalog | select julianday(t1.c0) - julianday(t0.c2) from (select date_of_latest_revision as c0 from catalogs where catalog_publisher like '% & Kau%' and catalog_publisher like '% & Kau%') as t1, (select date_of_publication as c2 from catalogs) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "product_catalog",
"sql": "select julianday(t1.c0) - julianday(t0.c2) from (select date_of_latest_revision as c0 from catalogs where catalog_publisher like '% & Kau%' and catalog_publisher like '% & Kau%') as t1, (select date_of_publication as c2 from catalogs) as t0"
},
"styl... | {
"index": 3731,
"split": "train"
} | |
Is the price range of hotel 123 higher than 245.067720121? | cre_Theme_park | select price_range > 245.067720121 from hotels where hotel_id = 123 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 price_range > 245.067720121 from hotels where hotel_id = 123"
},
"style": "rule"
} | {
"index": 3290,
"split": "train"
} | |
What are the different ages and names of the artists in the database? | theme_gallery | select distinct age, name from artist | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct age, name from artist"
},
"style": "rule"
} | {
"index": 65,
"split": "train"
} | |
Find the name, user ID, and the count of unique trust scores for each user who has a trust level of at least 6 from user ID 2. | epinions_1 | select t0.name, t0.u_id as c1, count(distinct (t1.trust)) from useracct as t0 join trust as t1 on t0.u_id = t1.source_u_id where t1.trust >= 6 and t1.source_u_id = 2 group by c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select t0.name, t0.u_id as c1, count(distinct (t1.trust)) from useracct as t0 join trust as t1 on t0.u_id = t1.source_u_id where t1.trust >= 6 and t1.source_u_id = 2 group by c1"
},
"style": "rule"
} | {
"index": 227,
"split": "train"
} | |
What are the dorm IDs, amenity IDs, and student IDs of students who live in dorms with amenities, specifically for students who share the most common last name? | dorm_1 | select t0.dormid, t0.amenid, t2.stuid from has_amenity as t0 join dorm as t1 on t0.dormid = t1.dormid join lives_in as t2 on t1.dormid = t2.dormid join student as t3 on t2.stuid = t3.stuid, (select lname as c2 from student group by c2 order by count(*) desc limit 1) as t0 where t3.lname = 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": "dorm_1",
"sql": "select t0.dormid, t0.amenid, t2.stuid from has_amenity as t0 join dorm as t1 on t0.dormid = t1.dormid join lives_in as t2 on t1.dormid = t2.dormid join student as t3 on t2.stuid = t3.stuid, (select lname as c2 from student group by c2 order by count(*) desc limit... | {
"index": 264,
"split": "train"
} | |
What are the names and owners of up to 10 programs broadcast on CCTV-13 whose channels have a market share between 2.86% and 4.81%, listed in reverse alphabetical order by program name? | program_share | select t0.name as c0, t0.owner from program as t0 join broadcast as t1 on t0.program_id = t1.program_id join channel as t2 on t1.channel_id = t2.channel_id where t2.share_in_percent between 2.86 and 4.81 and t2.name = 'CCTV-13' 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": "program_share",
"sql": "select t0.name as c0, t0.owner from program as t0 join broadcast as t1 on t0.program_id = t1.program_id join channel as t2 on t1.channel_id = t2.channel_id where t2.share_in_percent between 2.86 and 4.81 and t2.name = 'CCTV-13' order by c0 desc limit 10"
... | {
"index": 355,
"split": "train"
} | |
What is the difference between the highest investor ID involved in 'PUR' transactions on November 28, 2001, and the highest investor ID involved in 'PUR' transactions on September 13, 2002, where the transaction amount was less than or equal to 302,507.70? | tracking_share_transactions | select t1.c1 - t0.c1 from (select max(t1.investor_id) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'PUR' and t1.date_of_transaction = '2001-11-28 15:06:25' group by t0.transaction_type_code) as t1, (select t0.trans... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 max(t1.investor_id) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'PUR' and t1.date_of_transaction = '2... | {
"index": 3926,
"split": "train"
} | |
How many entries are there in the View Product Availability for the product with ID 1? | products_for_hire | select count(*) from view_product_availability where product_id = 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_for_hire",
"sql": "select count(*) from view_product_availability where product_id = 1"
},
"style": "rule"
} | {
"index": 374,
"split": "train"
} | |
How does the number of unique "laur" products in the "Herbs" category compare to the smallest number of products in any category? | products_gen_characteristics | select t2.c0 - t0.c2 from (select min(t1.c2) as c0 from (select count(distinct (t1.product_id)) as c2 from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code group by t0.product_category_code) as t1) as t2, (select t0.product_category_code, count(distinct (t1.product... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_gen_characteristics",
"sql": "select t2.c0 - t0.c2 from (select min(t1.c2) as c0 from (select count(distinct (t1.product_id)) as c2 from ref_product_categories as t0 join products as t1 on t0.product_category_code = t1.product_category_code group by t0.product_category_c... | {
"index": 3199,
"split": "train"
} | |
Which characteristics associated with products have IDs between 3 and 12, and what are their names and additional details? | products_gen_characteristics | select t0.other_characteristic_details, t0.characteristic_name from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.characteristic_id between 3 and 12 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_gen_characteristics",
"sql": "select t0.other_characteristic_details, t0.characteristic_name from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id where t1.characteristic_id between 3 and 12"
},
"style": "rule"
} | {
"index": 510,
"split": "train"
} | |
What is the difference between order ID 9 and 6 based on the highest order ID associated with order 9? | customers_and_products_contacts | select t0.c0 - 6 from (select max(t1.order_id) as c0 from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t0.order_id = 9 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": "customers_and_products_contacts",
"sql": "select t0.c0 - 6 from (select max(t1.order_id) as c0 from customer_orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t0.order_id = 9 group by t0.order_id) as t0"
},
"style": "rule"
} | {
"index": 3226,
"split": "train"
} | |
What are the first five media types, their names and IDs, combined with track titles and album IDs for artists with IDs 221 or 7, ordered alphabetically by media type name? | chinook_1 | select t0.name as c3, t0.mediatypeid, t2.title, t2.albumid from mediatype as t0 join track as t1 on t0.mediatypeid = t1.mediatypeid join album as t2 on t1.albumid = t2.albumid join artist as t3 on t2.artistid = t3.artistid where t3.artistid = 221 or t3.artistid = 7 order by c3 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": "chinook_1",
"sql": "select t0.name as c3, t0.mediatypeid, t2.title, t2.albumid from mediatype as t0 join track as t1 on t0.mediatypeid = t1.mediatypeid join album as t2 on t1.albumid = t2.albumid join artist as t3 on t2.artistid = t3.artistid where t3.artistid = 221 or t3.artisti... | {
"index": 943,
"split": "train"
} | |
On August 6, 1977, at 00:31:19, what is the percentage change in the minimum staff ID assigned to product 118 when converted to a real number? | customer_complaints | select (t0.c2 / cast(t0.c2 as real) - 1) * 100 from (select min(t1.staff_id) as c2 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.date_complaint_raised = '1977-08-06 00:31:19' group by t0.product_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select (t0.c2 / cast(t0.c2 as real) - 1) * 100 from (select min(t1.staff_id) as c2 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 and t1.date_complaint_raised = '1977-08-06 00:31:19' group by t0.p... | {
"index": 3411,
"split": "train"
} | |
Can you tell me the top five aircraft (by their IDs) that either fly distances of 4010 or more miles or have distances not found in any flight? For each of these aircraft, what are the highest aircraft ID and the highest flight price recorded? | flight_1 | select max(t0.aid) as c2, max(t0.price), t1.aid as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.distance >= 4010 or (not t1.distance in (select t0.distance as c3 from flight)) group by c0 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": "flight_1",
"sql": "select max(t0.aid) as c2, max(t0.price), t1.aid as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.distance >= 4010 or (not t1.distance in (select t0.distance as c3 from flight)) group by c0 order by c2 desc limit 5"
},
"style": "rule"
... | {
"index": 2385,
"split": "train"
} | |
What are the maximum aperture and name of camera lenses used in photos with a color ending in "RBG"? | mountain_photos | select t0.max_aperture, t0.name from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t1.color like '%RBG' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.max_aperture, t0.name from camera_lens as t0 join photos as t1 on t0.id = t1.camera_lens_id where t1.color like '%RBG'"
},
"style": "rule"
} | {
"index": 2148,
"split": "train"
} | |
Is the address ID for customer 11 smaller than that for customer 6? | customers_and_addresses | select t1.c2 < t0.c2 from (select address_id as c2 from customer_addresses where customer_id = 6) as t1, (select address_id as c2 from customer_addresses where customer_id = 11) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_addresses",
"sql": "select t1.c2 < t0.c2 from (select address_id as c2 from customer_addresses where customer_id = 6) as t1, (select address_id as c2 from customer_addresses where customer_id = 11) as t0"
},
"style": "rule"
} | {
"index": 3931,
"split": "train"
} | |
What are the IDs of the five departments with the lowest minimal manager IDs, along with their respective minimal manager IDs? | hr_1 | select department_id as c1, min(manager_id) as c0 from departments group by c1 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": "hr_1",
"sql": "select department_id as c1, min(manager_id) as c0 from departments group by c1 order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 1090,
"split": "train"
} | |
Can you tell me the user IDs and names of users who have given reviews rated at 6 or below? | epinions_1 | select t0.u_id, t0.name from useracct as t0 join review as t1 on t0.u_id = t1.u_id where t1.rating = 6 or t1.rating <= 6 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select t0.u_id, t0.name from useracct as t0 join review as t1 on t0.u_id = t1.u_id where t1.rating = 6 or t1.rating <= 6"
},
"style": "rule"
} | {
"index": 2436,
"split": "train"
} | |
How many schools are listed in the database? | school_bus | select count(*) from school | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "school_bus",
"sql": "select count(*) from school"
},
"style": "rule"
} | {
"index": 141,
"split": "train"
} | |
What is the number of unique medicine trade names, the number of unique FDA approval statuses, and the total number of interactions for the most common interaction type in the database? | medicine_enzyme_interaction | select count(distinct (t0.trade_name)), count(distinct (t0.fda_approved)), count(t1.interaction_type) from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id, (select interaction_type as c3 from medicine_enzyme_interaction group by c3 order by count(*) desc limit 1) as t0 where t1.interacti... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(distinct (t0.trade_name)), count(distinct (t0.fda_approved)), count(t1.interaction_type) from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id, (select interaction_type as c3 from medicine_enzyme_in... | {
"index": 1180,
"split": "train"
} | |
How many members are registered in the database? | party_people | select count(*) from member | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(*) from member"
},
"style": "rule"
} | {
"index": 2133,
"split": "train"
} | |
Among fault logs with fault log entry datetimes between February 28, 2018, and March 19, 2018, what is the difference between the highest contact staff ID involved in those logs and the contact staff ID associated with fault log entry ID 3? | assets_maintenance | select t2.c3 - t0.c1 from (select max(t1.c1) as c3 from (select max(t1.contact_staff_id) as c1 from fault_log as t0 join engineer_visits as t1 on t0.fault_log_entry_id = t1.fault_log_entry_id where t0.fault_log_entry_datetime between '2018-02-28 02:07:36' and '2018-03-19 04:24:18' group by t0.fault_log_entry_id) 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": "assets_maintenance",
"sql": "select t2.c3 - t0.c1 from (select max(t1.c1) as c3 from (select max(t1.contact_staff_id) as c1 from fault_log as t0 join engineer_visits as t1 on t0.fault_log_entry_id = t1.fault_log_entry_id where t0.fault_log_entry_datetime between '2018-02-28 02:07... | {
"index": 3158,
"split": "train"
} | |
How many times is the amenity with ID 922 associated with dorms, and what is that amenity ID? | dorm_1 | select count(t0.amenid), t1.amenid as c1 from has_amenity as t0 join dorm_amenity as t1 on t0.amenid = t1.amenid where c1 = 922 group by c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "dorm_1",
"sql": "select count(t0.amenid), t1.amenid as c1 from has_amenity as t0 join dorm_amenity as t1 on t0.amenid = t1.amenid where c1 = 922 group by c1"
},
"style": "rule"
} | {
"index": 2152,
"split": "train"
} | |
What are the last name, mobile phone number, and customer ID of customers who have made more than one payment, including the customer with ID 2, ordered by the number of different payment amounts they made? | driving_school | select t0.last_name, t0.cell_mobile_phone_number, t0.customer_id as c1 from customers as t0 join customer_payments as t1 on t0.customer_id = t1.customer_id where t1.customer_id = 2 group by c1 having count(*) > 1 order by count(distinct (t1.amount_payment)) desc | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select t0.last_name, t0.cell_mobile_phone_number, t0.customer_id as c1 from customers as t0 join customer_payments as t1 on t0.customer_id = t1.customer_id where t1.customer_id = 2 group by c1 having count(*) > 1 order by count(distinct (t1.amount_payment... | {
"index": 1328,
"split": "train"
} | |
What is the description of the document status for document number 20, considering only statuses that aren't labeled as 'mailed late' with a code containing 'ne', and showing the first in alphabetical order? | cre_Doc_Control_Systems | select t0.document_status_description as c0 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where (not t1.document_status_code in (select t0.document_status_code as c1 from ref_document_status where t0.document_status_code like '%ne%' and c0 = 'mailed late')) and... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Control_Systems",
"sql": "select t0.document_status_description as c0 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where (not t1.document_status_code in (select t0.document_status_code as c1 from ref_document_sta... | {
"index": 2923,
"split": "train"
} | |
Who are the first 10 customers with orders that include exactly 2 units of a product, sorted by customer ID? | customers_and_invoices | select t0.customer_id as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.product_quantity = 2 order by c0 asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select t0.customer_id as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.product_quantity = 2 order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 531,
"split": "train"
} | |
Was the value of E for the year 1897 greater than 161? | baseball_1 | select e > 161 from team where year = 1897 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select e > 161 from team where year = 1897"
},
"style": "rule"
} | {
"index": 3287,
"split": "train"
} | |
Which players, including their Pid, name, and high school score, participated in tryouts at the college that hosted the highest number of tryouts? Additionally, what is the Pid of their tryout record? | soccer_2 | select t0.pid, t0.pname, t0.hs, t1.pid from player as t0 join tryout as t1 on t0.pid = t1.pid join college as t2 on t1.cname = t2.cname, (select cname as c2 from college group by c2 order by count(*) asc nulls last limit 1) as t0 where t2.cname = 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": "soccer_2",
"sql": "select t0.pid, t0.pname, t0.hs, t1.pid from player as t0 join tryout as t1 on t0.pid = t1.pid join college as t2 on t1.cname = t2.cname, (select cname as c2 from college group by c2 order by count(*) asc nulls last limit 1) as t0 where t2.cname = t0.c2"
},
... | {
"index": 734,
"split": "train"
} | |
When did the most recent move-in date occur for the customer with the highest customer ID among those with IDs of 31 or higher? | local_govt_and_lot | select t0.date_moved_in, t0.customer_id as c3 from customer_events as t0, (select max(customer_id) as c0 from customer_events where customer_id >= 31) as t1 where c3 = 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": "local_govt_and_lot",
"sql": "select t0.date_moved_in, t0.customer_id as c3 from customer_events as t0, (select max(customer_id) as c0 from customer_events where customer_id >= 31) as t1 where c3 = t1.c0"
},
"style": "rule"
} | {
"index": 3837,
"split": "train"
} | |
How much larger is the number of unique department stores in chain 4 with names starting with "store_na" compared to chain 1? | department_store | select t1.c1 - t0.c1 from (select count(distinct (t1.dept_store_id)) as c1 from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id where t0.dept_store_chain_id = 1 group by t0.dept_store_chain_id) as t1, (select t0.dept_store_chain_id, count(distinct (t1.dept_st... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t1.c1 - t0.c1 from (select count(distinct (t1.dept_store_id)) as c1 from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id where t0.dept_store_chain_id = 1 group by t0.dept_store_chain_id... | {
"index": 3601,
"split": "train"
} | |
How does the document status 'overdue' rank in terms of the number of unique documents received on September 15, 1976, when statuses are ordered from most to least documents? | cre_Doc_Control_Systems | select t1.c3, t1.c4 as c1 from (select row_number() over (order by t0.c5 desc) as c3, t0.c0 as c4 from (select t0.document_status_code as c0, count(distinct (t1.document_id)) as c5 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t1.receipt_date = '1976-09-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": "cre_Doc_Control_Systems",
"sql": "select t1.c3, t1.c4 as c1 from (select row_number() over (order by t0.c5 desc) as c3, t0.c0 as c4 from (select t0.document_status_code as c0, count(distinct (t1.document_id)) as c5 from ref_document_status as t0 join documents as t1 on t0.documen... | {
"index": 3469,
"split": "train"
} | |
What are the first three competition types and their countries, when sorted alphabetically by competition type? | sports_competition | select competition_type as c1, country from competition 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": "sports_competition",
"sql": "select competition_type as c1, country from competition order by c1 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 1822,
"split": "train"
} | |
List the email addresses and phone numbers of parties whose customer IDs are less than 6. | e_government | select t0.party_email, t0.party_phone from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t1.customer_id < 6 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_government",
"sql": "select t0.party_email, t0.party_phone from parties as t0 join party_services as t1 on t0.party_id = t1.customer_id where t1.customer_id < 6"
},
"style": "rule"
} | {
"index": 254,
"split": "train"
} | |
How many more (or fewer) 'PUR' transactions were recorded on December 30, 1997, compared to October 8, 1985? | tracking_share_transactions | select t1.c1 - t0.c1 from (select count(distinct (t1.transaction_id)) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'PUR' and t1.date_of_transaction = '1985-10-08 13:13:39' group by t0.transaction_type_code) 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": "tracking_share_transactions",
"sql": "select t1.c1 - t0.c1 from (select count(distinct (t1.transaction_id)) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'PUR' and t1.date_of_... | {
"index": 3531,
"split": "train"
} | |
Show the names and number of floors of buildings linked to institutions whose ID ends with '4' and whose name includes 'town College'. | protein_institute | select t0.name, t0.floors from building as t0 join institution as t1 on t0.building_id = t1.building_id where t1.institution_id like '%4' and t1.institution like '%town College' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "protein_institute",
"sql": "select t0.name, t0.floors from building as t0 join institution as t1 on t0.building_id = t1.building_id where t1.institution_id like '%4' and t1.institution like '%town College'"
},
"style": "rule"
} | {
"index": 836,
"split": "train"
} | |
What are the length, product stock number, capacity, and catalog ID for catalog entries that belong to catalogs with ID 1 or less? | product_catalog | select t0.length, t0.product_stock_number, t0.capacity, t1.catalog_id as c0 from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where c0 <= 1 or c0 < 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "product_catalog",
"sql": "select t0.length, t0.product_stock_number, t0.capacity, t1.catalog_id as c0 from catalog_contents as t0 join catalog_structure as t1 on t0.catalog_level_number = t1.catalog_level_number where c0 <= 1 or c0 < 1"
},
"style": "rule"
} | {
"index": 1430,
"split": "train"
} | |
Which trains have only a single route, and among them, what is the train number, name, and ID of the train with ID 5? | station_weather | select t0.train_number, t0.name, t0.id as c0 from train as t0 join route as t1 on t0.id = t1.train_id where t1.train_id = 5 group by c0 having count(*) = 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "station_weather",
"sql": "select t0.train_number, t0.name, t0.id as c0 from train as t0 join route as t1 on t0.id = t1.train_id where t1.train_id = 5 group by c0 having count(*) = 1"
},
"style": "rule"
} | {
"index": 2466,
"split": "train"
} | |
What are the first 10 students' first names, sexes, their club IDs, and their roles within the clubs for clubs that have descriptions containing "tit" and are located in places starting with "AK"? List the results sorted alphabetically by the students' first names. | club_1 | select t0.fname as c3, t0.sex, t1.clubid, t1.position from student as t0 join member_of_club as t1 on t0.stuid = t1.stuid join club as t2 on t1.clubid = t2.clubid where t2.clubdesc like '%tit%' and t2.clublocation like 'AK%' order by c3 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": "club_1",
"sql": "select t0.fname as c3, t0.sex, t1.clubid, t1.position from student as t0 join member_of_club as t1 on t0.stuid = t1.stuid join club as t2 on t1.clubid = t2.clubid where t2.clubdesc like '%tit%' and t2.clublocation like 'AK%' order by c3 asc nulls last limit 10"
... | {
"index": 1340,
"split": "train"
} | |
Can you list the IDs and principal activities of companies whose type includes the term "Jo"? | flight_company | select t0.id, t1.principal_activities from flight as t0 join operate_company as t1 on t0.company_id = t1.id where t1.type like '%Jo%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_company",
"sql": "select t0.id, t1.principal_activities from flight as t0 join operate_company as t1 on t0.company_id = t1.id where t1.type like '%Jo%'"
},
"style": "rule"
} | {
"index": 781,
"split": "train"
} | |
What is the average asset ID associated with fault logs recorded by staff members whose names include the letter "n," along with their names and staff IDs? | assets_maintenance | select avg(t0.asset_id), t1.staff_name as c1, t1.staff_id as c0 from fault_log as t0 join staff as t1 on t0.recorded_by_staff_id = t1.staff_id where c1 like '%n%' group by c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "assets_maintenance",
"sql": "select avg(t0.asset_id), t1.staff_name as c1, t1.staff_id as c0 from fault_log as t0 join staff as t1 on t0.recorded_by_staff_id = t1.staff_id where c1 like '%n%' group by c0"
},
"style": "rule"
} | {
"index": 2030,
"split": "train"
} | |
Which are the three airports with the earliest year, including their city and country, along with the source airport name and id from routes, for flights operated by airlines based in countries ending with "aiti" or containing "n Isl"? | flight_4 | select t0.y, t0.city, t0.country, t1.src_ap, t1.src_apid as c2 from airports as t0 join routes as t1 on t0.apid = t1.src_apid join airlines as t2 on t1.alid = t2.alid where t2.country like '%aiti' or t2.country like '%n Isl%' order by c2 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_4",
"sql": "select t0.y, t0.city, t0.country, t1.src_ap, t1.src_apid as c2 from airports as t0 join routes as t1 on t0.apid = t1.src_apid join airlines as t2 on t1.alid = t2.alid where t2.country like '%aiti' or t2.country like '%n Isl%' order by c2 asc nulls last limit 3"... | {
"index": 1063,
"split": "train"
} | |
Which five department store chains have the highest number of their individual store locations, and what are their ids, names, and the count of their unique stores? | department_store | select t0.dept_store_chain_id as c0, t0.dept_store_chain_name, count(distinct (t2.dept_store_id)) as c1 from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id join departments as t2 on t1.dept_store_id = t2.dept_store_id group by c0 order by c1 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select t0.dept_store_chain_id as c0, t0.dept_store_chain_name, count(distinct (t2.dept_store_id)) as c1 from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id join departments as t2 on t1.dept_s... | {
"index": 395,
"split": "train"
} | |
Can you show me the details, IDs, and star ratings of hotels that have a 5-star rating? | cre_Theme_park | select distinct t0.other_hotel_details, t0.hotel_id, t1.star_rating_code as c0 from hotels as t0 join ref_hotel_star_ratings as t1 on t0.star_rating_code = t1.star_rating_code where c0 like '%5%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Theme_park",
"sql": "select distinct t0.other_hotel_details, t0.hotel_id, t1.star_rating_code as c0 from hotels as t0 join ref_hotel_star_ratings as t1 on t0.star_rating_code = t1.star_rating_code where c0 like '%5%'"
},
"style": "rule"
} | {
"index": 2141,
"split": "train"
} | |
Which customers have bought products whose names start with "foo" or are exactly "phone," and what are their details, IDs, and names? | tracking_orders | select t0.customer_details, t0.customer_id, t0.customer_name from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id join products as t3 on t2.product_id = t3.product_id where t3.product_name like 'foo%' or t3.product_name = 'phone' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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, t0.customer_id, t0.customer_name from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id join order_items as t2 on t1.order_id = t2.order_id join products as t3 on t2.product_id = t3.product_id where t3.produ... | {
"index": 2520,
"split": "train"
} | |
Did the transaction with ID 8 happen after the transaction with ID 11? | tracking_share_transactions | select t1.c2 > t0.c2 from (select date_of_transaction as c2 from transactions where transaction_id = 8) as t1, (select date_of_transaction as c2 from transactions where transaction_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": "tracking_share_transactions",
"sql": "select t1.c2 > t0.c2 from (select date_of_transaction as c2 from transactions where transaction_id = 8) as t1, (select date_of_transaction as c2 from transactions where transaction_id = 11) as t0"
},
"style": "rule"
} | {
"index": 3106,
"split": "train"
} | |
Is the smallest product ID linked to product 1 less than 4? | tracking_software_problems | select t0.c2 < 4 from (select min(t1.product_id) as c2 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t0.product_id = 1 group by t0.product_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t0.c2 < 4 from (select min(t1.product_id) as c2 from product as t0 join problems as t1 on t0.product_id = t1.product_id where t0.product_id = 1 group by t0.product_id) as t0"
},
"style": "rule"
} | {
"index": 3351,
"split": "train"
} | |
How many customers have checking accounts, what is the average checking balance for them, and how many of these customers have names that include the segment "nge"? | small_bank_1 | select count(t0.custid), avg(t0.balance), count(t1.custid) from checking as t0 join accounts as t1 on t0.custid = t1.custid where t1.name like '%nge%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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(t0.custid), avg(t0.balance), count(t1.custid) from checking as t0 join accounts as t1 on t0.custid = t1.custid where t1.name like '%nge%'"
},
"style": "rule"
} | {
"index": 644,
"split": "train"
} | |
For each account with an account ID less than the total sum of all account IDs involved in transactions, what is the customer's ID, other account details, account ID, and how many unique cards have transactions on that account? | customers_card_transactions | select t0.customer_id, t0.other_account_details, t0.account_id as c2, count(distinct (t1.card_id)) from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id, (select sum(account_id) as c4 from financial_transactions) as t0 where t1.account_id < t0.c4 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_card_transactions",
"sql": "select t0.customer_id, t0.other_account_details, t0.account_id as c2, count(distinct (t1.card_id)) from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id, (select sum(account_id) as c4 from financial_transactio... | {
"index": 2851,
"split": "train"
} | |
Which lessons have a payment amount less than 9414.74, and what are their Lesson IDs, prices, staff IDs, the email addresses of the customers, and the date when those customers became clients? | driving_school | select t0.lesson_id, t0.price, t0.staff_id, t1.email_address, t1.date_became_customer from lessons as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_payments as t2 on t1.customer_id = t2.customer_id where t2.amount_payment < 9414.74 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.lesson_id, t0.price, t0.staff_id, t1.email_address, t1.date_became_customer from lessons as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_payments as t2 on t1.customer_id = t2.customer_id where t2.amount_payment < 9414... | {
"index": 1933,
"split": "train"
} | |
Does apartment 14's availability status (specifically, whether it has an available unit) fall below the total count of apartments that currently have units available? | apartment_rentals | select t2.c3 < t1.c0 from (select max(t1.available_yn) as c3 from apartments as t0 join view_unit_status as t1 on t0.apt_id = t1.apt_id where t0.apt_id = 14 and t1.available_yn = 1 group by t0.apt_id) as t2, (select sum(t0.c3) as c0 from (select max(t1.available_yn) as c3 from apartments as t0 join view_unit_status 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": "apartment_rentals",
"sql": "select t2.c3 < t1.c0 from (select max(t1.available_yn) as c3 from apartments as t0 join view_unit_status as t1 on t0.apt_id = t1.apt_id where t0.apt_id = 14 and t1.available_yn = 1 group by t0.apt_id) as t2, (select sum(t0.c3) as c0 from (select max(t1... | {
"index": 3306,
"split": "train"
} | |
What is the minimum property ID for customer 16 who moved in on March 27, 2015? | local_govt_and_lot | select t0.c0 - t0.c0 from (select min(t1.property_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_and_lot",
"sql": "select t0.c0 - t0.c0 from (select min(t1.property_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 16 and t1.date_moved_in = '2015-03-27 12:00:00' group by t0.customer_id) as t0"
},
... | {
"index": 3891,
"split": "train"
} | |
What are the graphics modes, hardware colors, and character cell configurations used in display modes for phones with chip models starting with "X51", excluding those made by companies whose names end with "onics Co Ltd"? | phone_1 | select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.graphics_mode as c0, t0.hardware_colours as c1, t0.char_cells as c2 from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode where t1.chip_model like 'X51%' except select t0.graphics_mode as c0, t0.hardware_colours as c1, t0.char_cells as c2 fro... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "phone_1",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.graphics_mode as c0, t0.hardware_colours as c1, t0.char_cells as c2 from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode where t1.chip_model like 'X51%' except select t0.graphics_mode... | {
"index": 2706,
"split": "train"
} | |
What is the item title that appears most frequently in the database? | epinions_1 | select title as c0 from item group by c0 order by count(i_id) desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "epinions_1",
"sql": "select title as c0 from item group by c0 order by count(i_id) desc limit 1"
},
"style": "rule"
} | {
"index": 828,
"split": "train"
} | |
Which master customer IDs are associated with CMI cross references that have a CMI cross reference ID of 99 or less? Please list the master customer ID for each relevant cross reference. | local_govt_mdm | select t0.master_customer_id from cmi_cross_references as t0 join business_rates as t1 on t0.cmi_cross_ref_id = t1.cmi_cross_ref_id where t1.cmi_cross_ref_id <= 99 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_mdm",
"sql": "select t0.master_customer_id from cmi_cross_references as t0 join business_rates as t1 on t0.cmi_cross_ref_id = t1.cmi_cross_ref_id where t1.cmi_cross_ref_id <= 99"
},
"style": "rule"
} | {
"index": 2665,
"split": "train"
} | |
Which room has the highest number of distinct maximum occupancy values, considering only rooms that have at most two different maximum occupancy options? Please provide the room's ID and the count of its unique maximum occupancy values. | inn_1 | select roomid as c1, count(distinct (maxoccupancy)) as c0 from rooms group by c1 having count(distinct (maxoccupancy)) <= 2 order by c0 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "inn_1",
"sql": "select roomid as c1, count(distinct (maxoccupancy)) as c0 from rooms group by c1 having count(distinct (maxoccupancy)) <= 2 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 594,
"split": "train"
} | |
What is the percentage change in the number of unique addresses associated with customers who became customers on January 11, 2012, compared to those who became customers on February 4, 2014? | customer_deliveries | select (count(distinct (t0.c0)) / cast(count(distinct (t1.c0)) as real) - 1) * 100 from (select t0.address_id as c0 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_became_customer = '2012-01-11 21:17:01') as t0, (select t0.address_id as c0, t0.customer_id from custome... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (count(distinct (t0.c0)) / cast(count(distinct (t1.c0)) as real) - 1) * 100 from (select t0.address_id as c0 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_became_customer = '2012-01-11 21:1... | {
"index": 3021,
"split": "train"
} | |
Is the percentage increase in the highest investor ID who made a SALE on April 3, 2000, compared to January 28, 1981, larger than the percentage increase in the number of distinct investors (with IDs from 2 to 8) involved in SALE transactions on those dates? | tracking_share_transactions | select t5.c3 > t2.c0 from (select abs((t3.c1 / cast(t4.c1 as real) - 1) * 100) as c3 from (select max(t1.investor_id) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'SALE' and t1.date_of_transaction = '2000-04-03 20:... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select t5.c3 > t2.c0 from (select abs((t3.c1 / cast(t4.c1 as real) - 1) * 100) as c3 from (select max(t1.investor_id) as c1 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where ... | {
"index": 3825,
"split": "train"
} | |
What is the number of unit statuses, the earliest availability status, and the apartment ID for each apartment of type ending with "plex" that has the most common apartment number in the database? | apartment_rentals | select count(t0.apt_id), min(t0.available_yn), t1.apt_id as c1 from view_unit_status as t0 join apartments as t1 on t0.apt_id = t1.apt_id, (select apt_number as c3 from apartments group by c3 order by count(*) desc limit 1) as t0 where t1.apt_type_code like '%plex' and t1.apt_number = t0.c3 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": "apartment_rentals",
"sql": "select count(t0.apt_id), min(t0.available_yn), t1.apt_id as c1 from view_unit_status as t0 join apartments as t1 on t0.apt_id = t1.apt_id, (select apt_number as c3 from apartments group by c3 order by count(*) desc limit 1) as t0 where t1.apt_type_code... | {
"index": 225,
"split": "train"
} | |
Can you list the top five characteristic details and their data types, along with the product IDs, for characteristics associated with products priced at either exactly 52,735.6101 or having the least common typical selling price? Please order the results alphabetically by the characteristic details. | products_gen_characteristics | select t0.other_characteristic_details as c0, t0.characteristic_data_type, t1.product_id from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id join products as t2 on t1.product_id = t2.product_id, (select typical_selling_price as c2 from products group by c2 order ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_gen_characteristics",
"sql": "select t0.other_characteristic_details as c0, t0.characteristic_data_type, t1.product_id from characteristics as t0 join product_characteristics as t1 on t0.characteristic_id = t1.characteristic_id join products as t2 on t1.product_id = t2.p... | {
"index": 1821,
"split": "train"
} | |
What are the order IDs and customer IDs of the three most recent orders that have a status ending with "g" or are marked as "On Road"? | tracking_orders | select order_id, customer_id from orders where order_status like '%g' or order_status = 'On Road' order by date_order_placed 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 order_id, customer_id from orders where order_status like '%g' or order_status = 'On Road' order by date_order_placed asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 1284,
"split": "train"
} | |
Is the total sum of customer ID for customer 118’s complaints with a status starting with "O" less than the highest total sum of customer IDs across all customers' complaints? | customer_complaints | select t2.c0 < t1.c2 from (select sum(t1.customer_id) as c0 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 118 and t1.complaint_status_code like 'O%' group by t0.customer_id) as t2, (select max(t0.c0) as c2 from (select sum(t1.customer_id) as c0 from customers as t0... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select t2.c0 < t1.c2 from (select sum(t1.customer_id) as c0 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t0.customer_id = 118 and t1.complaint_status_code like 'O%' group by t0.customer_id) as t2, (select max(t0... | {
"index": 3311,
"split": "train"
} | |
What are the claim amounts, claim header IDs, and paid amounts for claims that have associated documents created on or after day 6 but before day 9? | insurance_and_eClaims | select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.amount_claimed as c0, t0.claim_header_id as c1, t0.amount_piad as c2 from claim_headers as t0 join claims_documents as t1 on t0.claim_header_id = t1.claim_id where t1.created_date >= 6 except select t0.amount_claimed as c0, t0.claim_header_id as c1, t0.amount_piad ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_and_eClaims",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.amount_claimed as c0, t0.claim_header_id as c1, t0.amount_piad as c2 from claim_headers as t0 join claims_documents as t1 on t0.claim_header_id = t1.claim_id where t1.created_date >= 6 except s... | {
"index": 2426,
"split": "train"
} | |
For each airport, what are its IATA code, country, and ID, along with how many of its flights have an altitude greater than or equal to the total number of unique altitudes observed in all flights? | flight_company | select t0.iata, t0.country, t0.id as c3, count(t1.airport_id) from airport as t0 join flight as t1 on t0.id = t1.airport_id, (select count(distinct (altitude)) as c1 from flight) as t0 where t1.altitude >= t0.c1 group by c3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_company",
"sql": "select t0.iata, t0.country, t0.id as c3, count(t1.airport_id) from airport as t0 join flight as t1 on t0.id = t1.airport_id, (select count(distinct (altitude)) as c1 from flight) as t0 where t1.altitude >= t0.c1 group by c3"
},
"style": "rule"
} | {
"index": 1247,
"split": "train"
} | |
Which cinema showing films in May with ticket prices between $9.99 and $15.99 has the highest cinema ID, and how many different films are they showing on that schedule? | cinema | select cinema_id as c0, count(distinct (film_id)) from schedule where date like '%May' and price between 9.99 and 15.99 group by c0 order by c0 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cinema",
"sql": "select cinema_id as c0, count(distinct (film_id)) from schedule where date like '%May' and price between 9.99 and 15.99 group by c0 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 70,
"split": "train"
} | |
Can you list the status and building ID for the top five office locations linked to buildings that are either not registered in the main building list or are building number 9? Please sort these results in descending order of building ID. | company_office | select t0.status, t1.building_id as c0 from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where (not c0 in (select t0.id as c1 from buildings)) or c0 = 9 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": "company_office",
"sql": "select t0.status, t1.building_id as c0 from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where (not c0 in (select t0.id as c1 from buildings)) or c0 = 9 order by c0 desc limit 5"
},
"style": "rule"
} | {
"index": 687,
"split": "train"
} | |
How many days passed between the start and end dates of the address history for addresses with IDs between 10 and 13? | customers_and_products_contacts | select julianday(t1.c2) - julianday(t0.c0) from (select date_to as c2 from customer_address_history) as t1, (select date_from as c0 from customer_address_history where address_id between 10 and 13 and address_id between 10 and 13) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_products_contacts",
"sql": "select julianday(t1.c2) - julianday(t0.c0) from (select date_to as c2 from customer_address_history) as t1, (select date_from as c0 from customer_address_history where address_id between 10 and 13 and address_id between 10 and 13) as t0"
... | {
"index": 3694,
"split": "train"
} | |
Is the smallest address ID associated with address 82 greater than the total number of unique minimum address IDs for addresses in cities that start with "Stephaniemou"? | student_assessment | select t2.c2 > t1.c0 from (select min(t1.address_id) as c2 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where t0.address_id = 82 group by t0.address_id) as t2, (select count(t0.c2) as c0 from (select min(t1.address_id) as c2 from addresses as t0 join people_addresses as t1 on t0.add... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c2 > t1.c0 from (select min(t1.address_id) as c2 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id where t0.address_id = 82 group by t0.address_id) as t2, (select count(t0.c2) as c0 from (select min(t1.address... | {
"index": 3284,
"split": "train"
} | |
Was the song "My love" released before "Ami opar hoye"? | music_1 | select t1.c2 < t0.c2 from (select releasedate as c2 from song where song_name = 'My love') as t1, (select releasedate as c2 from song where song_name = 'Ami opar hoye') as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "music_1",
"sql": "select t1.c2 < t0.c2 from (select releasedate as c2 from song where song_name = 'My love') as t1, (select releasedate as c2 from song where song_name = 'Ami opar hoye') as t0"
},
"style": "rule"
} | {
"index": 3904,
"split": "train"
} | |
What are the different categories and the corresponding book club IDs for book clubs associated with movies that have IDs ending in "4"? | culture_company | select distinct t0.category, t1.book_club_id from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where t1.movie_id like '%4' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "culture_company",
"sql": "select distinct t0.category, t1.book_club_id from book_club as t0 join culture_company as t1 on t0.book_club_id = t1.book_club_id where t1.movie_id like '%4'"
},
"style": "rule"
} | {
"index": 1270,
"split": "train"
} | |
What are the account details, account opening dates, and account IDs for accounts involved in transaction number 4? | customers_and_invoices | select t0.other_account_details, t0.date_account_opened from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_id = 4 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select t0.other_account_details, t0.date_account_opened from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_id = 4"
},
"style": "rule"
} | {
"index": 2838,
"split": "train"
} | |
For the batch of documents with the most shipping agent entries, how many total shipping agent codes are there, and how many unique receipt dates do those documents have? | cre_Doc_Control_Systems | select count(shipping_agent_code) as c0, count(distinct (receipt_date)) from documents 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": "cre_Doc_Control_Systems",
"sql": "select count(shipping_agent_code) as c0, count(distinct (receipt_date)) from documents order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 1217,
"split": "train"
} | |
For each account opened after July 30, 2016, at 10:22 PM, and whose details include "VIP," what are the account IDs and the average of their associated customer IDs? | customers_and_invoices | select account_id as c0, avg(customer_id) from accounts where date_account_opened > '2016-07-30 22:22:24' and other_account_details like '%VIP' group by c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select account_id as c0, avg(customer_id) from accounts where date_account_opened > '2016-07-30 22:22:24' and other_account_details like '%VIP' group by c0"
},
"style": "rule"
} | {
"index": 327,
"split": "train"
} | |
What are the job IDs and the highest salaries for employees whose phone numbers contain the digit "8", grouped by each job ID? | hr_1 | select job_id as c0, max(salary) from employees where phone_number like '%8%' group by c0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "hr_1",
"sql": "select job_id as c0, max(salary) from employees where phone_number like '%8%' group by c0"
},
"style": "rule"
} | {
"index": 728,
"split": "train"
} | |
What are the three lowest prices in euros for products that have an attribute ID of 4 or less? | product_catalog | select t0.price_in_euros as c0 from catalog_contents as t0 join catalog_contents_additional_attributes as t1 on t0.catalog_entry_id = t1.catalog_entry_id where t1.attribute_id <= 4 or t1.attribute_id <= 2 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": "product_catalog",
"sql": "select t0.price_in_euros as c0 from catalog_contents as t0 join catalog_contents_additional_attributes as t1 on t0.catalog_entry_id = t1.catalog_entry_id where t1.attribute_id <= 4 or t1.attribute_id <= 2 order by c0 asc nulls last limit 3"
},
"style... | {
"index": 134,
"split": "train"
} | |
Which are the first three research outcome descriptions associated with project ID 7, where the outcome codes start with "P"? List them in alphabetical order, placing any with null descriptions at the end. | tracking_grants_for_research | select t0.outcome_description as c0 from research_outcomes as t0 join project_outcomes as t1 on t0.outcome_code = t1.outcome_code where t1.outcome_code like 'P%' and t1.project_id = 7 order by c0 asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select t0.outcome_description as c0 from research_outcomes as t0 join project_outcomes as t1 on t0.outcome_code = t1.outcome_code where t1.outcome_code like 'P%' and t1.project_id = 7 order by c0 asc nulls last limit 3"
},
"style": "rule... | {
"index": 1082,
"split": "train"
} | |
Can you list the last names and first names of all individuals who are either students or faculty members? | activity_1 | select anon_1.c2, anon_1.c1 from (select lname as c2, fname as c1 from student union select lname, fname from faculty) 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": "activity_1",
"sql": "select anon_1.c2, anon_1.c1 from (select lname as c2, fname as c1 from student union select lname, fname from faculty) as anon_1"
},
"style": "rule"
} | {
"index": 1393,
"split": "train"
} | |
Which functional areas, with at least five related documents, belong to the least common functional area code associated with document 217 or documents whose codes include the digit "8"? For each of these functional areas, what is their description and code? | document_management | select t0.functional_area_description, t0.functional_area_code as c1 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code, (select functional_area_code as c2 from document_functional_areas where document_code = 217 or document_code like '%8%' 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": "document_management",
"sql": "select t0.functional_area_description, t0.functional_area_code as c1 from functional_areas as t0 join document_functional_areas as t1 on t0.functional_area_code = t1.functional_area_code, (select functional_area_code as c2 from document_functional_ar... | {
"index": 2844,
"split": "train"
} | |
What are the flight numbers of the ten flights with prices below 202.45, listed from the lowest to higher prices? | flight_1 | select flno from flight where price < 202.45 order by price 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": "flight_1",
"sql": "select flno from flight where price < 202.45 order by price asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 1562,
"split": "train"
} | |
Which project names and codes are not associated with the scientist whose SSN is 123234877? | scientist_1 | select anon_1.c1, anon_1.c0 from (select name as c1, code as c0 from projects except select t0.name as c1, t0.code as c0 from projects as t0 join assignedto as t1 on t0.code = t1.project join scientists as t2 on t1.scientist = t2.ssn where t2.ssn = 123234877) 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": "scientist_1",
"sql": "select anon_1.c1, anon_1.c0 from (select name as c1, code as c0 from projects except select t0.name as c1, t0.code as c0 from projects as t0 join assignedto as t1 on t0.code = t1.project join scientists as t2 on t1.scientist = t2.ssn where t2.ssn = 123234877... | {
"index": 465,
"split": "train"
} | |
Which are the 5 tracks with the fewest number of invoices they appear in, along with the average of their track IDs and their track IDs themselves, for tracks belonging to albums with IDs between 155 and 191? | store_1 | select count(distinct (t0.invoice_id)) as c2, avg(t0.track_id), t1.id as c0 from invoice_lines as t0 join tracks as t1 on t0.track_id = t1.id where t1.album_id between 155 and 191 group by c0 order by c2 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select count(distinct (t0.invoice_id)) as c2, avg(t0.track_id), t1.id as c0 from invoice_lines as t0 join tracks as t1 on t0.track_id = t1.id where t1.album_id between 155 and 191 group by c0 order by c2 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 980,
"split": "train"
} | |
What are the catalog level numbers of catalog categories that have contents with capacities starting with "5," listed in reverse alphabetical order by their catalog level names? | product_catalog | select t0.catalog_level_number from catalog_structure as t0 join catalog_contents as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.capacity like '5%' order by t0.catalog_level_name 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": "product_catalog",
"sql": "select t0.catalog_level_number from catalog_structure as t0 join catalog_contents as t1 on t0.catalog_level_number = t1.catalog_level_number where t1.capacity like '5%' order by t0.catalog_level_name desc"
},
"style": "rule"
} | {
"index": 2100,
"split": "train"
} | |
Is the average monthly rental for address 8, considering only rentals of at least 1007.2597, higher than the overall average monthly rental for address 8? | behavior_monitoring | select t1.c1 > t0.c1 from (select avg(t1.monthly_rental) as c1 from addresses as t0 join student_addresses as t1 on t0.address_id = t1.address_id where t0.address_id = 8 and t1.monthly_rental >= 1007.2597 group by t0.address_id) as t1, (select t0.address_id, avg(t1.monthly_rental) as c1 from addresses as t0 join studen... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "behavior_monitoring",
"sql": "select t1.c1 > t0.c1 from (select avg(t1.monthly_rental) as c1 from addresses as t0 join student_addresses as t1 on t0.address_id = t1.address_id where t0.address_id = 8 and t1.monthly_rental >= 1007.2597 group by t0.address_id) as t1, (select t0.add... | {
"index": 3537,
"split": "train"
} | |
How many days passed between the latest revision date and the publication date of the catalogs renewed after October 26, 2017? | product_catalog | select julianday(t1.c0) - julianday(t0.c2) from (select date_of_latest_revision as c0 from catalogs) as t1, (select date_of_publication as c2 from catalogs where date_of_latest_revision >= '2017-10-26 01:16:51' and date_of_latest_revision >= '2017-10-26 01:16:51') as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "product_catalog",
"sql": "select julianday(t1.c0) - julianday(t0.c2) from (select date_of_latest_revision as c0 from catalogs) as t1, (select date_of_publication as c2 from catalogs where date_of_latest_revision >= '2017-10-26 01:16:51' and date_of_latest_revision >= '2017-10-26 ... | {
"index": 3844,
"split": "train"
} | |
Who are the three people living in a city ending with " lake city" who have the most recent friendship connections? | network_2 | select t0.name as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.city like '% lake city' group by c0 order by max(t1.year) asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "network_2",
"sql": "select t0.name as c0 from person as t0 join personfriend as t1 on t0.name = t1.friend where t0.city like '% lake city' group by c0 order by max(t1.year) asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 1595,
"split": "train"
} | |
What are the smallest and largest attendance figures for events whose names end with "ibition"? | news_report | select min(event_attendance), max(event_attendance) from event where name like '%ibition' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "news_report",
"sql": "select min(event_attendance), max(event_attendance) from event where name like '%ibition'"
},
"style": "rule"
} | {
"index": 3646,
"split": "train"
} | |
What is the percentage change in the average investor ID involved in 'SALE' transactions with amounts under 302,507.6996 between April 27, 1979, and April 7, 2002? | tracking_share_transactions | select (t0.c0 / cast(t1.c0 as real) - 1) * 100 from (select avg(t1.investor_id) as c0 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'SALE' and t1.date_of_transaction = '2002-04-07 20:28:37' and t1.amount_of_transaction < ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c0 / cast(t1.c0 as real) - 1) * 100 from (select avg(t1.investor_id) as c0 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'SALE' and ... | {
"index": 3429,
"split": "train"
} | |
What are the product names and pages-per-minute color capabilities for all products, including those available at stores whose names start with "Rogersvi"? | store_product | select anon_1.c1, anon_1.c0 from (select product as c1, pages_per_minute_color as c0 from product union select t0.product as c1, t0.pages_per_minute_color as c0 from product as t0 join store_product as t1 on t0.product_id = t1.product_id join store as t2 on t1.store_id = t2.store_id where t2.store_name like 'Rogersvi%'... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_product",
"sql": "select anon_1.c1, anon_1.c0 from (select product as c1, pages_per_minute_color as c0 from product union select t0.product as c1, t0.pages_per_minute_color as c0 from product as t0 join store_product as t1 on t0.product_id = t1.product_id join store as t2 o... | {
"index": 1893,
"split": "train"
} | |
Is the highest guest ID associated with guest number 15 greater than 13? | apartment_rentals | select t0.c2 > 13 from (select max(t1.guest_id) as c2 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where t0.guest_id = 15 group by t0.guest_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": "apartment_rentals",
"sql": "select t0.c2 > 13 from (select max(t1.guest_id) as c2 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where t0.guest_id = 15 group by t0.guest_id) as t0"
},
"style": "rule"
} | {
"index": 3968,
"split": "train"
} | |
How much has the average Address ID for customers who first became customers in 2011 changed compared to those who first became customers in 2017? | customer_deliveries | select (avg(t0.c1) / cast(avg(t1.c1) as real) - 1) * 100 from (select t0.address_id as c1 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_became_customer = '2017-05-21 07:09:55') as t0, (select t0.address_id as c1, t0.customer_id from customer_addresses as t0 join cus... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_deliveries",
"sql": "select (avg(t0.c1) / cast(avg(t1.c1) as real) - 1) * 100 from (select t0.address_id as c1 from customer_addresses as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.date_became_customer = '2017-05-21 07:09:55') as t0, (select t0.a... | {
"index": 3020,
"split": "train"
} | |
What are the hometowns and names of members, along with their total pounds purchased and the purchase year, for members who made purchases at branches that opened in 2001? | shop_membership | select t0.hometown, t0.name, t1.total_pounds, t1.year from member as t0 join purchase as t1 on t0.member_id = t1.member_id join membership_register_branch as t2 on t0.member_id = t2.member_id join branch as t3 on t2.branch_id = t3.branch_id where t3.open_year = 2001 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.hometown, t0.name, t1.total_pounds, t1.year from member as t0 join purchase as t1 on t0.member_id = t1.member_id join membership_register_branch as t2 on t0.member_id = t2.member_id join branch as t3 on t2.branch_id = t3.branch_id where t3.open... | {
"index": 1087,
"split": "train"
} | |
Show me the five most expensive ticket prices along with their dates and corresponding film IDs from the schedule, sorted from highest to lowest price. | cinema | select price as c2, date, film_id from schedule 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": "cinema",
"sql": "select price as c2, date, film_id from schedule order by c2 desc limit 5"
},
"style": "rule"
} | {
"index": 834,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.