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 three smallest Product Ids, along with their minimum Order Ids and the product price, for hardware products (product type codes starting with "Hardware"), sorted by Product Id? | department_store | select min(t0.product_id), min(t0.order_id), t1.product_price from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_type_code like 'Hardware%' group by t1.product_id order by t1.product_id asc nulls last limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select min(t0.product_id), min(t0.order_id), t1.product_price from order_items as t0 join products as t1 on t0.product_id = t1.product_id where t1.product_type_code like 'Hardware%' group by t1.product_id order by t1.product_id asc nulls last limit 3"
... | {
"index": 915,
"split": "train"
} | |
Which medicine with an inhibitor interaction is the first to be FDA approved or not, when sorted alphabetically by their approval status? | medicine_enzyme_interaction | select t0.fda_approved as c0 from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.interaction_type = 'inhibitor' 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": "medicine_enzyme_interaction",
"sql": "select t0.fda_approved as c0 from medicine as t0 join medicine_enzyme_interaction as t1 on t0.id = t1.medicine_id where t1.interaction_type = 'inhibitor' order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2482,
"split": "train"
} | |
What is the percentage change in the number of guests who booked an apartment on February 11, 2017, compared to those who booked on June 7, 2016? | apartment_rentals | select (count(t0.c1) / cast(count(t1.c1) as real) - 1) * 100 from (select min(t1.guest_id) as c1 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where t1.booking_start_date = '2016-06-07 05:05:18' group by t0.guest_id) as t0, (select t0.guest_id, min(t1.guest_id) as c1 from guests as t0 joi... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "apartment_rentals",
"sql": "select (count(t0.c1) / cast(count(t1.c1) as real) - 1) * 100 from (select min(t1.guest_id) as c1 from guests as t0 join apartment_bookings as t1 on t0.guest_id = t1.guest_id where t1.booking_start_date = '2016-06-07 05:05:18' group by t0.guest_id) as t... | {
"index": 3967,
"split": "train"
} | |
Retrieve the points and country for all climbers, as well as for climbers who have ascended mountains located in countries that contain the letter 'n'. | climbing | select anon_1.c1, anon_1.c0 from (select points as c1, country as c0 from climber union select t0.points as c1, t0.country as c0 from climber as t0 join mountain as t1 on t0.mountain_id = t1.mountain_id where t1.country like '%n%') 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": "climbing",
"sql": "select anon_1.c1, anon_1.c0 from (select points as c1, country as c0 from climber union select t0.points as c1, t0.country as c0 from climber as t0 join mountain as t1 on t0.mountain_id = t1.mountain_id where t1.country like '%n%') as anon_1"
},
"style": "r... | {
"index": 776,
"split": "train"
} | |
Is the departure time of train 2 earlier than that of train 5? | station_weather | select t1.c1 < t0.c1 from (select time as c1 from train where id = 2) as t1, (select time as c1 from train where id = 5) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "station_weather",
"sql": "select t1.c1 < t0.c1 from (select time as c1 from train where id = 2) as t1, (select time as c1 from train where id = 5) as t0"
},
"style": "rule"
} | {
"index": 3145,
"split": "train"
} | |
Which employee's role and name, along with the copy number and document ID, are associated with a document that has either the most common document status or has been mailed, specifically the one with the lowest document ID? | cre_Doc_Control_Systems | select t0.role_code, t0.employee_name, t2.copy_number, t2.document_id as c2 from employees as t0 join circulation_history as t1 on t0.employee_id = t1.employee_id join draft_copies as t2 on t1.document_id = t2.document_id join document_drafts as t3 on t2.document_id = t3.document_id join documents as t4 on t3.document_... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.role_code, t0.employee_name, t2.copy_number, t2.document_id as c2 from employees as t0 join circulation_history as t1 on t0.employee_id = t1.employee_id join draft_copies as t2 on t1.document_id = t2.document_id join document_drafts as ... | {
"index": 593,
"split": "train"
} | |
What is the office location, highest degree, and department name of a professor who teaches in a department with students whose phone numbers either end with "256" or start with "2267," sorted alphabetically by the professor’s office location? | college_1 | select t0.prof_office as c0, t0.prof_high_degree, t1.dept_name from professor as t0 join department as t1 on t0.dept_code = t1.dept_code join student as t2 on t1.dept_code = t2.dept_code where t2.stu_phone like '%256' or t2.stu_phone like '2267%' 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": "college_1",
"sql": "select t0.prof_office as c0, t0.prof_high_degree, t1.dept_name from professor as t0 join department as t1 on t0.dept_code = t1.dept_code join student as t2 on t1.dept_code = t2.dept_code where t2.stu_phone like '%256' or t2.stu_phone like '2267%' order by c0 a... | {
"index": 717,
"split": "train"
} | |
List the operating systems, their IDs, and the corresponding accelerator IDs for web accelerators that are compatible with browsers having IDs 3 or 4. | browser_web | select t0.operating_system, t0.id, t1.accelerator_id from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id where t1.browser_id = 3 or t1.browser_id = 4 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "browser_web",
"sql": "select t0.operating_system, t0.id, t1.accelerator_id from web_client_accelerator as t0 join accelerator_compatible_browser as t1 on t0.id = t1.accelerator_id where t1.browser_id = 3 or t1.browser_id = 4"
},
"style": "rule"
} | {
"index": 38,
"split": "train"
} | |
What are the shipment date, shipment tracking number, and order ID for orders placed after December 9, 1982, at 09:42:23? | tracking_orders | select t0.shipment_date, t0.shipment_tracking_number, t0.order_id from shipments as t0 join orders as t1 on t0.order_id = t1.order_id where t1.date_order_placed > '1982-12-09 09:42:23' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.shipment_date, t0.shipment_tracking_number, t0.order_id from shipments as t0 join orders as t1 on t0.order_id = t1.order_id where t1.date_order_placed > '1982-12-09 09:42:23'"
},
"style": "rule"
} | {
"index": 2392,
"split": "train"
} | |
Is the highest student ID of students who received a C+ grade less than 1019? | college_3 | select t0.c0 < 1019 from (select max(t1.stuid) as c0 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t0.lettergrade = 'C+' group by t0.lettergrade) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "college_3",
"sql": "select t0.c0 < 1019 from (select max(t1.stuid) as c0 from gradeconversion as t0 join enrolled_in as t1 on t0.lettergrade = t1.grade where t0.lettergrade = 'C+' group by t0.lettergrade) as t0"
},
"style": "rule"
} | {
"index": 3331,
"split": "train"
} | |
Can you tell me the elevation, y-coordinate, and city of the first 10 airports that serve as source airports in routes with IDs greater than 2219, ordered by route ID? | flight_4 | select t0.elevation, t0.y, t0.city from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.src_apid > 2219 order by t1.alid asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_4",
"sql": "select t0.elevation, t0.y, t0.city from airports as t0 join routes as t1 on t0.apid = t1.src_apid where t1.src_apid > 2219 order by t1.alid asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 2758,
"split": "train"
} | |
Which are the top 10 companies, listed in reverse alphabetical order, that have offices either located in building number 5 or in buildings that are not listed in the buildings database? | company_office | select t0.name as c0 from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.building_id = 5 or (not t1.building_id in (select buildings.id as c1 from buildings)) 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 from companies as t0 join office_locations as t1 on t0.id = t1.company_id where t1.building_id = 5 or (not t1.building_id in (select buildings.id as c1 from buildings)) order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 1795,
"split": "train"
} | |
Can you tell me the five services with the highest service IDs, including the total number of relevant customers (those with ID 2 or between 5 and 14) linked to each service? Please list them ordered by service name from Z to A. | e_government | select t0.service_id as c0, sum(t1.customer_id) from services as t0 join party_services as t1 on t0.service_id = t1.service_id where t1.customer_id = 2 or t1.customer_id between 5 and 14 group by c0 order by t0.service_name desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_government",
"sql": "select t0.service_id as c0, sum(t1.customer_id) from services as t0 join party_services as t1 on t0.service_id = t1.service_id where t1.customer_id = 2 or t1.customer_id between 5 and 14 group by c0 order by t0.service_name desc limit 5"
},
"style": "ru... | {
"index": 1083,
"split": "train"
} | |
Which students live in the most common zip code, and what are their address IDs, monthly rental amounts, and cities? | behavior_monitoring | select distinct t0.address_id, t0.student_id, t0.monthly_rental, t1.city from student_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id, (select zip_postcode as c2 from addresses group by c2 order by count(*) desc limit 1) as t0 where t1.zip_postcode = t0.c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "behavior_monitoring",
"sql": "select distinct t0.address_id, t0.student_id, t0.monthly_rental, t1.city from student_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id, (select zip_postcode as c2 from addresses group by c2 order by count(*) desc limit 1) as t0 w... | {
"index": 1930,
"split": "train"
} | |
What are the descriptions, locations, IDs of the first five clubs, along with the positions of female students with advisors greater than 7792, sorted by club ID? | club_1 | select t0.clubdesc, t0.clublocation, t0.clubid, t1.position, t1.clubid as c4 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid join student as t2 on t1.stuid = t2.stuid where t2.advisor > 7792 and t2.sex like 'F%' order by c4 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": "club_1",
"sql": "select t0.clubdesc, t0.clublocation, t0.clubid, t1.position, t1.clubid as c4 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid join student as t2 on t1.stuid = t2.stuid where t2.advisor > 7792 and t2.sex like 'F%' order by c4 asc nulls last limit... | {
"index": 243,
"split": "train"
} | |
Which five document types and their descriptions had responses received before February 24, 1980, and are listed in reverse alphabetical order by their description? | tracking_grants_for_research | select t0.document_type_code, t0.document_description as c1 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.response_received_date < '1980-02-24 15:23:44' order by c1 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_grants_for_research",
"sql": "select t0.document_type_code, t0.document_description as c1 from document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.response_received_date < '1980-02-24 15:23:44' order by c1 desc limit 5"
}... | {
"index": 2079,
"split": "train"
} | |
Which accuracy percentages are associated with groups of schools where there are at most two schools in each group, considering only matches where the home team ends with '–1'? | university_basketball | select acc_percent as c0, count(distinct (school_id)) from basketball_match where all_home like '%–1' group by c0 having count(distinct (school_id)) <= 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": "university_basketball",
"sql": "select acc_percent as c0, count(distinct (school_id)) from basketball_match where all_home like '%–1' group by c0 having count(distinct (school_id)) <= 2"
},
"style": "rule"
} | {
"index": 1799,
"split": "train"
} | |
For each station located in a city ending with "Alto," what is the highest number of bikes available at any point, along with that station's latitude and ID? | bike_1 | select max(t0.bikes_available), t1.lat, t1.id as c2 from status as t0 join station as t1 on t0.station_id = t1.id where t1.city like '%Alto' group by c2 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "bike_1",
"sql": "select max(t0.bikes_available), t1.lat, t1.id as c2 from status as t0 join station as t1 on t0.station_id = t1.id where t1.city like '%Alto' group by c2"
},
"style": "rule"
} | {
"index": 1776,
"split": "train"
} | |
Can you give me the temperatures for October, June, and February, along with the city name, for cities that have hosted events in cities with '2' in their names? | city_record | select t0.oct, t0.jun, t0.feb, t1.city from temperature as t0 join city as t1 on t0.city_id = t1.city_id join hosting_city as t2 on t1.city_id = t2.host_city where t2.host_city like '%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": "city_record",
"sql": "select t0.oct, t0.jun, t0.feb, t1.city from temperature as t0 join city as t1 on t0.city_id = t1.city_id join hosting_city as t2 on t1.city_id = t2.host_city where t2.host_city like '%2%'"
},
"style": "rule"
} | {
"index": 638,
"split": "train"
} | |
What are the customer IDs and checking balances for all customers, including those whose names contain "rt"? | small_bank_1 | select anon_1.c0, anon_1.c1 from (select custid as c0, balance as c1 from checking union select t0.custid as c0, t0.balance as c1 from checking as t0 join accounts as t1 on t0.custid = t1.custid where t1.name like '%rt%') 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": "small_bank_1",
"sql": "select anon_1.c0, anon_1.c1 from (select custid as c0, balance as c1 from checking union select t0.custid as c0, t0.balance as c1 from checking as t0 join accounts as t1 on t0.custid = t1.custid where t1.name like '%rt%') as anon_1"
},
"style": "rule"
} | {
"index": 1840,
"split": "train"
} | |
How much lower is the maximum person ID for person 151 at address 92 compared to the lowest maximum person ID found across all addresses? | student_assessment | select t2.c1 - t0.c2 from (select min(t1.c2) as c1 from (select max(t1.person_id) as c2 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id group by t0.address_id) as t1) as t2, (select t0.address_id, max(t1.person_id) as c2 from addresses as t0 join people_addresses as t1 on t0.address_id... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "student_assessment",
"sql": "select t2.c1 - t0.c2 from (select min(t1.c2) as c1 from (select max(t1.person_id) as c2 from addresses as t0 join people_addresses as t1 on t0.address_id = t1.address_id group by t0.address_id) as t1) as t2, (select t0.address_id, max(t1.person_id) as... | {
"index": 3203,
"split": "train"
} | |
List the publishers of the five publications with the most recent book IDs. | book_2 | select publisher from publication order by book_id desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "book_2",
"sql": "select publisher from publication order by book_id desc limit 5"
},
"style": "rule"
} | {
"index": 1566,
"split": "train"
} | |
What are the names, IDs, and total number of departments for the top three department store chains, listed in reverse alphabetical order by their names? | department_store | select t0.dept_store_chain_name as c2, t0.dept_store_chain_id as c0, sum(t2.dept_store_id) from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id join departments as t2 on t1.dept_store_id = t2.dept_store_id group by c0 order by c2 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select t0.dept_store_chain_name as c2, t0.dept_store_chain_id as c0, sum(t2.dept_store_id) from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id join departments as t2 on t1.dept_store_id = t2.... | {
"index": 765,
"split": "train"
} | |
Which are the top 3 channels with program ID 4 that have the highest ratings in percent, including their Channel ID, Name, and Rating? | program_share | select t0.channel_id, t0.name, t0.rating_in_percent as c1 from channel as t0 join broadcast as t1 on t0.channel_id = t1.channel_id join program as t2 on t1.program_id = t2.program_id where t2.program_id = 4 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": "program_share",
"sql": "select t0.channel_id, t0.name, t0.rating_in_percent as c1 from channel as t0 join broadcast as t1 on t0.channel_id = t1.channel_id join program as t2 on t1.program_id = t2.program_id where t2.program_id = 4 order by c1 desc limit 3"
},
"style": "rule"
... | {
"index": 2894,
"split": "train"
} | |
Did the percentage increase or decrease in the number of projects led by the 'leader' role between May 30, 1985, and September 22, 1985, surpass the greatest percentage change observed among all other staff roles during the same period? | tracking_grants_for_research | select t5.c4 > t2.c0 from (select abs((t3.c3 / cast(t4.c3 as real) - 1) * 100) as c4 from (select sum(t1.project_id) as c3 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'leader' and t1.date_to = '1985-09-22 09:06:08' group by t0.role_code) as t3, (select sum(t1.proj... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t5.c4 > t2.c0 from (select abs((t3.c3 / cast(t4.c3 as real) - 1) * 100) as c4 from (select sum(t1.project_id) as c3 from staff_roles as t0 join project_staff as t1 on t0.role_code = t1.role_code where t0.role_code = 'leader' and t1.da... | {
"index": 3448,
"split": "train"
} | |
Which are the top three airports, among those located in cities starting with "W" or containing the letter "a," that have the highest average destination airport ID for their routes? | flight_4 | select avg(t0.src_apid), t1.apid as c0 from routes as t0 join airports as t1 on t0.src_apid = t1.apid where t1.city like 'W%' or t1.city like '%a%' group by c0 order by avg(t0.dst_apid) 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": "flight_4",
"sql": "select avg(t0.src_apid), t1.apid as c0 from routes as t0 join airports as t1 on t0.src_apid = t1.apid where t1.city like 'W%' or t1.city like '%a%' group by c0 order by avg(t0.dst_apid) desc limit 3"
},
"style": "rule"
} | {
"index": 418,
"split": "train"
} | |
Is the number of unique documents shipped by the agent with code 'SH' less than 6? | cre_Doc_Control_Systems | select t0.c2 < 6 from (select count(distinct (t1.document_id)) as c2 from ref_shipping_agents as t0 join documents as t1 on t0.shipping_agent_code = t1.shipping_agent_code where t0.shipping_agent_code = 'SH' group by t0.shipping_agent_code) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Control_Systems",
"sql": "select t0.c2 < 6 from (select count(distinct (t1.document_id)) as c2 from ref_shipping_agents as t0 join documents as t1 on t0.shipping_agent_code = t1.shipping_agent_code where t0.shipping_agent_code = 'SH' group by t0.shipping_agent_code) as t0... | {
"index": 3333,
"split": "train"
} | |
Which are the three products with the lowest product IDs that are either called something ending with "Americano" or starting with "Lat," along with their product details and IDs? | customers_and_addresses | select min(t0.product_id) as c0, t1.product_details as c1, t1.product_id as c2 from order_items as t0 join products as t1 on t0.product_id = t1.product_id where c1 like '%Americano' or c1 like 'Lat%' group by c2 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": "customers_and_addresses",
"sql": "select min(t0.product_id) as c0, t1.product_details as c1, t1.product_id as c2 from order_items as t0 join products as t1 on t0.product_id = t1.product_id where c1 like '%Americano' or c1 like 'Lat%' group by c2 order by c0 asc nulls last limit 3... | {
"index": 2976,
"split": "train"
} | |
What is the difference between 120 and the highest customer ID associated with complaints for product 118? | customer_complaints | select t0.c0 - 120 from (select max(t1.customer_id) as c0 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 group by t0.product_id) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select t0.c0 - 120 from (select max(t1.customer_id) as c0 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t0.product_id = 118 group by t0.product_id) as t0"
},
"style": "rule"
} | {
"index": 3222,
"split": "train"
} | |
Which language appears last when the countries are sorted alphabetically by their languages, and what is that language? | roller_coaster | select languages as c0 from country 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": "roller_coaster",
"sql": "select languages as c0 from country order by c0 asc nulls last limit 1"
},
"style": "rule"
} | {
"index": 2627,
"split": "train"
} | |
What are the room count, apartment type code, bathroom count, and apartment ID for apartments booked by guests whose gender code starts with "Fe"? | apartment_rentals | select t0.room_count, t0.apt_type_code, t0.bathroom_count, t1.apt_id from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.gender_code like 'Fe%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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.room_count, t0.apt_type_code, t0.bathroom_count, t1.apt_id from apartments as t0 join apartment_bookings as t1 on t0.apt_id = t1.apt_id join guests as t2 on t1.guest_id = t2.guest_id where t2.gender_code like 'Fe%'"
},
"style": "rule"
} | {
"index": 1865,
"split": "train"
} | |
What are the status codes of things and their service details for organization number 10? | local_govt_and_lot | select t0.status_of_thing_code, t1.service_details from timed_status_of_things as t0 join things as t1 on t0.thing_id = t1.thing_id where t1.organization_id = 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": "local_govt_and_lot",
"sql": "select t0.status_of_thing_code, t1.service_details from timed_status_of_things as t0 join things as t1 on t0.thing_id = t1.thing_id where t1.organization_id = 10"
},
"style": "rule"
} | {
"index": 1021,
"split": "train"
} | |
What are the team, age, and starting year of all technicians, including those assigned to machines with series ending in "125"? | machine_repair | select anon_1.c0, anon_1.c1, anon_1.c2 from (select team as c0, age as c1, starting_year as c2 from technician union select t0.team as c0, t0.age as c1, t0.starting_year as c2 from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.technician_id join machine as t2 on t1.machine_id = t2.machine_id wh... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "machine_repair",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select team as c0, age as c1, starting_year as c2 from technician union select t0.team as c0, t0.age as c1, t0.starting_year as c2 from technician as t0 join repair_assignment as t1 on t0.technician_id = t1.tec... | {
"index": 950,
"split": "train"
} | |
Who are the ten aircrafts with the lowest IDs that are certified to employees earning between 20 and 289,950, and what are their distances and the IDs of those employees? | flight_1 | select t0.aid as c0, t0.distance, t1.eid from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid where t2.salary between 20 and 289950 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": "flight_1",
"sql": "select t0.aid as c0, t0.distance, t1.eid from aircraft as t0 join certificate as t1 on t0.aid = t1.aid join employee as t2 on t1.eid = t2.eid where t2.salary between 20 and 289950 order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 2067,
"split": "train"
} | |
What is the percentage change in the smallest number of employees born on July 4, 1977, compared to August 3, 1988, across all roles? | cre_Doc_Tracking_DB | select (min(t0.c1) / cast(min(t1.c1) as real) - 1) * 100 from (select count(distinct (t1.employee_id)) as c1 from roles as t0 join employees as t1 on t0.role_code = t1.role_code where t1.date_of_birth = '1977-07-04 16:25:21' group by t0.role_code) as t0, (select t0.role_code, count(distinct (t1.employee_id)) as c1 from... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Tracking_DB",
"sql": "select (min(t0.c1) / cast(min(t1.c1) as real) - 1) * 100 from (select count(distinct (t1.employee_id)) as c1 from roles as t0 join employees as t1 on t0.role_code = t1.role_code where t1.date_of_birth = '1977-07-04 16:25:21' group by t0.role_code) as... | {
"index": 3011,
"split": "train"
} | |
Can you tell me the details of the top three dormitories with the highest dorm IDs, including their IDs, capacities, and gender restrictions, where the dorms have amenities that are either not listed in the dorm amenities catalog or have amenity IDs less than or equal to 955? | dorm_1 | select t0.dormid, t0.student_capacity, t0.gender, t1.dormid as c0 from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where (not t1.amenid in (select dorm_amenity.amenid as c2 from dorm_amenity)) or t1.amenid <= 955 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": "dorm_1",
"sql": "select t0.dormid, t0.student_capacity, t0.gender, t1.dormid as c0 from dorm as t0 join has_amenity as t1 on t0.dormid = t1.dormid where (not t1.amenid in (select dorm_amenity.amenid as c2 from dorm_amenity)) or t1.amenid <= 955 order by c0 desc limit 3"
},
"s... | {
"index": 447,
"split": "train"
} | |
Which lot ID most frequently appears among shares owned by investors with an ID greater than 19? | tracking_share_transactions | select t0.c1 as c2, count(distinct (t0.c1)) as c0 from (select lot_id as c1 from lots where investor_id > 19) as t0 group by c2 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": "tracking_share_transactions",
"sql": "select t0.c1 as c2, count(distinct (t0.c1)) as c0 from (select lot_id as c1 from lots where investor_id > 19) as t0 group by c2 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 3661,
"split": "train"
} | |
List the titles, directors, and film IDs of up to ten films that are screened in cinemas with a capacity of either exactly 325 or up to 364, sorted in reverse alphabetical order by title. | cinema | select t0.title as c0, t0.directed_by, t0.film_id from film as t0 join schedule as t1 on t0.film_id = t1.film_id join cinema as t2 on t1.cinema_id = t2.cinema_id where t2.capacity = 325 or t2.capacity <= 364 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": "cinema",
"sql": "select t0.title as c0, t0.directed_by, t0.film_id from film as t0 join schedule as t1 on t0.film_id = t1.film_id join cinema as t2 on t1.cinema_id = t2.cinema_id where t2.capacity = 325 or t2.capacity <= 364 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 1371,
"split": "train"
} | |
How many film market estimations are there in the database? | film_rank | select count(*) from film_market_estimation | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "film_rank",
"sql": "select count(*) from film_market_estimation"
},
"style": "rule"
} | {
"index": 720,
"split": "train"
} | |
What is the percentage change in the average customer address ID per address between November 30, 2016, and April 16, 2017? | driving_school | select (count(t0.c1) / cast(count(t1.c1) as real) - 1) * 100 from (select avg(t1.customer_address_id) as c1 from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id where t1.date_became_customer = '2016-11-30 10:37:41' group by t0.address_id) as t0, (select avg(t1.customer_address_id) as c1 f... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select (count(t0.c1) / cast(count(t1.c1) as real) - 1) * 100 from (select avg(t1.customer_address_id) as c1 from addresses as t0 join customers as t1 on t0.address_id = t1.customer_address_id where t1.date_became_customer = '2016-11-30 10:37:41' group by ... | {
"index": 3030,
"split": "train"
} | |
Who are the first five employees, sorted alphabetically by name, who are certified with employee IDs 141582651 or 574489457? | flight_1 | select t0.name as c0 from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 141582651 or t1.eid = 574489457 order by c0 asc nulls last limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_1",
"sql": "select t0.name as c0 from employee as t0 join certificate as t1 on t0.eid = t1.eid where t1.eid = 141582651 or t1.eid = 574489457 order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 433,
"split": "train"
} | |
Which three market IDs, where the maximum number of cities is between 212 and 453 and the country name starts with "Russia" or ends with "land," have the highest number of cities? | film_rank | select market_id as c1, max(number_cities) as c0 from market where country like 'Russia%' or country like '%land' group by c1 having max(number_cities) between 212 and 453 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": "film_rank",
"sql": "select market_id as c1, max(number_cities) as c0 from market where country like 'Russia%' or country like '%land' group by c1 having max(number_cities) between 212 and 453 order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 275,
"split": "train"
} | |
Which are the top three assessments, showing the assessment outcome code, date, and candidate ID, for courses that are either the most frequently offered course or have names ending with "rench," sorted by assessment outcome code from Z to A? | student_assessment | select t0.asessment_outcome_code as c3, t0.assessment_date, t0.candidate_id from candidate_assessments as t0 join candidates as t1 on t0.candidate_id = t1.candidate_id join people as t2 on t1.candidate_id = t2.person_id join students as t3 on t2.person_id = t3.student_id join student_course_registrations as t4 on t3.st... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "student_assessment",
"sql": "select t0.asessment_outcome_code as c3, t0.assessment_date, t0.candidate_id from candidate_assessments as t0 join candidates as t1 on t0.candidate_id = t1.candidate_id join people as t2 on t1.candidate_id = t2.person_id join students as t3 on t2.perso... | {
"index": 1652,
"split": "train"
} | |
What is the highest transaction lot ID associated with lot 3, and what is the lot ID of lot 3 itself? | tracking_share_transactions | select max(t0.lot_id), t1.lot_id as c0 from transactions_lots as t0 join lots as t1 on t0.lot_id = t1.lot_id where c0 = 3 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": "tracking_share_transactions",
"sql": "select max(t0.lot_id), t1.lot_id as c0 from transactions_lots as t0 join lots as t1 on t0.lot_id = t1.lot_id where c0 = 3 group by c0"
},
"style": "rule"
} | {
"index": 255,
"split": "train"
} | |
Can you show me the top 10 tourist attractions with the highest average location IDs, among those whose average location ID is less than 661? | cre_Theme_park | select tourist_attraction_id as c0, avg(location_id) as c1 from tourist_attractions group by c0 having avg(location_id) < 661 order by c1 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Theme_park",
"sql": "select tourist_attraction_id as c0, avg(location_id) as c1 from tourist_attractions group by c0 having avg(location_id) < 661 order by c1 desc limit 10"
},
"style": "rule"
} | {
"index": 592,
"split": "train"
} | |
Which three artists are from the countries that come last in alphabetical order, are associated with genres whose ratings end with a "7" or are exactly 9, and what are their names and genders? | music_1 | select t0.country as c0, t0.artist_name, t0.gender 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 = 9 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": "music_1",
"sql": "select t0.country as c0, t0.artist_name, t0.gender 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 = 9 order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 195,
"split": "train"
} | |
Which ten bed types have the lowest average base prices, with each bed type's average being less than 150, and sorted from the cheapest upwards? | inn_1 | select bedtype as c0 from rooms group by c0 having avg(baseprice) < 150 order by avg(baseprice) 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": "inn_1",
"sql": "select bedtype as c0 from rooms group by c0 having avg(baseprice) < 150 order by avg(baseprice) asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 2252,
"split": "train"
} | |
List each department location that includes "rl" in its name along with the number of departments at each location. | company_1 | select dlocation as c0, count(dnumber) from dept_locations where c0 like '%rl%' 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": "company_1",
"sql": "select dlocation as c0, count(dnumber) from dept_locations where c0 like '%rl%' group by c0"
},
"style": "rule"
} | {
"index": 2754,
"split": "train"
} | |
What is the total high temperature recorded at stations belonging to either the most common network or the least common network? | station_weather | select sum(t0.high_temperature) from weekly_weather as t0 join station as t1 on t0.station_id = t1.id, (select network_name as c0 from station group by c0 order by count(*) desc limit 1) as t1, (select network_name as c0 from station group by c0 order by count(*) asc nulls last limit 1) as t0 where t1.network_name = 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": "station_weather",
"sql": "select sum(t0.high_temperature) from weekly_weather as t0 join station as t1 on t0.station_id = t1.id, (select network_name as c0 from station group by c0 order by count(*) desc limit 1) as t1, (select network_name as c0 from station group by c0 order by... | {
"index": 2398,
"split": "train"
} | |
Who are the ten customers with the highest customer IDs who have ordered products with IDs 12 or 13 or higher? | customers_and_invoices | select t0.customer_id as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.product_id >= 12 or t1.product_id >= 13 order by c0 desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select t0.customer_id as c0 from orders as t0 join order_items as t1 on t0.order_id = t1.order_id where t1.product_id >= 12 or t1.product_id >= 13 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 1842,
"split": "train"
} | |
How many clubs are listed in the database? | riding_club | select count(club_id) from club | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "riding_club",
"sql": "select count(club_id) from club"
},
"style": "rule"
} | {
"index": 1431,
"split": "train"
} | |
What is the route ID for the delivery route named Hegmann-Waters? | customer_deliveries | select t0.route_id from delivery_route_locations as t0 join delivery_routes as t1 on t0.route_id = t1.route_id where t1.route_name = 'Hegmann-Waters' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_deliveries",
"sql": "select t0.route_id from delivery_route_locations as t0 join delivery_routes as t1 on t0.route_id = t1.route_id where t1.route_name = 'Hegmann-Waters'"
},
"style": "rule"
} | {
"index": 93,
"split": "train"
} | |
Which are the top 10 vehicles, including their details and IDs, that were used in lesson 3 or in the most frequently scheduled lesson, ordered by the highest staff ID involved? | driving_school | select t0.vehicle_details, t0.vehicle_id as c0 from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id, (select lesson_id as c1 from lessons group by c1 order by count(*) desc limit 1) as t0 where t1.lesson_id = 3 or t1.lesson_id = t0.c1 group by c0 order by max(t1.staff_id) desc limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select t0.vehicle_details, t0.vehicle_id as c0 from vehicles as t0 join lessons as t1 on t0.vehicle_id = t1.vehicle_id, (select lesson_id as c1 from lessons group by c1 order by count(*) desc limit 1) as t0 where t1.lesson_id = 3 or t1.lesson_id = t0.c1 g... | {
"index": 1100,
"split": "train"
} | |
What are the different attribute IDs and attribute names listed in the Attribute Definitions? | product_catalog | select distinct attribute_id, attribute_name from attribute_definitions | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 distinct attribute_id, attribute_name from attribute_definitions"
},
"style": "rule"
} | {
"index": 298,
"split": "train"
} | |
What are the starting working years of managers whose names end with "ger Woods," sorted by the youngest age among them in descending order? | railway | select working_year_starts as c0 from manager where name like '%ger Woods' group by c0 order by min(age) 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": "railway",
"sql": "select working_year_starts as c0 from manager where name like '%ger Woods' group by c0 order by min(age) desc"
},
"style": "rule"
} | {
"index": 353,
"split": "train"
} | |
Show the distances recorded for either flights or aircrafts. | flight_1 | select anon_1.c1 from (select distance as c1 from flight union select distance from aircraft) 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": "flight_1",
"sql": "select anon_1.c1 from (select distance as c1 from flight union select distance from aircraft) as anon_1"
},
"style": "rule"
} | {
"index": 2492,
"split": "train"
} | |
What are the region code, name, and ID of the affected region with the highest region ID, where the storm that impacted it had no more than 7 deaths and a maximum wind speed of at least 972? | storm_record | select t0.region_code, t0.region_name, t1.region_id as c0 from region as t0 join affected_region as t1 on t0.region_id = t1.region_id join storm as t2 on t1.storm_id = t2.storm_id where t2.number_deaths <= 7 and t2.max_speed >= 972 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": "storm_record",
"sql": "select t0.region_code, t0.region_name, t1.region_id as c0 from region as t0 join affected_region as t1 on t0.region_id = t1.region_id join storm as t2 on t1.storm_id = t2.storm_id where t2.number_deaths <= 7 and t2.max_speed >= 972 order by c0 desc limit 1"... | {
"index": 1417,
"split": "train"
} | |
What is the percentage change of the smallest total property ID sum for all customers who moved in on September 27, 2016, with property IDs up to 108? | local_govt_and_lot | select (min(t0.c1) / cast(min(t0.c1) as real) - 1) * 100 from (select sum(t1.property_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t1.date_moved_in = '2016-09-27 12:00:00' and t1.property_id <= 108 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 (min(t0.c1) / cast(min(t0.c1) as real) - 1) * 100 from (select sum(t1.property_id) as c1 from customers as t0 join customer_events as t1 on t0.customer_id = t1.customer_id where t1.date_moved_in = '2016-09-27 12:00:00' and t1.property_id <= 108... | {
"index": 3038,
"split": "train"
} | |
What is the total flight distance, the average price, and the aircraft ID for aircrafts that have at least two flights with a distance of 6900 miles? | flight_1 | select sum(t0.distance), avg(t0.price), t1.aid as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.distance = 6900 group by c0 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": "flight_1",
"sql": "select sum(t0.distance), avg(t0.price), t1.aid as c0 from flight as t0 join aircraft as t1 on t0.aid = t1.aid where t1.distance = 6900 group by c0 having count(*) >= 2"
},
"style": "rule"
} | {
"index": 159,
"split": "train"
} | |
Which are the three dorm-amenity pairs with dorms whose names contain "ity" or end with "t Asylum", sorted by dorm ID from lowest to highest, showing the dorm IDs and amenity IDs? | dorm_1 | select t0.dormid as c0, t0.amenid, t1.dormid from has_amenity as t0 join dorm as t1 on t0.dormid = t1.dormid where t1.dorm_name like '%ity%' or t1.dorm_name like '%t Asylum' 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": "dorm_1",
"sql": "select t0.dormid as c0, t0.amenid, t1.dormid from has_amenity as t0 join dorm as t1 on t0.dormid = t1.dormid where t1.dorm_name like '%ity%' or t1.dorm_name like '%t Asylum' order by c0 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 2150,
"split": "train"
} | |
Which airport, identified by its Apid, has the highest Apid value among those where the maximum `x` is less than or equal to -131.814, the airport's `y` value is less than or equal to the total number of airports ending with "rt" in their name, and the country's name contains the letter "a"? | flight_4 | select t0.apid as c2, max(t0.x) as c0 from airports as t0, (select count(y) as c1 from airports where name like '%rt') as t0 where t0.y <= t0.c1 and t0.country like '%a%' group by c2 having c0 <= -131.813995361 order by c2 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_4",
"sql": "select t0.apid as c2, max(t0.x) as c0 from airports as t0, (select count(y) as c1 from airports where name like '%rt') as t0 where t0.y <= t0.c1 and t0.country like '%a%' group by c2 having c0 <= -131.813995361 order by c2 desc limit 1"
},
"style": "rule"
} | {
"index": 1720,
"split": "train"
} | |
Can you list the accelerator IDs, browser IDs, and the years they became compatible, sorted from the most recent to the oldest? | browser_web | select accelerator_id, browser_id, compatible_since_year as c1 from accelerator_compatible_browser 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": "browser_web",
"sql": "select accelerator_id, browser_id, compatible_since_year as c1 from accelerator_compatible_browser order by c1 desc"
},
"style": "rule"
} | {
"index": 177,
"split": "train"
} | |
Which shop's inventory item with inventory ID 1849 was rented out between July 11, 2005, in the evening and August 19, 2005, early morning? Please provide its film ID, store ID, and inventory ID. | sakila_1 | select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.film_id as c0, t0.store_id as c1, t0.inventory_id as c2 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t1.rental_date between '2005-07-11 19:09:33' and '2005-08-19 01:51:09' intersect select t0.film_id as c0, t0.store_id as c1, t0... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "sakila_1",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.film_id as c0, t0.store_id as c1, t0.inventory_id as c2 from inventory as t0 join rental as t1 on t0.inventory_id = t1.inventory_id where t1.rental_date between '2005-07-11 19:09:33' and '2005-08-19 01:51:0... | {
"index": 1397,
"split": "train"
} | |
Which five accounts, listed with their names and IDs, have either processed transactions exceeding 1298.73 or exactly 1483.05, when ordered descendingly by account name? | customers_card_transactions | select t0.account_id, t0.account_name as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_amount > 1298.73 or t1.transaction_amount = 1483.05 order by c1 desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_card_transactions",
"sql": "select t0.account_id, t0.account_name as c1 from accounts as t0 join financial_transactions as t1 on t0.account_id = t1.account_id where t1.transaction_amount > 1298.73 or t1.transaction_amount = 1483.05 order by c1 desc limit 5"
},
"styl... | {
"index": 2231,
"split": "train"
} | |
Can you tell me the names and event IDs of events that occurred on dates starting with "7 Octo"? | news_report | select name, event_id from event where date like '7 Octo%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "news_report",
"sql": "select name, event_id from event where date like '7 Octo%'"
},
"style": "rule"
} | {
"index": 241,
"split": "train"
} | |
Is the number of unique 'done' documents shipped by agents whose codes start with "U" less than the total number of 'done' documents? | cre_Doc_Control_Systems | select t1.c0 < t0.c0 from (select count(distinct (t1.document_id)) as c0 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t0.document_status_code = 'done' and t1.shipping_agent_code like 'U%' group by t0.document_status_code) as t1, (select t0.document_statu... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 count(distinct (t1.document_id)) as c0 from ref_document_status as t0 join documents as t1 on t0.document_status_code = t1.document_status_code where t0.document_status_code = 'done' and t1.shipping_agent_code li... | {
"index": 3560,
"split": "train"
} | |
Which apartment buildings have both apartments with exactly 2 bathrooms and apartments with more than 3 bedrooms? Please provide their descriptions and short names. | apartment_rentals | select anon_1.c0, anon_1.c1 from (select t0.building_description as c0, t0.building_short_name as c1 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.bathroom_count = 2 intersect select t0.building_description as c0, t0.building_short_name as c1 from apartment_buildings 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": "apartment_rentals",
"sql": "select anon_1.c0, anon_1.c1 from (select t0.building_description as c0, t0.building_short_name as c1 from apartment_buildings as t0 join apartments as t1 on t0.building_id = t1.building_id where t1.bathroom_count = 2 intersect select t0.building_descri... | {
"index": 174,
"split": "train"
} | |
How many days are there between an employee's hire date and their birth date? | store_1 | select julianday(t1.c0) - julianday(t0.c2) from (select hire_date as c0 from employees) as t1, (select birth_date as c2 from employees) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "store_1",
"sql": "select julianday(t1.c0) - julianday(t0.c2) from (select hire_date as c0 from employees) as t1, (select birth_date as c2 from employees) as t0"
},
"style": "rule"
} | {
"index": 3986,
"split": "train"
} | |
What is the status of the building with ID 11, and what is its name? List the status and building ID, and sort the results in reverse alphabetical order of the building name. | company_office | select t0.status from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where t1.building_id = 11 and t1.company_id in (select companies.id as c0 from companies) order by t0.name desc | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "company_office",
"sql": "select t0.status from buildings as t0 join office_locations as t1 on t0.id = t1.building_id where t1.building_id = 11 and t1.company_id in (select companies.id as c0 from companies) order by t0.name desc"
},
"style": "rule"
} | {
"index": 1684,
"split": "train"
} | |
How many course enrollments does each student have, and what are their student IDs, for students who logged in most recently on or after November 25, 2017 at 03:14:32, and who have at least one enrollment? | e_learning | select count(t0.student_id), t1.student_id as c1 from student_course_enrolment as t0 join students as t1 on t0.student_id = t1.student_id where t1.date_of_latest_logon >= '2017-11-25 03:14:32' group by c1 having count(*) >= 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select count(t0.student_id), t1.student_id as c1 from student_course_enrolment as t0 join students as t1 on t0.student_id = t1.student_id where t1.date_of_latest_logon >= '2017-11-25 03:14:32' group by c1 having count(*) >= 1"
},
"style": "rule"
} | {
"index": 2723,
"split": "train"
} | |
Find the names of manufacturers and their maximum revenues, but only include those whose maximum revenue is exactly 100. | manufactory_1 | select name as c1, max(revenue) from manufacturers group by c1 having max(revenue) between 100.0 and 100.0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "manufactory_1",
"sql": "select name as c1, max(revenue) from manufacturers group by c1 having max(revenue) between 100.0 and 100.0"
},
"style": "rule"
} | {
"index": 438,
"split": "train"
} | |
Which three campuses have the highest names when sorted alphabetically, and for each of those campuses, what is the number of years with degree counts less than 1471, along with the highest number of degrees awarded in those years? | csu_1 | select campus as c2, count(distinct (year)), max(degrees) from degrees where degrees < 1311 or degrees <= 1471 group by c2 order by c2 desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "csu_1",
"sql": "select campus as c2, count(distinct (year)), max(degrees) from degrees where degrees < 1311 or degrees <= 1471 group by c2 order by c2 desc limit 3"
},
"style": "rule"
} | {
"index": 1600,
"split": "train"
} | |
List the Submission ID, Author, Scores, and College for all submissions and those accepted into workshops with venues ending in 'USA'. | workshop_paper | select anon_1.c1, anon_1.c2, anon_1.c3, anon_1.c0 from (select submission_id as c1, author as c2, scores as c3, college as c0 from submission union select t0.submission_id as c1, t0.author as c2, t0.scores as c3, t0.college as c0 from submission as t0 join acceptance as t1 on t0.submission_id = t1.submission_id join wo... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "workshop_paper",
"sql": "select anon_1.c1, anon_1.c2, anon_1.c3, anon_1.c0 from (select submission_id as c1, author as c2, scores as c3, college as c0 from submission union select t0.submission_id as c1, t0.author as c2, t0.scores as c3, t0.college as c0 from submission as t0 joi... | {
"index": 523,
"split": "train"
} | |
For each customer, what is their ID and how many different loan amounts have they taken out? | loan_1 | select cust_id as c1, count(distinct (amount)) from loan 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": "loan_1",
"sql": "select cust_id as c1, count(distinct (amount)) from loan group by c1"
},
"style": "rule"
} | {
"index": 2840,
"split": "train"
} | |
Which users have posted tweets with UIDs less than 6 **and** also posted tweets with UIDs greater than or equal to 3? Please provide their Partition IDs and follower counts. | twitter_1 | select anon_1.c1, anon_1.c0 from (select t0.partitionid as c1, t0.followers as c0 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.uid < 6 intersect select t0.partitionid as c1, t0.followers as c0 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.uid >= 3) 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": "twitter_1",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.partitionid as c1, t0.followers as c0 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t1.uid < 6 intersect select t0.partitionid as c1, t0.followers as c0 from user_profiles as t0 join tweets as t... | {
"index": 844,
"split": "train"
} | |
Can you tell me the names and IDs of the top 10 products, along with the number of complaints each received before July 11, 1987, 2:40:30 PM? Please sort the results alphabetically by product name, placing any products with missing names last.
This rephrasing makes the question easier to understand, natural sounding, ... | customer_complaints | select t0.product_name as c1, t0.product_id as c2, count(t1.product_id) from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.date_complaint_raised < '1987-07-11 14:40:30' group by c2 order by c1 asc nulls last limit 10 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customer_complaints",
"sql": "select t0.product_name as c1, t0.product_id as c2, count(t1.product_id) from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.date_complaint_raised < '1987-07-11 14:40:30' group by c2 order by c1 asc nulls last limit 10"... | {
"index": 1131,
"split": "train"
} | |
Find the gender and ID of architects who designed the bridges with IDs 1 or 12, and show only the first 10 results sorted by their nationality alphabetically, with unknown nationalities listed last. | architecture | select t0.gender, t0.id from architect as t0 join bridge as t1 on t0.id = t1.architect_id where t1.id = 1 or t1.id = 12 order by t0.nationality 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": "architecture",
"sql": "select t0.gender, t0.id from architect as t0 join bridge as t1 on t0.id = t1.architect_id where t1.id = 1 or t1.id = 12 order by t0.nationality asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 2745,
"split": "train"
} | |
What are the three most recent order items involving the most popular product—specifically, their order quantities, product IDs, and the matching product details? | customers_and_addresses | select t0.order_quantity, t0.product_id, t1.product_id from order_items as t0 join products as t1 on t0.product_id = t1.product_id, (select product_details as c1 from products group by c1 order by count(*) desc limit 1) as t0 where t1.product_details = t0.c1 order by t0.order_id desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_addresses",
"sql": "select t0.order_quantity, t0.product_id, t1.product_id from order_items as t0 join products as t1 on t0.product_id = t1.product_id, (select product_details as c1 from products group by c1 order by count(*) desc limit 1) as t0 where t1.product_det... | {
"index": 2250,
"split": "train"
} | |
How many different checking account balances does each customer with a name ending in "Granger" have? | small_bank_1 | select count(distinct (t0.balance)), t1.custid as c1 from checking as t0 join accounts as t1 on t0.custid = t1.custid where t1.name like '%Granger' 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": "small_bank_1",
"sql": "select count(distinct (t0.balance)), t1.custid as c1 from checking as t0 join accounts as t1 on t0.custid = t1.custid where t1.name like '%Granger' group by c1"
},
"style": "rule"
} | {
"index": 2278,
"split": "train"
} | |
Which are the first three document type descriptions linked to the document with ID 23, ordered alphabetically with any nulls appearing at the end? | cre_Doc_Control_Systems | select t0.document_type_description as c0 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.document_id = 23 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": "cre_Doc_Control_Systems",
"sql": "select t0.document_type_description as c0 from ref_document_types as t0 join documents as t1 on t0.document_type_code = t1.document_type_code where t1.document_id = 23 order by c0 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 1496,
"split": "train"
} | |
Can you tell me the locations and station IDs of gas stations that are connected to a station company record with station ID 7, but are not associated with any company that isn't listed in the company's database? | gas_company | select anon_1.c0, anon_1.c1 from (select t0.location as c0, t0.station_id as c1 from gas_station as t0 join station_company as t1 on t0.station_id = t1.station_id where t1.station_id = 7 except select t0.location as c0, t0.station_id as c1 from gas_station as t0 join station_company as t1 on t0.station_id = t1.station_... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 t0.location as c0, t0.station_id as c1 from gas_station as t0 join station_company as t1 on t0.station_id = t1.station_id where t1.station_id = 7 except select t0.location as c0, t0.station_id as c1 from gas_station a... | {
"index": 2771,
"split": "train"
} | |
Can you provide the names of the companies, their profits in billions, the IDs of the buildings their offices are in, and the company IDs, but only for offices located in buildings that either have exactly 59 stories or have a number of stories equal to the total sum of stories across all buildings? | company_office | select t0.name, t0.profits_billion, t1.building_id, t1.company_id from companies as t0 join office_locations as t1 on t0.id = t1.company_id join buildings as t2 on t1.building_id = t2.id, (select sum(stories) as c3 from buildings) as t0 where t2.stories = 59 or t2.stories = t0.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": "company_office",
"sql": "select t0.name, t0.profits_billion, t1.building_id, t1.company_id from companies as t0 join office_locations as t1 on t0.id = t1.company_id join buildings as t2 on t1.building_id = t2.id, (select sum(stories) as c3 from buildings) as t0 where t2.stories =... | {
"index": 689,
"split": "train"
} | |
Which five truck license numbers are used the least frequently in the Trucks database? | customer_deliveries | select truck_licence_number as c0 from trucks group by c0 order by count(truck_licence_number) 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": "customer_deliveries",
"sql": "select truck_licence_number as c0 from trucks group by c0 order by count(truck_licence_number) asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 1363,
"split": "train"
} | |
Can you tell me the zip code(s) where staff members with the most common first name work? | driving_school | select t0.zip_postcode from addresses as t0 join staff as t1 on t0.address_id = t1.staff_address_id, (select first_name as c0 from staff group by c0 order by count(distinct (staff_address_id)) desc limit 1) as t0 where t1.first_name = 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": "driving_school",
"sql": "select t0.zip_postcode from addresses as t0 join staff as t1 on t0.address_id = t1.staff_address_id, (select first_name as c0 from staff group by c0 order by count(distinct (staff_address_id)) desc limit 1) as t0 where t1.first_name = t0.c0"
},
"style... | {
"index": 2305,
"split": "train"
} | |
Show the unique zip codes and populations for each county. | election | select distinct zip_code, population from county | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "election",
"sql": "select distinct zip_code, population from county"
},
"style": "rule"
} | {
"index": 2534,
"split": "train"
} | |
Which are the ten most recent or earliest completed courses, based on student completion dates before or between March 2 and March 6, 2018, sorted by course description in reverse order? | e_learning | select t0.course_name from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id where t1.date_of_completion <= '2018-03-01 00:08:30' or t1.date_of_completion between '2018-03-02 14:38:49' and '2018-03-06 00:27:09' order by t0.course_description 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": "e_learning",
"sql": "select t0.course_name from courses as t0 join student_course_enrolment as t1 on t0.course_id = t1.course_id where t1.date_of_completion <= '2018-03-01 00:08:30' or t1.date_of_completion between '2018-03-02 14:38:49' and '2018-03-06 00:27:09' order by t0.cours... | {
"index": 2168,
"split": "train"
} | |
Among customers whose savings account balance exceeds $80,000, what is the checking account balance and customer ID of the customer with the highest customer ID? | small_bank_1 | select t0.balance, t0.custid as c0 from checking as t0 join accounts as t1 on t0.custid = t1.custid join savings as t2 on t1.custid = t2.custid where t2.balance > 80000.0 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": "small_bank_1",
"sql": "select t0.balance, t0.custid as c0 from checking as t0 join accounts as t1 on t0.custid = t1.custid join savings as t2 on t1.custid = t2.custid where t2.balance > 80000.0 order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 811,
"split": "train"
} | |
What is the difference between the smallest department store chain ID overall and the smallest chain ID for the chain with ID 3 that has stores starting with "store_n"? | department_store | select t2.c2 - t0.c0 from (select min(t1.c0) as c2 from (select min(t1.dept_store_chain_id) as c0 from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id group by t0.dept_store_chain_id) as t1) as t2, (select t0.dept_store_chain_id, min(t1.dept_store_chain_id) a... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select t2.c2 - t0.c0 from (select min(t1.c0) as c2 from (select min(t1.dept_store_chain_id) as c0 from department_store_chain as t0 join department_stores as t1 on t0.dept_store_chain_id = t1.dept_store_chain_id group by t0.dept_store_chain_id) as t1) a... | {
"index": 3188,
"split": "train"
} | |
How many days passed between the start and end dates of bookings that had a refund amount less than 183.68? | products_for_hire | select julianday(t1.c1) - julianday(t0.c2) from (select booking_start_date as c1 from bookings where amount_of_refund < 183.68 and amount_of_refund < 183.68) as t1, (select booking_end_date as c2 from bookings) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "products_for_hire",
"sql": "select julianday(t1.c1) - julianday(t0.c2) from (select booking_start_date as c1 from bookings where amount_of_refund < 183.68 and amount_of_refund < 183.68) as t1, (select booking_end_date as c2 from bookings) as t0"
},
"style": "rule"
} | {
"index": 3737,
"split": "train"
} | |
Which addresses with ID 45 and 92 have the fewest associated people, and what are their address IDs along with the count of people at each? | student_assessment | select count(t0.address_id) as c0, t1.address_id as c1 from people_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id where c1 = 45 or c1 = 92 group by c1 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": "student_assessment",
"sql": "select count(t0.address_id) as c0, t1.address_id as c1 from people_addresses as t0 join addresses as t1 on t0.address_id = t1.address_id where c1 = 45 or c1 = 92 group by c1 order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 610,
"split": "train"
} | |
What is the value of L minus 19 for the manager with the player ID 'morrijo01'? | baseball_1 | select l - 19 from manager where player_id = 'morrijo01' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 l - 19 from manager where player_id = 'morrijo01'"
},
"style": "rule"
} | {
"index": 3211,
"split": "train"
} | |
Was the date when problem 9 was reported later than the date when problem 6 was reported? | tracking_software_problems | select t1.c0 > t0.c0 from (select date_problem_reported as c0 from problems where problem_id = 9) as t1, (select date_problem_reported as c0 from problems where problem_id = 6) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_software_problems",
"sql": "select t1.c0 > t0.c0 from (select date_problem_reported as c0 from problems where problem_id = 9) as t1, (select date_problem_reported as c0 from problems where problem_id = 6) as t0"
},
"style": "rule"
} | {
"index": 3111,
"split": "train"
} | |
What is the event ID of the most recent news report? | news_report | select event_id as c0 from news_report 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": "news_report",
"sql": "select event_id as c0 from news_report order by c0 desc limit 1"
},
"style": "rule"
} | {
"index": 1783,
"split": "train"
} | |
What are the lowest and highest high school scores among the players? | soccer_2 | select min(hs), max(hs) from player | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "soccer_2",
"sql": "select min(hs), max(hs) from player"
},
"style": "rule"
} | {
"index": 3857,
"split": "train"
} | |
Which players are attending schools that either have the least common school ID in the school details or have a school ID of 4? What are their ages, school IDs, team names, and the schools' denominations and founding years? | school_player | select t0.age, t0.school_id, t0.team, t1.denomination, t1.founded from player as t0 join school as t1 on t0.school_id = t1.school_id join school_details as t2 on t1.school_id = t2.school_id, (select school_id as c4 from school_details group by c4 order by count(*) asc nulls last limit 1) as t0 where t2.school_id = t0.c... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "school_player",
"sql": "select t0.age, t0.school_id, t0.team, t1.denomination, t1.founded from player as t0 join school as t1 on t0.school_id = t1.school_id join school_details as t2 on t1.school_id = t2.school_id, (select school_id as c4 from school_details group by c4 order by ... | {
"index": 1099,
"split": "train"
} | |
Which five people have the fewest different birth places associated with their names, and how many times does each of these names appear in the dataset? | body_builder | select name as c1, count(*) from people group by c1 order by count(distinct (birth_place)) 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": "body_builder",
"sql": "select name as c1, count(*) from people group by c1 order by count(distinct (birth_place)) asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 2927,
"split": "train"
} | |
Which are the top three students from the club located in AKW, showing their student IDs, advisors, and roles within the club, sorted from the highest to lowest position? | club_1 | select t0.stuid, t0.advisor, t1.position as c0 from student as t0 join member_of_club as t1 on t0.stuid = t1.stuid join club as t2 on t1.clubid = t2.clubid where t2.clublocation = 'AKW' 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": "club_1",
"sql": "select t0.stuid, t0.advisor, t1.position as c0 from student as t0 join member_of_club as t1 on t0.stuid = t1.stuid join club as t2 on t1.clubid = t2.clubid where t2.clublocation = 'AKW' order by c0 desc limit 3"
},
"style": "rule"
} | {
"index": 2379,
"split": "train"
} | |
Which airline, that is either from the country with the fewest airlines or has a country ending with "Turkey," has the highest average destination airport ID? For this airline, what is the average destination airport ID, and what is its activation status? | flight_4 | select avg(t0.dst_apid) as c2, t1.active, t1.alid as c3 from routes as t0 join airlines as t1 on t0.alid = t1.alid, (select country as c1 from airlines group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.country = t0.c1 or t1.country like '%Turkey' group by c3 order by c2 desc limit 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "flight_4",
"sql": "select avg(t0.dst_apid) as c2, t1.active, t1.alid as c3 from routes as t0 join airlines as t1 on t0.alid = t1.alid, (select country as c1 from airlines group by c1 order by count(*) asc nulls last limit 1) as t0 where t1.country = t0.c1 or t1.country like '%Tur... | {
"index": 2670,
"split": "train"
} | |
For staff members whose nicknames include 'senger', how many days are there between their date of birth and the date they left the staff position? | driving_school | select julianday(t1.c0) - julianday(t0.c3) from (select date_of_birth as c0 from staff) as t1, (select date_left_staff as c3 from staff where nickname like '%senger' and nickname like '%senger') as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select julianday(t1.c0) - julianday(t0.c3) from (select date_of_birth as c0 from staff) as t1, (select date_left_staff as c3 from staff where nickname like '%senger' and nickname like '%senger') as t0"
},
"style": "rule"
} | {
"index": 3912,
"split": "train"
} | |
What are the ten apartments with the highest apartment IDs that have three or fewer bathrooms? | apartment_rentals | select t0.apt_id as c0 from apartment_bookings as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.bathroom_count <= 3 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": "apartment_rentals",
"sql": "select t0.apt_id as c0 from apartment_bookings as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.bathroom_count <= 3 order by c0 desc limit 10"
},
"style": "rule"
} | {
"index": 2704,
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.