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 |
|---|---|---|---|---|---|---|---|---|
What are the station IDs and manager names of gas stations that are operated by companies with assets less than 319.4 billion? | gas_company | select anon_1.c0, anon_1.c1 from (select station_id as c0, manager_name as c1 from gas_station intersect select t0.station_id as c0, t0.manager_name as c1 from gas_station as t0 join station_company as t1 on t0.station_id = t1.station_id join company as t2 on t1.company_id = t2.company_id where t2.assets_billion < 319.... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "gas_company",
"sql": "select anon_1.c0, anon_1.c1 from (select station_id as c0, manager_name as c1 from gas_station intersect select t0.station_id as c0, t0.manager_name as c1 from gas_station as t0 join station_company as t1 on t0.station_id = t1.station_id join company as t2 o... | {
"index": 958,
"split": "train"
} | |
For the principal activities of companies that are either company 8 or the most common company whose main activity starts with "Catering s," which activity has the smallest number of companies, and how many distinct types and total companies are associated with it? | flight_company | select t0.principal_activities as c2, count(distinct (t0.type)), count(t0.id) from operate_company as t0, (select id as c0 from operate_company where principal_activities like 'Catering s%' group by c0 order by count(*) desc limit 1) as t0 where t0.id = 8 or t0.id = t0.c0 group by c2 order by count(*) asc nulls last li... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.principal_activities as c2, count(distinct (t0.type)), count(t0.id) from operate_company as t0, (select id as c0 from operate_company where principal_activities like 'Catering s%' group by c0 order by count(*) desc limit 1) as t0 where t0.id = 8... | {
"index": 791,
"split": "train"
} | |
How many more employees have the PT role than the PR role? | cre_Doc_Control_Systems | select t1.c2 - t0.c2 from (select count(distinct (t1.employee_id)) as c2 from roles as t0 join employees as t1 on t0.role_code = t1.role_code where t0.role_code = 'PR' group by t0.role_code) as t1, (select t0.role_code, count(distinct (t1.employee_id)) as c2 from roles as t0 join employees as t1 on t0.role_code = t1.ro... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Control_Systems",
"sql": "select t1.c2 - t0.c2 from (select count(distinct (t1.employee_id)) as c2 from roles as t0 join employees as t1 on t0.role_code = t1.role_code where t0.role_code = 'PR' group by t0.role_code) as t1, (select t0.role_code, count(distinct (t1.employe... | {
"index": 3591,
"split": "train"
} | |
Can you list the five movies with the highest movie IDs, including their titles and total worldwide gross, where each movie is linked to a book club whose year is not among the years in the movie table? Additionally, only include movies associated with the author or editor who is the least frequently involved in book c... | culture_company | select t0.movie_id as c0, t0.title, t0.gross_worldwide from movie as t0 join culture_company as t1 on t0.movie_id = t1.movie_id join book_club as t2 on t1.book_club_id = t2.book_club_id, (select author_or_editor as c3 from book_club where year = 1989 or year between 1990 and 1990 group by c3 order by count(*) asc nulls... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "culture_company",
"sql": "select t0.movie_id as c0, t0.title, t0.gross_worldwide from movie as t0 join culture_company as t1 on t0.movie_id = t1.movie_id join book_club as t2 on t1.book_club_id = t2.book_club_id, (select author_or_editor as c3 from book_club where year = 1989 or ... | {
"index": 1567,
"split": "train"
} | |
Which campus with faculty members in 2004 has the lowest campus ID, and what is its fee and campus name or ID? | csu_1 | select t0.campusfee, t0.campus, t1.id as c2 from csu_fees as t0 join campuses as t1 on t0.campus = t1.id join faculty as t2 on t1.id = t2.campus where t2.year = 2004 order by c2 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "csu_1",
"sql": "select t0.campusfee, t0.campus, t1.id as c2 from csu_fees as t0 join campuses as t1 on t0.campus = t1.id join faculty as t2 on t1.id = t2.campus where t2.year = 2004 order by c2 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2445,
"split": "train"
} | |
Which media types are associated with tracks that have a media type ID of 2 or less, but do not include the track named 'Olodum - Smile (Instrumental)'? Please provide their IDs and names. | store_1 | select anon_1.c1, anon_1.c0 from (select t0.id as c1, t0.name as c0 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.media_type_id <= 2 except select t0.id as c1, t0.name as c0 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.name = 'Olodum - Smile (Instrumental... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c1, anon_1.c0 from (select t0.id as c1, t0.name as c0 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.media_type_id <= 2 except select t0.id as c1, t0.name as c0 from media_types as t0 join tracks as t1 on t0.id = t1.m... | {
"index": 2003,
"split": "train"
} | |
Show the carrier, price, number of stock, and market ID for phones that are available in markets ranked in the top 3 or between 4 and 21. | phone_market | select t0.carrier, t0.price, t1.num_of_stock, t1.market_id from phone as t0 join phone_market as t1 on t0.phone_id = t1.phone_id join market as t2 on t1.market_id = t2.market_id where t2.ranking <= 3 or t2.ranking between 4 and 21 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "phone_market",
"sql": "select t0.carrier, t0.price, t1.num_of_stock, t1.market_id from phone as t0 join phone_market as t1 on t0.phone_id = t1.phone_id join market as t2 on t1.market_id = t2.market_id where t2.ranking <= 3 or t2.ranking between 4 and 21"
},
"style": "rule"
} | {
"index": 113,
"split": "train"
} | |
Can you tell me the top three campuses, ordered by name in reverse, where the maximum number of undergraduates in any discipline is at least 2,675, and what that maximum undergraduate count is for each? | csu_1 | select campus as c1, max(undergraduate) from discipline_enrollments group by c1 having max(undergraduate) >= 2675 order by c1 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "csu_1",
"sql": "select campus as c1, max(undergraduate) from discipline_enrollments group by c1 having max(undergraduate) >= 2675 order by c1 desc limit 3"
},
"style": "rule"
} | {
"index": 2027,
"split": "train"
} | |
How much larger is the camera lens ID used for photo 1 compared to the lens ID used for photo 3? | mountain_photos | select t1.c0 - t0.c0 from (select camera_lens_id as c0 from photos where id = 3) as t1, (select camera_lens_id as c0 from photos where id = 1) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "mountain_photos",
"sql": "select t1.c0 - t0.c0 from (select camera_lens_id as c0 from photos where id = 3) as t1, (select camera_lens_id as c0 from photos where id = 1) as t0"
},
"style": "rule"
} | {
"index": 3614,
"split": "train"
} | |
Which amenities are assigned to the dorm with the fewest amenities among those linked to dorm 104 and amenities with IDs less than or equal to 955? | dorm_1 | select t0.amenity_name from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid, (select dormid as c0 from has_amenity where c0 = 104 and amenid <= 955 group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.dormid = t0.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": "dorm_1",
"sql": "select t0.amenity_name from dorm_amenity as t0 join has_amenity as t1 on t0.amenid = t1.amenid, (select dormid as c0 from has_amenity where c0 = 104 and amenid <= 955 group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.dormid = t0.c0"
},
"sty... | {
"index": 2137,
"split": "train"
} | |
What are the booking status codes for apartment bookings that begin with the letter "C"? Please list them in order sorted by guest ID, placing any entries with missing guest IDs at the end. | apartment_rentals | select booking_status_code as c0 from apartment_bookings where c0 like 'C%' order by guest_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": "apartment_rentals",
"sql": "select booking_status_code as c0 from apartment_bookings where c0 like 'C%' order by guest_id asc nulls last"
},
"style": "rule"
} | {
"index": 117,
"split": "train"
} | |
Is the sum of customer IDs associated with staff member 117 less than 579? | customer_complaints | select t0.c1 < 579 from (select sum(t1.customer_id) as c1 from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id where t0.staff_id = 117 group by t0.staff_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.c1 < 579 from (select sum(t1.customer_id) as c1 from staff as t0 join complaints as t1 on t0.staff_id = t1.staff_id where t0.staff_id = 117 group by t0.staff_id) as t0"
},
"style": "rule"
} | {
"index": 3335,
"split": "train"
} | |
Can you show me the district and store IDs for all store districts, arranging the list by store ID with any missing store IDs appearing last? | store_product | select district_id, store_id as c1 from store_district order by c1 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": "store_product",
"sql": "select district_id, store_id as c1 from store_district order by c1 asc nulls last"
},
"style": "rule"
} | {
"index": 2552,
"split": "train"
} | |
Was the receipt date of document 24 later than the receipt date of document 20? | cre_Doc_Control_Systems | select t1.c0 > t0.c0 from (select receipt_date as c0 from documents where document_id = 24) as t1, (select receipt_date as c0 from documents where document_id = 20) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Control_Systems",
"sql": "select t1.c0 > t0.c0 from (select receipt_date as c0 from documents where document_id = 24) as t1, (select receipt_date as c0 from documents where document_id = 20) as t0"
},
"style": "rule"
} | {
"index": 3906,
"split": "train"
} | |
How many days passed between the date when customer 2's contact channel became active and the date it was deactivated? | customers_and_addresses | select julianday(t1.c2) - julianday(t0.c3) from (select active_from_date as c2 from customer_contact_channels where customer_id = 2 and customer_id = 2) as t1, (select active_to_date as c3 from customer_contact_channels) 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 julianday(t1.c2) - julianday(t0.c3) from (select active_from_date as c2 from customer_contact_channels where customer_id = 2 and customer_id = 2) as t1, (select active_to_date as c3 from customer_contact_channels) as t0"
},
"style": "r... | {
"index": 3690,
"split": "train"
} | |
What are the invoice numbers, order IDs, and invoice dates for invoices that include transactions of the transaction type with the highest maximum transaction amount (up to 613.96), and that also have transactions with amounts between 613.96 and 1598.25? | customers_and_invoices | select anon_1.c0, anon_1.c2, anon_1.c3 from (select t0.invoice_number as c0, t0.order_id as c2, t0.invoice_date as c3 from invoices as t0 join financial_transactions as t1 on t0.invoice_number = t1.invoice_number, (select transaction_type as c1 from financial_transactions where transaction_amount <= 613.96 group by c1 ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select anon_1.c0, anon_1.c2, anon_1.c3 from (select t0.invoice_number as c0, t0.order_id as c2, t0.invoice_date as c3 from invoices as t0 join financial_transactions as t1 on t0.invoice_number = t1.invoice_number, (select transaction_type as c1 fr... | {
"index": 688,
"split": "train"
} | |
What are the ten media types with the smallest total number of albums, along with their names and IDs, for tracks that have a media type ID of 1 or less and durations between roughly 4.9 and 21.3 minutes, ordered by their total album counts? | store_1 | select t0.name, t0.id as c2, sum(t1.album_id) as c0 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.media_type_id <= 1 and t1.milliseconds between 279980 and 1278041 group by c2 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": "store_1",
"sql": "select t0.name, t0.id as c2, sum(t1.album_id) as c0 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.media_type_id <= 1 and t1.milliseconds between 279980 and 1278041 group by c2 order by c0 asc nulls last limit 10"
},
"style": "... | {
"index": 2770,
"split": "train"
} | |
Who are the customers with a gender ending in "0" who have four or fewer accounts, and what is their smallest customer ID along with their last name? | customers_and_invoices | select min(t0.customer_id), t1.customer_last_name, t1.customer_id as c2 from accounts as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.gender like '%0' group by c2 having count(*) <= 4 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select min(t0.customer_id), t1.customer_last_name, t1.customer_id as c2 from accounts as t0 join customers as t1 on t0.customer_id = t1.customer_id where t1.gender like '%0' group by c2 having count(*) <= 4"
},
"style": "rule"
} | {
"index": 795,
"split": "train"
} | |
What are the names and IDs of up to three products with IDs less than 3, listed in reverse alphabetical order? | tracking_orders | select t0.product_name as c0, t0.product_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id < 3 order by c0 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select t0.product_name as c0, t0.product_id from products as t0 join order_items as t1 on t0.product_id = t1.product_id where t1.product_id < 3 order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 2428,
"split": "train"
} | |
Can you provide the names and IDs of activities, along with the faculty IDs and activity IDs from the participation records, for faculty members whose phone numbers are between 3571 and 8972? | activity_1 | select t0.activity_name, t0.actid, t1.facid, t1.actid from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid join faculty as t2 on t1.facid = t2.facid where t2.phone between 3571 and 8972 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "activity_1",
"sql": "select t0.activity_name, t0.actid, t1.facid, t1.actid from activity as t0 join faculty_participates_in as t1 on t0.actid = t1.actid join faculty as t2 on t1.facid = t2.facid where t2.phone between 3571 and 8972"
},
"style": "rule"
} | {
"index": 1127,
"split": "train"
} | |
Which airport IDs and their corresponding Y values are associated with airports connected to airlines that have an active status ending with "Y"? | flight_4 | select t0.apid, t0.y 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.active like '%Y' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.apid, t0.y 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.active like '%Y'"
},
"style": "rule"
} | {
"index": 2277,
"split": "train"
} | |
Which active customers, identified by their address and first name, have rented movies from inventory items that are not associated with any store in the database? | sakila_1 | select t0.active, t0.address_id, t0.first_name from customer as t0 join rental as t1 on t0.customer_id = t1.customer_id join inventory as t2 on t1.inventory_id = t2.inventory_id where (not t2.store_id in (select store.store_id as c1 from store)) | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "sakila_1",
"sql": "select t0.active, t0.address_id, t0.first_name from customer as t0 join rental as t1 on t0.customer_id = t1.customer_id join inventory as t2 on t1.inventory_id = t2.inventory_id where (not t2.store_id in (select store.store_id as c1 from store))"
},
"style"... | {
"index": 2189,
"split": "train"
} | |
Calculate the number of days between when the asset was acquired and when it was disposed.? | assets_maintenance | select julianday(t1.c3) - julianday(t0.c2) from (select asset_acquired_date as c3 from assets) as t1, (select asset_disposed_date as c2 from assets) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "assets_maintenance",
"sql": "select julianday(t1.c3) - julianday(t0.c2) from (select asset_acquired_date as c3 from assets) as t1, (select asset_disposed_date as c2 from assets) as t0"
},
"style": "rule"
} | {
"index": 3672,
"split": "train"
} | |
What are the savings balances and customer IDs for customers with custid 1 or 2? | small_bank_1 | select distinct t0.balance, t0.custid from savings as t0 join accounts as t1 on t0.custid = t1.custid where t1.custid = 1 or t1.custid = 2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "small_bank_1",
"sql": "select distinct t0.balance, t0.custid from savings as t0 join accounts as t1 on t0.custid = t1.custid where t1.custid = 1 or t1.custid = 2"
},
"style": "rule"
} | {
"index": 1803,
"split": "train"
} | |
What are the IDs and associated porphyria conditions of the top 10 enzymes linked to enzyme ID 1, sorted by their product names in reverse alphabetical order? | medicine_enzyme_interaction | select t0.id, t0.porphyria from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.enzyme_id = 1 order by t0.product desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "medicine_enzyme_interaction",
"sql": "select t0.id, t0.porphyria from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where t1.enzyme_id = 1 order by t0.product desc limit 10"
},
"style": "rule"
} | {
"index": 2866,
"split": "train"
} | |
Which buildings have a department with the highest budget of exactly 794,541.46, and what is that maximum department budget for each of those buildings? Please list the buildings and their maximum budgets in reverse alphabetical order. | college_2 | select building as c1, max(budget) from department group by c1 having max(budget) = 794541.46 order by c1 desc | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_2",
"sql": "select building as c1, max(budget) from department group by c1 having max(budget) = 794541.46 order by c1 desc"
},
"style": "rule"
} | {
"index": 1744,
"split": "train"
} | |
Can you provide all the details available about the matches? | aircraft | select * from match | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "aircraft",
"sql": "select * from match"
},
"style": "rule"
} | {
"index": 1120,
"split": "train"
} | |
When did the customer with the highest customer ID have their card validity start? | customers_card_transactions | select t0.date_valid_from, t0.customer_id as c1 from customers_cards as t0, (select max(customer_id) as c3 from customers_cards) as t1 where c1 = t1.c3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select t0.date_valid_from, t0.customer_id as c1 from customers_cards as t0, (select max(customer_id) as c3 from customers_cards) as t1 where c1 = t1.c3"
},
"style": "rule"
} | {
"index": 3761,
"split": "train"
} | |
Could you provide the names and prices of all products and services offered in the drama workshop program? | cre_Drama_Workshop_Groups | select anon_1.c2, anon_1.c1 from (select product_name as c2, product_price as c1 from products union select product_name, product_price from services) 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": "cre_Drama_Workshop_Groups",
"sql": "select anon_1.c2, anon_1.c1 from (select product_name as c2, product_price as c1 from products union select product_name, product_price from services) as anon_1"
},
"style": "rule"
} | {
"index": 2746,
"split": "train"
} | |
How many customer names are associated with orders that have a status containing "g"? Additionally, how many unique customers (based on customer ID) and unique customer details are involved in these orders? | tracking_orders | select count(t0.customer_name), count(distinct (t0.customer_id)), count(distinct (t0.customer_details)) from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t1.order_status like '%g%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select count(t0.customer_name), count(distinct (t0.customer_id)), count(distinct (t0.customer_details)) from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t1.order_status like '%g%'"
},
"style": "rule"
} | {
"index": 1903,
"split": "train"
} | |
How many aircraft records are there in total, and how many unique aircraft names have a distance less than 8430 or less than or equal to 2605? | flight_1 | select count(*), count(distinct (t0.name)) from aircraft as t0 join flight as t1 on t0.aid = t1.aid where t0.distance < 8430 or t0.distance <= 2605 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_1",
"sql": "select count(*), count(distinct (t0.name)) from aircraft as t0 join flight as t1 on t0.aid = t1.aid where t0.distance < 8430 or t0.distance <= 2605"
},
"style": "rule"
} | {
"index": 1610,
"split": "train"
} | |
How many performances has each member attended, listed by their member ID? | performance_attendance | select member_id as c1, count(performance_id) from member_attendance 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": "performance_attendance",
"sql": "select member_id as c1, count(performance_id) from member_attendance group by c1"
},
"style": "rule"
} | {
"index": 729,
"split": "train"
} | |
Can you show the most recent 10 pairs of premise IDs from premises and customer addresses where the address premise ID is less than 12, ordered from highest to lowest by the address premise ID? | customers_campaigns_ecommerce | select t0.premise_id, t1.premise_id as c0 from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id where c0 < 12 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": "customers_campaigns_ecommerce",
"sql": "select t0.premise_id, t1.premise_id as c0 from premises as t0 join customer_addresses as t1 on t0.premise_id = t1.premise_id where c0 < 12 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 2388,
"split": "train"
} | |
When did the maintenance contract with the highest company ID less than or equal to 8 end? | assets_maintenance | select t0.contract_end_date, t0.maintenance_contract_company_id as c3 from maintenance_contracts as t0, (select max(maintenance_contract_company_id) as c1 from maintenance_contracts where maintenance_contract_company_id <= 8) as t1 where c3 = t1.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "assets_maintenance",
"sql": "select t0.contract_end_date, t0.maintenance_contract_company_id as c3 from maintenance_contracts as t0, (select max(maintenance_contract_company_id) as c1 from maintenance_contracts where maintenance_contract_company_id <= 8) as t1 where c3 = t1.c1"
... | {
"index": 3746,
"split": "train"
} | |
Which tracks, along with their IDs, have been purchased in invoices where the billing state starts with "D" and the customer ID is greater than 25? Please also include the invoice ID and the invoice line ID for each transaction. | store_1 | select t0.name, t0.id, t1.invoice_id, t1.id from tracks as t0 join invoice_lines as t1 on t0.id = t1.track_id join invoices as t2 on t1.invoice_id = t2.id where t2.billing_state like 'D%' and t2.customer_id > 25 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select t0.name, t0.id, t1.invoice_id, t1.id from tracks as t0 join invoice_lines as t1 on t0.id = t1.track_id join invoices as t2 on t1.invoice_id = t2.id where t2.billing_state like 'D%' and t2.customer_id > 25"
},
"style": "rule"
} | {
"index": 1702,
"split": "train"
} | |
Can you list the outcome codes and customer IDs for customers whose total number of orders is greater than or equal to the total number of unique customers in the database? | customers_campaigns_ecommerce | select t0.outcome_code, t0.customer_id from mailshot_customers as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id, (select count(distinct (customer_id)) as c0 from customer_orders) as t0 where t2.customer_id >= t0.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_campaigns_ecommerce",
"sql": "select t0.outcome_code, t0.customer_id from mailshot_customers as t0 join customers as t1 on t0.customer_id = t1.customer_id join customer_orders as t2 on t1.customer_id = t2.customer_id, (select count(distinct (customer_id)) as c0 from cus... | {
"index": 2038,
"split": "train"
} | |
Show me the 10 products with 't' in their details, along with their lowest order item product IDs, sorted so that the products with the highest of these lowest IDs come first. | customers_and_addresses | select min(t0.product_id) as c0, t1.product_id as c1 from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_details like '%t%' group by c1 order by c0 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_addresses",
"sql": "select min(t0.product_id) as c0, t1.product_id as c1 from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_details like '%t%' group by c1 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 102,
"split": "train"
} | |
Can you tell me the type, graphics mode, and pixels of all screen configurations, including those used by phones with Wi-Fi capabilities that start with the letter N? | phone_1 | select anon_1.c0, anon_1.c2, anon_1.c1 from (select type as c0, graphics_mode as c2, pixels as c1 from screen_mode union select t0.type as c0, t0.graphics_mode as c2, t0.pixels as c1 from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode join chip_model as t2 on t1.chip_model = t2.model_name where... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c2, anon_1.c1 from (select type as c0, graphics_mode as c2, pixels as c1 from screen_mode union select t0.type as c0, t0.graphics_mode as c2, t0.pixels as c1 from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode jo... | {
"index": 1044,
"split": "train"
} | |
Find the lengths, names, and country IDs of roller coasters that also exist in Austria. | roller_coaster | select anon_1.c2, anon_1.c1, anon_1.c0 from (select length as c2, name as c1, country_id as c0 from roller_coaster intersect select t0.length as c2, t0.name as c1, t0.country_id as c0 from roller_coaster as t0 join country as t1 on t0.country_id = t1.country_id where t1.name like '%Austri%') as anon_1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "roller_coaster",
"sql": "select anon_1.c2, anon_1.c1, anon_1.c0 from (select length as c2, name as c1, country_id as c0 from roller_coaster intersect select t0.length as c2, t0.name as c1, t0.country_id as c0 from roller_coaster as t0 join country as t1 on t0.country_id = t1.coun... | {
"index": 1874,
"split": "train"
} | |
What are the match IDs and venues for all matches, including those hosted in the city with ID 5? | city_record | select anon_1.c1, anon_1.c0 from (select match_id as c1, venue as c0 from match union select t0.match_id as c1, t0.venue as c0 from match as t0 join hosting_city as t1 on t0.match_id = t1.match_id join city as t2 on t1.host_city = t2.city_id where t2.city_id = 5) 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": "city_record",
"sql": "select anon_1.c1, anon_1.c0 from (select match_id as c1, venue as c0 from match union select t0.match_id as c1, t0.venue as c0 from match as t0 join hosting_city as t1 on t0.match_id = t1.match_id join city as t2 on t1.host_city = t2.city_id where t2.city_id... | {
"index": 316,
"split": "train"
} | |
When years are ranked from the fewest to the most total games played, what is the rank of 1983? | baseball_1 | select t1.c1, t1.c2 as c0 from (select row_number() over (order by t0.c5 asc nulls last) as c1, t0.c4 as c2 from (select t0.year as c4, sum(t1.games) as c5 from team as t0 join home_game as t1 on t0.team_id = t1.team_id group by c4) as t0) as t1 where c0 = 1983 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select t1.c1, t1.c2 as c0 from (select row_number() over (order by t0.c5 asc nulls last) as c1, t0.c4 as c2 from (select t0.year as c4, sum(t1.games) as c5 from team as t0 join home_game as t1 on t0.team_id = t1.team_id group by c4) as t0) as t1 where c0 = 19... | {
"index": 3462,
"split": "train"
} | |
Find the IDs of leagues that are based in countries with 'Scotland' in their name. | soccer_1 | select t0.id from league as t0 join country as t1 on t0.country_id = t1.id where t1.name like '%Scotland%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "soccer_1",
"sql": "select t0.id from league as t0 join country as t1 on t0.country_id = t1.id where t1.name like '%Scotland%'"
},
"style": "rule"
} | {
"index": 2106,
"split": "train"
} | |
Which are the last names and customer IDs of the first five customers, sorted alphabetically by their first name, who have lessons that were either canceled or completed? For each of these customers, what is the average staff ID of the lessons they've taken with those statuses? | driving_school | select t0.last_name, t0.customer_id as c1, avg(t1.staff_id) from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t1.lesson_status_code = 'Cancelled' or t1.lesson_status_code like '%Completed' group by c1 order by t0.first_name 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": "driving_school",
"sql": "select t0.last_name, t0.customer_id as c1, avg(t1.staff_id) from customers as t0 join lessons as t1 on t0.customer_id = t1.customer_id where t1.lesson_status_code = 'Cancelled' or t1.lesson_status_code like '%Completed' group by c1 order by t0.first_name ... | {
"index": 2556,
"split": "train"
} | |
What are the highest item IDs reviewed by users with IDs less than 2? Show the top 10 maximum item IDs in descending order. | epinions_1 | select max(i_id) as c0 from review where u_id < 2 or u_id < 1 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": "epinions_1",
"sql": "select max(i_id) as c0 from review where u_id < 2 or u_id < 1 order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 1829,
"split": "train"
} | |
What are the advisors and majors of students who have allergies containing "len" or "nt"? And what are their student IDs? | allergy_1 | select t0.advisor, t0.major, t1.stuid from student as t0 join has_allergy as t1 on t0.stuid = t1.stuid join allergy_type as t2 on t1.allergy = t2.allergy where t2.allergy like '%len%' or t2.allergy like '%nt%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "allergy_1",
"sql": "select t0.advisor, t0.major, t1.stuid from student as t0 join has_allergy as t1 on t0.stuid = t1.stuid join allergy_type as t2 on t1.allergy = t2.allergy where t2.allergy like '%len%' or t2.allergy like '%nt%'"
},
"style": "rule"
} | {
"index": 2521,
"split": "train"
} | |
Could you tell me the details of the three activities with activity IDs greater than 780 that have the smallest participation activity IDs, including their activity IDs, names, and the associated participation activity IDs? | activity_1 | select t0.actid, t0.activity_name, t1.actid as c1 from activity as t0 join participates_in as t1 on t0.actid = t1.actid where c1 > 780 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": "activity_1",
"sql": "select t0.actid, t0.activity_name, t1.actid as c1 from activity as t0 join participates_in as t1 on t0.actid = t1.actid where c1 > 780 order by c1 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 1839,
"split": "train"
} | |
Can you list the five most recent location codes, the associated thing IDs, the organization IDs of those things, and their service details for services that start with "Un"? Sort the list in descending order of location code. | local_govt_and_lot | select t0.location_code as c0, t0.thing_id, t1.organization_id, t1.service_details from timed_locations_of_things as t0 join things as t1 on t0.thing_id = t1.thing_id join organizations as t2 on t1.organization_id = t2.organization_id join services as t3 on t2.organization_id = t3.organization_id where t3.service_detai... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.location_code as c0, t0.thing_id, t1.organization_id, t1.service_details from timed_locations_of_things as t0 join things as t1 on t0.thing_id = t1.thing_id join organizations as t2 on t1.organization_id = t2.organization_id join services as... | {
"index": 545,
"split": "train"
} | |
How many unique last names are there among teachers at address 10 who have the fewest teachers sharing the same first name? | behavior_monitoring | select count(distinct (last_name)) from teachers where address_id = 10 order by count(first_name) asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "behavior_monitoring",
"sql": "select count(distinct (last_name)) from teachers where address_id = 10 order by count(first_name) asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2579,
"split": "train"
} | |
What are the credits, codes, and descriptions of courses that have classes taught by professors with numbers at least 105, but not taught by professors with numbers greater than 301? | college_1 | select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.crs_credit as c0, t0.crs_code as c2, t0.crs_description as c1 from course as t0 join class as t1 on t0.crs_code = t1.crs_code where t1.prof_num >= 105 except select t0.crs_credit as c0, t0.crs_code as c2, t0.crs_description as c1 from course as t0 join class 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": "college_1",
"sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.crs_credit as c0, t0.crs_code as c2, t0.crs_description as c1 from course as t0 join class as t1 on t0.crs_code = t1.crs_code where t1.prof_num >= 105 except select t0.crs_credit as c0, t0.crs_code as c2, ... | {
"index": 2674,
"split": "train"
} | |
How many roller coasters are located at Gröna Lund? | roller_coaster | select count(*) from roller_coaster where park = 'Gröna Lund' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "roller_coaster",
"sql": "select count(*) from roller_coaster where park = 'Gröna Lund'"
},
"style": "rule"
} | {
"index": 2669,
"split": "train"
} | |
How many unique detention end times are recorded for each detention type during the period from March 7th to March 8th, 2018, as well as for detentions ending after March 8th, 2018, and which detention types have the highest number of these unique end times? | behavior_monitoring | select detention_type_code as c0, count(distinct (datetime_detention_end)) from detention where datetime_detention_end between '2018-03-07 04:24:48' and '2018-03-08 02:08:32' or datetime_detention_end >= '2018-03-08 09:16:38' group by c0 order by count(detention_type_code) 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": "behavior_monitoring",
"sql": "select detention_type_code as c0, count(distinct (datetime_detention_end)) from detention where datetime_detention_end between '2018-03-07 04:24:48' and '2018-03-08 02:08:32' or datetime_detention_end >= '2018-03-08 09:16:38' group by c0 order by cou... | {
"index": 750,
"split": "train"
} | |
Which students, identified by their family names and IDs, are enrolled in the most popular subject and also in the subject with ID 1? | e_learning | select anon_1.c1, anon_1.c0 from (select t0.family_name as c1, t0.student_id as c0 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id join courses as t2 on t1.course_id = t2.course_id join subjects as t3 on t2.subject_id = t3.subject_id, (select subject_name as c2 from subjects gro... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.family_name as c1, t0.student_id as c0 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id join courses as t2 on t1.course_id = t2.course_id join subjects as t3 on t2.subject_id ... | {
"index": 2021,
"split": "train"
} | |
Who are the participant type codes and participant IDs for individuals who participated in the same event as participant 90 and also in the event with ID 13? | local_govt_in_alabama | select anon_1.c1, anon_1.c0 from (select t0.participant_type_code as c1, t0.participant_id as c0 from participants as t0 join participants_in_events as t1 on t0.participant_id = t1.participant_id where t1.participant_id = 90 intersect select t0.participant_type_code as c1, t0.participant_id as c0 from participants as t... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "local_govt_in_alabama",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.participant_type_code as c1, t0.participant_id as c0 from participants as t0 join participants_in_events as t1 on t0.participant_id = t1.participant_id where t1.participant_id = 90 intersect select t0.par... | {
"index": 741,
"split": "train"
} | |
What are the details of enzymes that are interacted with by the medicine having ID 6? | medicine_enzyme_interaction | select t0.omim, t0.porphyria, t0.product, t1.medicine_id as c0 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where c0 = 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": "medicine_enzyme_interaction",
"sql": "select t0.omim, t0.porphyria, t0.product, t1.medicine_id as c0 from enzyme as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.enzyme_id where c0 = 6"
},
"style": "rule"
} | {
"index": 1374,
"split": "train"
} | |
Identify the people who are connected to candidates with support rates at most 33% and an unsure rate of exactly 90%. What are their IDs, weights, and genders? | candidate_poll | select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.people_id as c0, t0.weight as c1, t0.sex as c2 from people as t0 join candidate as t1 on t0.people_id = t1.people_id where t1.support_rate <= 0.33 intersect select t0.people_id as c0, t0.weight as c1, t0.sex as c2 from people as t0 join candidate as t1 on t0.people... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "candidate_poll",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.people_id as c0, t0.weight as c1, t0.sex as c2 from people as t0 join candidate as t1 on t0.people_id = t1.people_id where t1.support_rate <= 0.33 intersect select t0.people_id as c0, t0.weight as c1,... | {
"index": 434,
"split": "train"
} | |
Is the total duration of all tracks for media type 4 longer than the smallest total duration among media types that have tracks with total milliseconds between 258,168 and 296,280? | store_1 | select t2.c3 > t1.c1 from (select sum(t1.milliseconds) as c3 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t0.id = 4 group by t0.id) as t2, (select min(t0.c3) as c1 from (select sum(t1.milliseconds) as c3 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t1.millisec... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t2.c3 > t1.c1 from (select sum(t1.milliseconds) as c3 from media_types as t0 join tracks as t1 on t0.id = t1.media_type_id where t0.id = 4 group by t0.id) as t2, (select min(t0.c3) as c1 from (select sum(t1.milliseconds) as c3 from media_types as t0 join ... | {
"index": 3868,
"split": "train"
} | |
Can you provide the first name, cell mobile number, and person ID for each person who has at least one address with an ID of 92 or higher and a person ID of 151 or higher? Additionally, for each person, how many unique address records are associated with their person ID? | student_assessment | select t0.first_name, t0.cell_mobile_number, t0.person_id as c3, count(distinct (t1.person_id)) from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id where t1.address_id >= 92 and t1.person_id >= 151 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": "student_assessment",
"sql": "select t0.first_name, t0.cell_mobile_number, t0.person_id as c3, count(distinct (t1.person_id)) from people as t0 join people_addresses as t1 on t0.person_id = t1.person_id where t1.address_id >= 92 and t1.person_id >= 151 group by c3"
},
"style":... | {
"index": 2440,
"split": "train"
} | |
What are the job IDs, hire dates, and department IDs for all employees, ordered by job ID with any null values appearing at the end? | hr_1 | select job_id as c2, hire_date, department_id from employees order by c2 asc nulls last | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "hr_1",
"sql": "select job_id as c2, hire_date, department_id from employees order by c2 asc nulls last"
},
"style": "rule"
} | {
"index": 1464,
"split": "train"
} | |
Looking at catalogs, what are their publication dates and catalog IDs for the least common catalog level name or for catalog level names that start with "S", sorted by the publication date from oldest to newest? | product_catalog | select t0.date_of_publication as c0 from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id, (select catalog_level_name as c1 from catalog_structure group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.catalog_level_name = t0.c1 or t1.catalog_level_name like 'S%' order by c0 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": "product_catalog",
"sql": "select t0.date_of_publication as c0 from catalogs as t0 join catalog_structure as t1 on t0.catalog_id = t1.catalog_id, (select catalog_level_name as c1 from catalog_structure group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.catalog_le... | {
"index": 767,
"split": "train"
} | |
For the project with ID 14, is the highest task ID associated with it greater than 13? | tracking_grants_for_research | select t0.c1 > 13 from (select max(t1.project_id) as c1 from projects as t0 join tasks as t1 on t0.project_id = t1.project_id where t0.project_id = 14 group by t0.project_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_grants_for_research",
"sql": "select t0.c1 > 13 from (select max(t1.project_id) as c1 from projects as t0 join tasks as t1 on t0.project_id = t1.project_id where t0.project_id = 14 group by t0.project_id) as t0"
},
"style": "rule"
} | {
"index": 3303,
"split": "train"
} | |
Which building's full name and ID, along with the sum of its apartment IDs, corresponds to the building that has more apartments with 7 rooms than the total number of distinct buildings, but has fewer than two such apartments, and among those, has the lowest total of apartment IDs? | apartment_rentals | select t0.building_full_name, t0.building_id as c2, sum(t1.building_id) as c3 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id, (select count(distinct (building_id)) as c1 from apartments) as t0 where t1.building_id > t0.c1 and t1.room_count = 7 group by c2 having count(*) < 2 ord... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "apartment_rentals",
"sql": "select t0.building_full_name, t0.building_id as c2, sum(t1.building_id) as c3 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id, (select count(distinct (building_id)) as c1 from apartments) as t0 where t1.building_... | {
"index": 2806,
"split": "train"
} | |
How many unique guests have booked apartments with a total of three or more rooms, and what is the highest apartment ID among those bookings? Also, list the apartment ID for each of these apartments. | apartment_rentals | select count(distinct (t0.guest_id)), max(t0.apt_id), t1.apt_id as c1 from apartment_bookings as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.room_count like '%3' group by c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "apartment_rentals",
"sql": "select count(distinct (t0.guest_id)), max(t0.apt_id), t1.apt_id as c1 from apartment_bookings as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.room_count like '%3' group by c1"
},
"style": "rule"
} | {
"index": 318,
"split": "train"
} | |
Who are the students with fewer than four course completions after March 1, 2018, and what are their personal names, middle names, and student IDs? Please list the first three students alphabetically by their personal name, placing any with missing names last. | e_learning | select t0.personal_name as c0, t0.middle_name, t0.student_id as c2 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_completion >= '2018-03-01 07:12:39' group by c2 having count(*) < 4 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": "e_learning",
"sql": "select t0.personal_name as c0, t0.middle_name, t0.student_id as c2 from students as t0 join student_course_enrolment as t1 on t0.student_id = t1.student_id where t1.date_of_completion >= '2018-03-01 07:12:39' group by c2 having count(*) < 4 order by c0 asc nu... | {
"index": 244,
"split": "train"
} | |
What are the budgets and department names for departments that either start with "Mech. Eng." or are the most common department, provided they have at most two instructors assigned? | college_2 | select t0.budget, t0.dept_name as c1 from department as t0 join instructor as t1 on t0.dept_name = t1.dept_name, (select dept_name as c0 from instructor group by c0 order by count(*) desc limit 1) as t0 where t1.dept_name like 'Mech. Eng.%' or t1.dept_name = t0.c0 group by c1 having count(*) <= 2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_2",
"sql": "select t0.budget, t0.dept_name as c1 from department as t0 join instructor as t1 on t0.dept_name = t1.dept_name, (select dept_name as c0 from instructor group by c0 order by count(*) desc limit 1) as t0 where t1.dept_name like 'Mech. Eng.%' or t1.dept_name = t... | {
"index": 2185,
"split": "train"
} | |
Where does the 'LUNCH' detention type rank in order of detention types when they are sorted from lowest to highest average teacher ID? | behavior_monitoring | select t1.c5, t1.c3 as c4 from (select row_number() over (order by t0.c1 asc nulls last) as c5, t0.c0 as c3 from (select t0.detention_type_code as c0, avg(t1.teacher_id) as c1 from ref_detention_type as t0 join detention as t1 on t0.detention_type_code = t1.detention_type_code group by c0) as t0) as t1 where c4 = 'LUNC... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.c5, t1.c3 as c4 from (select row_number() over (order by t0.c1 asc nulls last) as c5, t0.c0 as c3 from (select t0.detention_type_code as c0, avg(t1.teacher_id) as c1 from ref_detention_type as t0 join detention as t1 on t0.detention_type_co... | {
"index": 3463,
"split": "train"
} | |
How many days passed between when the claim with ID 423 was made and when it was settled? | insurance_policies | select julianday(t1.c0) - julianday(t0.c3) from (select date_claim_made as c0 from claims where claim_id = 423 and claim_id = 423) as t1, (select date_claim_settled as c3 from claims) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "insurance_policies",
"sql": "select julianday(t1.c0) - julianday(t0.c3) from (select date_claim_made as c0 from claims where claim_id = 423 and claim_id = 423) as t1, (select date_claim_settled as c3 from claims) as t0"
},
"style": "rule"
} | {
"index": 3726,
"split": "train"
} | |
What are the birth countries and manager award player IDs for players whose IDs contain "1" or start with "foxch"? | baseball_1 | select t0.birth_country, t1.player_id as c1 from player as t0 join manager_award as t1 on t0.player_id = t1.player_id where c1 like '%1%' or c1 like 'foxch%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select t0.birth_country, t1.player_id as c1 from player as t0 join manager_award as t1 on t0.player_id = t1.player_id where c1 like '%1%' or c1 like 'foxch%'"
},
"style": "rule"
} | {
"index": 1513,
"split": "train"
} | |
Is the sum of customer IDs linked to service 1 less than 17? | e_government | select t0.c1 < 17 from (select sum(t1.customer_id) as c1 from services as t0 join party_services as t1 on t0.service_id = t1.service_id where t0.service_id = 1 group by t0.service_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": "e_government",
"sql": "select t0.c1 < 17 from (select sum(t1.customer_id) as c1 from services as t0 join party_services as t1 on t0.service_id = t1.service_id where t0.service_id = 1 group by t0.service_id) as t0"
},
"style": "rule"
} | {
"index": 3339,
"split": "train"
} | |
What are the gender, country, and name of artists who are associated with genres whose ratings end with a "7" or start with an "8"? | music_1 | select t0.gender, t0.country, t0.artist_name from artist as t0 join song as t1 on t0.artist_name = t1.artist_name join genre as t2 on t1.genre_is = t2.g_name where t2.rating like '%7' or t2.rating like '8%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "music_1",
"sql": "select t0.gender, t0.country, t0.artist_name from artist as t0 join song as t1 on t0.artist_name = t1.artist_name join genre as t2 on t1.genre_is = t2.g_name where t2.rating like '%7' or t2.rating like '8%'"
},
"style": "rule"
} | {
"index": 2528,
"split": "train"
} | |
Which aircraft associated with airports have participated in matches where the winning pilot's name starts with "4", and what are their aircraft IDs, individual IDs, airport IDs, along with their descriptions? Additionally, among these, identify the aircraft with the lowest aircraft ID. | aircraft | select t0.aircraft_id, t0.id, t0.airport_id, t1.description, t1.aircraft_id as c0 from airport_aircraft as t0 join aircraft as t1 on t0.aircraft_id = t1.aircraft_id join match as t2 on t1.aircraft_id = t2.winning_aircraft where t2.winning_pilot like '4%' order by c0 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "aircraft",
"sql": "select t0.aircraft_id, t0.id, t0.airport_id, t1.description, t1.aircraft_id as c0 from airport_aircraft as t0 join aircraft as t1 on t0.aircraft_id = t1.aircraft_id join match as t2 on t1.aircraft_id = t2.winning_aircraft where t2.winning_pilot like '4%' order ... | {
"index": 1856,
"split": "train"
} | |
Is the invoice number for the transaction with ID 14 less than the invoice number for the transaction with ID 6? | customers_and_invoices | select t1.c0 < t0.c0 from (select invoice_number as c0 from financial_transactions where transaction_id = 6) as t1, (select invoice_number as c0 from financial_transactions where transaction_id = 14) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select t1.c0 < t0.c0 from (select invoice_number as c0 from financial_transactions where transaction_id = 6) as t1, (select invoice_number as c0 from financial_transactions where transaction_id = 14) as t0"
},
"style": "rule"
} | {
"index": 3562,
"split": "train"
} | |
How much is the student's address monthly rental amount different from 747.5312? | behavior_monitoring | select monthly_rental - 747.5312 from student_addresses where student_id = 7 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "behavior_monitoring",
"sql": "select monthly_rental - 747.5312 from student_addresses where student_id = 7"
},
"style": "rule"
} | {
"index": 3855,
"split": "train"
} | |
Can you tell me the difference between the highest card ID used in transactions for account 13 (where transaction amounts are at most 1529.97) and the highest card ID used for account 6? | customers_card_transactions | select t1.c1 - t0.c1 from (select max(t1.card_id) as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 6 group by t0.account_id) as t1, (select t0.account_id, max(t1.card_id) as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.a... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select t1.c1 - t0.c1 from (select max(t1.card_id) as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t0.account_id = 6 group by t0.account_id) as t1, (select t0.account_id, max(t1.card_id) as c1... | {
"index": 3600,
"split": "train"
} | |
Can you list the names, heights, and building IDs of the top 10 buildings that house companies whose headquarters start with "Net"? Please sort the list in reverse alphabetical order by building name. | company_office | select t0.name as c0, t0.height, t1.building_id from buildings as t0 join office_locations as t1 on t0.id = t1.building_id join companies as t2 on t1.company_id = t2.id where t2.headquarters like 'Net%' order by c0 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "company_office",
"sql": "select t0.name as c0, t0.height, t1.building_id from buildings as t0 join office_locations as t1 on t0.id = t1.building_id join companies as t2 on t1.company_id = t2.id where t2.headquarters like 'Net%' order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 2568,
"split": "train"
} | |
Which building heights are associated with the company that has the most office locations, and can you list them ordered by their building IDs? | company_office | select t0.height from buildings as t0 join office_locations as t1 on t0.id = t1.building_id, (select company_id as c1 from office_locations group by c1 order by count(*) desc limit 1) as t0 where t1.company_id = t0.c1 order by t1.building_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": "company_office",
"sql": "select t0.height from buildings as t0 join office_locations as t1 on t0.id = t1.building_id, (select company_id as c1 from office_locations group by c1 order by count(*) desc limit 1) as t0 where t1.company_id = t0.c1 order by t1.building_id asc nulls las... | {
"index": 2906,
"split": "train"
} | |
Which treatments and physicians are listed as trained in, excluding those treatments associated with procedure code 2? | hospital_1 | select anon_1.c1, anon_1.c0 from (select treatment as c1, physician as c0 from trained_in except select t0.treatment as c1, t0.physician as c0 from trained_in as t0 join procedures as t1 on t0.treatment = t1.code where t1.code = 2) as anon_1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "hospital_1",
"sql": "select anon_1.c1, anon_1.c0 from (select treatment as c1, physician as c0 from trained_in except select t0.treatment as c1, t0.physician as c0 from trained_in as t0 join procedures as t1 on t0.treatment = t1.code where t1.code = 2) as anon_1"
},
"style": ... | {
"index": 742,
"split": "train"
} | |
Which lot IDs, their details, and investor IDs are associated with lots that have IDs greater than 8, along with their related transaction IDs? | tracking_share_transactions | select t0.lot_id, t0.lot_details, t0.investor_id, t1.transaction_id from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id where t1.lot_id > 8 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select t0.lot_id, t0.lot_details, t0.investor_id, t1.transaction_id from lots as t0 join transactions_lots as t1 on t0.lot_id = t1.lot_id where t1.lot_id > 8"
},
"style": "rule"
} | {
"index": 1267,
"split": "train"
} | |
What are the colors, grape types, wine numbers, and prices of wines that come from appellations located in areas containing "A" or starting with "Central Valley"? | wine_1 | select t0.color, t0.grape, t1.no, t1.price from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.area like '%A%' or t2.area like 'Central Valley%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "wine_1",
"sql": "select t0.color, t0.grape, t1.no, t1.price from grapes as t0 join wine as t1 on t0.grape = t1.grape join appellations as t2 on t1.appelation = t2.appelation where t2.area like '%A%' or t2.area like 'Central Valley%'"
},
"style": "rule"
} | {
"index": 482,
"split": "train"
} | |
How many documents in the system are classified as Paper? | cre_Doc_Control_Systems | select count(*) from documents where document_type_code = 'Paper' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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(*) from documents where document_type_code = 'Paper'"
},
"style": "rule"
} | {
"index": 2870,
"split": "train"
} | |
Is the smallest staff ID who recorded a fault for asset 8 less than 10? | assets_maintenance | select t0.c1 < 10 from (select min(t1.recorded_by_staff_id) as c1 from assets as t0 join fault_log as t1 on t0.asset_id = t1.asset_id where t0.asset_id = 8 group by t0.asset_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": "assets_maintenance",
"sql": "select t0.c1 < 10 from (select min(t1.recorded_by_staff_id) as c1 from assets as t0 join fault_log as t1 on t0.asset_id = t1.asset_id where t0.asset_id = 8 group by t0.asset_id) as t0"
},
"style": "rule"
} | {
"index": 3328,
"split": "train"
} | |
Which are the most recent three entries of team year, rank, and "Ra" for parks whose names contain "nedy," ordered by year from newest to oldest? | baseball_1 | select t0.year as c1, t0.rank, t0.ra from team as t0 join home_game as t1 on t0.team_id = t1.team_id join park as t2 on t1.park_id = t2.park_id where t2.park_name like '%nedy%' order by c1 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "baseball_1",
"sql": "select t0.year as c1, t0.rank, t0.ra from team as t0 join home_game as t1 on t0.team_id = t1.team_id join park as t2 on t1.park_id = t2.park_id where t2.park_name like '%nedy%' order by c1 desc limit 3"
},
"style": "rule"
} | {
"index": 1888,
"split": "train"
} | |
Which players, along with their teams and years played, appear in match seasons where the player is 'Steve Ralston Category:Articles with hCards'? For each, what is the team name and team ID, when sorted by team ID from lowest to highest, and showing only the first five results? | match_season | select t0.player, t0.team, t0.years_played, t1.name, t1.team_id as c1 from player as t0 join team as t1 on t0.team = t1.team_id join match_season as t2 on t1.team_id = t2.team where t2.player = 'Steve Ralston Category:Articles with hCards' order by c1 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "match_season",
"sql": "select t0.player, t0.team, t0.years_played, t1.name, t1.team_id as c1 from player as t0 join team as t1 on t0.team = t1.team_id join match_season as t2 on t1.team_id = t2.team where t2.player = 'Steve Ralston Category:Articles with hCards' order by c1 asc n... | {
"index": 2977,
"split": "train"
} | |
Who is the customer with the highest customer ID who has ordered a product named 'music'? Please provide their customer ID, customer details, the status of their order items, and the product ID for the music they ordered. | tracking_orders | select t0.customer_id as c2, t0.customer_details, t2.order_item_status, t2.product_id 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 = 'music' order by c2 desc limit ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_orders",
"sql": "select t0.customer_id as c2, t0.customer_details, t2.order_item_status, t2.product_id 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.... | {
"index": 2667,
"split": "train"
} | |
Which three founders with the names later in the alphabet have the highest revenue, and what is each founder's maximum revenue? | manufactory_1 | select founder as c0, max(revenue) from manufacturers group by c0 order by c0 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "manufactory_1",
"sql": "select founder as c0, max(revenue) from manufacturers group by c0 order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 1716,
"split": "train"
} | |
What are the elevation, airport ID, and airline ID for the first five airports with routes to destination airport 'HW', ordered by elevation with airports lacking city information listed last? | flight_4 | select t0.elevation, t0.apid, t1.alid from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.dst_ap = 'HW' order by t0.city asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_4",
"sql": "select t0.elevation, t0.apid, t1.alid from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.dst_ap = 'HW' order by t0.city asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 1283,
"split": "train"
} | |
How many unique documents of type 'CD' are there in the system? | cre_Doc_Control_Systems | select t0.c2 from (select count(distinct (t1.document_id)) as c2 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'CD' group by t0.document_type_code) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Control_Systems",
"sql": "select t0.c2 from (select count(distinct (t1.document_id)) as c2 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t0.document_type_code = 'CD' group by t0.document_type_code) as t0"
},
... | {
"index": 3364,
"split": "train"
} | |
What is the percentage change in the sum of the minimum customer IDs for all customers who ordered on September 1st, 1976, compared to those who ordered on May 10th, 1971? | tracking_orders | select (sum(t0.c1) / cast(sum(t1.c1) as real) - 1) * 100 from (select min(t1.customer_id) as c1 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t1.date_order_placed = '1976-09-01 09:27:00' group by t0.customer_id) as t0, (select t0.customer_id, min(t1.customer_id) as c1 from customers 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": "tracking_orders",
"sql": "select (sum(t0.c1) / cast(sum(t1.c1) as real) - 1) * 100 from (select min(t1.customer_id) as c1 from customers as t0 join orders as t1 on t0.customer_id = t1.customer_id where t1.date_order_placed = '1976-09-01 09:27:00' group by t0.customer_id) as t0, (... | {
"index": 3056,
"split": "train"
} | |
What is the percentage change in the maximum grant IDs associated with documents received on October 4, 1976, and January 19, 1990, across all document types? | tracking_grants_for_research | select (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select max(t1.grant_id) as c0 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.response_received_date = '1990-01-19 19:57:14' group by t0.document_type_code) as t0, (select t0.document_type_code, max(t... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select (min(t0.c0) / cast(min(t1.c0) as real) - 1) * 100 from (select max(t1.grant_id) as c0 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.response_received_date = '1990-01-19 19:57:... | {
"index": 3809,
"split": "train"
} | |
For each school, identified by its School ID, how many unique counties does it belong to, how many times does its School ID appear, and what is the total number of records associated with it? | school_finance | select school_id as c0, count(distinct (county)), count(school_id), count(*) from school 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": "school_finance",
"sql": "select school_id as c0, count(distinct (county)), count(school_id), count(*) from school group by c0"
},
"style": "rule"
} | {
"index": 1752,
"split": "train"
} | |
Which pilot ID is the highest among those with ID 4 or 3 in the pilot record? | pilot_record | select pilot_id as c0 from pilot_record where c0 = 4 or c0 = 3 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": "pilot_record",
"sql": "select pilot_id as c0 from pilot_record where c0 = 4 or c0 = 3 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 1145,
"split": "train"
} | |
Can you tell me the descriptions and managers of buildings that have at least one apartment with a room count starting with the digit '8'? | apartment_rentals | select t0.building_description, t0.building_manager from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.room_count like '8%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "apartment_rentals",
"sql": "select t0.building_description, t0.building_manager from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.room_count like '8%'"
},
"style": "rule"
} | {
"index": 2494,
"split": "train"
} | |
Find the first dorm amenity ID and name for amenities related to "Heat," ordering the results alphabetically by their names. | dorm_1 | select amenid, amenity_name as c1 from dorm_amenity where c1 like '%Heat%' order by c1 asc nulls last limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "dorm_1",
"sql": "select amenid, amenity_name as c1 from dorm_amenity where c1 like '%Heat%' order by c1 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 1662,
"split": "train"
} | |
Find the origin, launch year, and program ID of programs that are broadcast on channels with a market share of 3.76% or less and also aired on channels whose names include "-1". | program_share | select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.origin as c0, t0.launch as c2, t0.program_id as c1 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 <= 3.76 intersect select t0.origin as c0, t0.launch as c2, t0.p... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.origin as c0, t0.launch as c2, t0.program_id as c1 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... | {
"index": 1974,
"split": "train"
} | |
What is the rank of the train with ID 8 when trains are ordered from highest to lowest train number? | station_weather | select t1.c4, t1.c1 as c0 from (select row_number() over (order by train_number desc) as c4, id as c1 from train) as t1 where c0 = 8 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "station_weather",
"sql": "select t1.c4, t1.c1 as c0 from (select row_number() over (order by train_number desc) as c4, id as c1 from train) as t1 where c0 = 8"
},
"style": "rule"
} | {
"index": 3503,
"split": "train"
} | |
How many different countries with IDs up to 73 are represented in the database? | sakila_1 | select count(distinct (t0.country)) from country as t0 join city as t1 on t0.country_id = t1.country_id where t1.country_id <= 73 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "sakila_1",
"sql": "select count(distinct (t0.country)) from country as t0 join city as t1 on t0.country_id = t1.country_id where t1.country_id <= 73"
},
"style": "rule"
} | {
"index": 779,
"split": "train"
} | |
What are the payment method code and phone number for parties with party IDs of 6 or 8? | e_government | select t0.payment_method_code, t0.party_phone from parties as t0 join party_forms as t1 on t0.party_id = t1.party_id where t1.party_id = 6 or t1.party_id = 8 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_government",
"sql": "select t0.payment_method_code, t0.party_phone from parties as t0 join party_forms as t1 on t0.party_id = t1.party_id where t1.party_id = 6 or t1.party_id = 8"
},
"style": "rule"
} | {
"index": 2685,
"split": "train"
} | |
How does the injury accident with id 11 rank in order of most recent to oldest based on game ID? | game_injury | select t1.c3, t1.c1 as c4 from (select row_number() over (order by game_id desc) as c3, id as c1 from injury_accident) as t1 where c4 = 11 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "game_injury",
"sql": "select t1.c3, t1.c1 as c4 from (select row_number() over (order by game_id desc) as c3, id as c1 from injury_accident) as t1 where c4 = 11"
},
"style": "rule"
} | {
"index": 3488,
"split": "train"
} | |
Which phone's chip model, hardware model name, and screen mode has the most recent entry among those with chip models ending either with "Standard" or "5," sorted in reverse alphabetical order of the chip model? | phone_1 | select chip_model as c1, hardware_model_name, screen_mode from phone where c1 like '%Standard' or c1 like '%5' order by c1 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "phone_1",
"sql": "select chip_model as c1, hardware_model_name, screen_mode from phone where c1 like '%Standard' or c1 like '%5' order by c1 desc limit 1"
},
"style": "rule"
} | {
"index": 453,
"split": "train"
} | |
What is the percentage change in the number of customers with IDs under 31 who had their move-in date on March 27, 2015, in terms of their highest property IDs? | local_govt_and_lot | select (count(t0.c0) / cast(count(t0.c0) as real) - 1) * 100 from (select max(t1.property_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t1.date_moved_in = '2015-03-27 12:00:00' and t1.customer_id < 31 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 (count(t0.c0) / cast(count(t0.c0) as real) - 1) * 100 from (select max(t1.property_id) as c0 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t1.date_moved_in = '2015-03-27 12:00:00' and t1.customer_id < ... | {
"index": 3039,
"split": "train"
} | |
Which players' years played and team names are recorded, excluding those who played for teams in the United States? | match_season | select anon_1.c1, anon_1.c0 from (select years_played as c1, team as c0 from player except select t0.years_played as c1, t0.team as c0 from player as t0 join team as t1 on t0.team = t1.team_id join match_season as t2 on t1.team_id = t2.team join country as t3 on t2.country = t3.country_id where t3.country_name = 'Unite... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "match_season",
"sql": "select anon_1.c1, anon_1.c0 from (select years_played as c1, team as c0 from player except select t0.years_played as c1, t0.team as c0 from player as t0 join team as t1 on t0.team = t1.team_id join match_season as t2 on t1.team_id = t2.team join country as ... | {
"index": 324,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.