RingSQL: Schema-Independent Synthetic Data Generation for Text-to-SQL Reinforcement Learning
Paper • 2601.05451 • Published
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 is the smallest classroom number for each teacher's last name? | student_1 | select lastname as c1, min(classroom) from teachers 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": "student_1",
"sql": "select lastname as c1, min(classroom) from teachers group by c1"
},
"style": "rule"
} | {
"index": 397,
"split": "train"
} | |
What is the grade point value associated with the letter grade C-? | college_3 | select gradepoint from gradeconversion where lettergrade = '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": "college_3",
"sql": "select gradepoint from gradeconversion where lettergrade = 'C-'"
},
"style": "rule"
} | {
"index": 3362,
"split": "train"
} | |
Can you list the feature details and their IDs for all features in the database, as well as those specifically associated with the shop that has ID 8429? | cre_Theme_park | select anon_1.c0, anon_1.c1 from (select feature_details as c0, feature_id as c1 from features union select t0.feature_details as c0, t0.feature_id as c1 from features as t0 join tourist_attraction_features as t1 on t0.feature_id = t1.feature_id join tourist_attractions as t2 on t1.tourist_attraction_id = t2.tourist_at... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Theme_park",
"sql": "select anon_1.c0, anon_1.c1 from (select feature_details as c0, feature_id as c1 from features union select t0.feature_details as c0, t0.feature_id as c1 from features as t0 join tourist_attraction_features as t1 on t0.feature_id = t1.feature_id join tour... | {
"index": 1208,
"split": "train"
} | |
What are the visit record IDs, student IDs, and restaurant IDs for visits to restaurants of type with restypeid equal to 1? | restaurant_1 | select t0.resid, t0.stuid, t1.resid from visits_restaurant as t0 join restaurant as t1 on t0.resid = t1.resid join type_of_restaurant as t2 on t1.resid = t2.resid join restaurant_type as t3 on t2.restypeid = t3.restypeid where t3.restypeid = 1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "restaurant_1",
"sql": "select t0.resid, t0.stuid, t1.resid from visits_restaurant as t0 join restaurant as t1 on t0.resid = t1.resid join type_of_restaurant as t2 on t1.resid = t2.resid join restaurant_type as t3 on t2.restypeid = t3.restypeid where t3.restypeid = 1"
},
"styl... | {
"index": 2651,
"split": "train"
} | |
Which products have complaints from customers with IDs between 118 and 120 that are marked as closed or similar in status? | customer_complaints | select t0.product_name from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.customer_id between 118 and 120 and t1.complaint_status_code like 'Clos%' | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 from products as t0 join complaints as t1 on t0.product_id = t1.product_id where t1.customer_id between 118 and 120 and t1.complaint_status_code like 'Clos%'"
},
"style": "rule"
} | {
"index": 2178,
"split": "train"
} | |
Is the percentage change in the number of unique purchase transactions between December 30, 1997, and August 13, 1977, for investors with IDs 6 or higher greater than the largest percentage change observed among all other transaction types for that same period and investor group? | tracking_share_transactions | select t5.c1 > t2.c3 from (select abs((t3.c2 / cast(t4.c2 as real) - 1) * 100) as c1 from (select count(distinct (t1.transaction_id)) as c2 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t0.transaction_type_code = 'PUR' and t1.date_of_transaction = ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select t5.c1 > t2.c3 from (select abs((t3.c2 / cast(t4.c2 as real) - 1) * 100) as c1 from (select count(distinct (t1.transaction_id)) as c2 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_... | {
"index": 3451,
"split": "train"
} | |
Which manufacturer and product code combinations are for products that are not made by manufacturers whose names start with "I"? | manufactory_1 | select anon_1.c1, anon_1.c0 from (select manufacturer as c1, code as c0 from products except select t0.manufacturer as c1, t0.code as c0 from products as t0 join manufacturers as t1 on t0.manufacturer = t1.code where t1.name like 'I%') 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": "manufactory_1",
"sql": "select anon_1.c1, anon_1.c0 from (select manufacturer as c1, code as c0 from products except select t0.manufacturer as c1, t0.code as c0 from products as t0 join manufacturers as t1 on t0.manufacturer = t1.code where t1.name like 'I%') as anon_1"
},
"s... | {
"index": 902,
"split": "train"
} | |
Can you tell me the RAM size in MiB, model name, ROM size in MiB, company name, and chip model for phones that either have a screen resolution of exactly 160 by 256 pixels or have a screen mode with the most frequently used pixels among those with used memory of at least 16 KB and a type starting with "Graph"? Also, pl... | phone_1 | select t0.ram_mib as c5, t0.model_name, t0.rom_mib, t1.company_name, t1.chip_model from chip_model as t0 join phone as t1 on t0.model_name = t1.chip_model join screen_mode as t2 on t1.screen_mode = t2.graphics_mode, (select pixels as c4 from screen_mode where used_kb >= 16.0 and type like 'Graph%' group by c4 order by ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "phone_1",
"sql": "select t0.ram_mib as c5, t0.model_name, t0.rom_mib, t1.company_name, t1.chip_model from chip_model as t0 join phone as t1 on t0.model_name = t1.chip_model join screen_mode as t2 on t1.screen_mode = t2.graphics_mode, (select pixels as c4 from screen_mode where us... | {
"index": 1399,
"split": "train"
} | |
Check if the target user ID trusted by user 2 has an ID greater than 2.? | epinions_1 | select target_u_id > 2 from trust where source_u_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": "epinions_1",
"sql": "select target_u_id > 2 from trust where source_u_id = 2"
},
"style": "rule"
} | {
"index": 3297,
"split": "train"
} | |
Which are the top 10 injury accident records with the largest number of matches involved, ordered from the highest to lowest, and what is the total count of accident records and matches across all injuries? | game_injury | select count(number_of_matches), count(*) as c1 from injury_accident 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": "game_injury",
"sql": "select count(number_of_matches), count(*) as c1 from injury_accident order by c1 desc limit 10"
},
"style": "rule"
} | {
"index": 1927,
"split": "train"
} | |
What is the percent change in the highest investor ID for transaction types ending with "ase" between October 8, 1985, and December 2, 1990? | tracking_share_transactions | select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select max(t1.investor_id) as c0 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.date_of_transaction = '1990-12-02 09:03:38' and t0.transaction_type_description like '%ase' group by t0... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select max(t1.investor_id) as c0 from ref_transaction_types as t0 join transactions as t1 on t0.transaction_type_code = t1.transaction_type_code where t1.date_of_transaction = '19... | {
"index": 3058,
"split": "train"
} | |
Can you identify the calendar dates and day numbers when there are documents with a type code containing "V" that are stored on those dates, but excluding dates where documents with type codes starting with "PR" are stored? | cre_Doc_Tracking_DB | select anon_1.c1, anon_1.c0 from (select t0.calendar_date as c1, t0.day_number as c0 from ref_calendar as t0 join all_documents as t1 on t0.calendar_date = t1.date_stored where t1.document_type_code like '%V%' except select t0.calendar_date as c1, t0.day_number as c0 from ref_calendar as t0 join all_documents as t1 on ... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cre_Doc_Tracking_DB",
"sql": "select anon_1.c1, anon_1.c0 from (select t0.calendar_date as c1, t0.day_number as c0 from ref_calendar as t0 join all_documents as t1 on t0.calendar_date = t1.date_stored where t1.document_type_code like '%V%' except select t0.calendar_date as c1, t0... | {
"index": 1918,
"split": "train"
} | |
What are the codes, hours, and names of projects that are assigned to the most common project, excluding those assigned to project 'AeH1'? | scientist_1 | select anon_1.c0, anon_1.c3, anon_1.c2 from (select t0.code as c0, t0.hours as c3, t0.name as c2 from projects as t0 join assignedto as t1 on t0.code = t1.project, (select project as c1 from assignedto group by c1 order by count(*) desc limit 1) as t1 where t1.project = t1.c1 except select t0.code as c0, t0.hours as c3... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "scientist_1",
"sql": "select anon_1.c0, anon_1.c3, anon_1.c2 from (select t0.code as c0, t0.hours as c3, t0.name as c2 from projects as t0 join assignedto as t1 on t0.code = t1.project, (select project as c1 from assignedto group by c1 order by count(*) desc limit 1) as t1 where ... | {
"index": 2545,
"split": "train"
} | |
Can you tell me the 10 most recent city and person name pairs, along with the friendship year, for friends whose names contain "Bo"? | network_2 | select t0.city, t0.name, t1.year as c1 from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like '%Bo%' 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": "network_2",
"sql": "select t0.city, t0.name, t1.year as c1 from person as t0 join personfriend as t1 on t0.name = t1.friend where t1.name like '%Bo%' order by c1 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 421,
"split": "train"
} | |
Which clubs, with an ID of 2 or higher, also have a member whose role includes "President"? Please provide the club descriptions, names, and locations. | club_1 | select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.clubdesc as c0, t0.clubname as c2, t0.clublocation as c1 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid where t1.clubid >= 2 intersect select t0.clubdesc as c0, t0.clubname as c2, t0.clublocation as c1 from club as t0 join member_of_club as t1 o... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "club_1",
"sql": "select anon_1.c0, anon_1.c2, anon_1.c1 from (select t0.clubdesc as c0, t0.clubname as c2, t0.clublocation as c1 from club as t0 join member_of_club as t1 on t0.clubid = t1.clubid where t1.clubid >= 2 intersect select t0.clubdesc as c0, t0.clubname as c2, t0.clubl... | {
"index": 1824,
"split": "train"
} | |
Among the positions where the total of associated club IDs sums to 4, which position has the highest total sum of club IDs? | club_1 | select position as c0 from member_of_club group by c0 having sum(clubid) = 4 order by sum(clubid) 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": "club_1",
"sql": "select position as c0 from member_of_club group by c0 having sum(clubid) = 4 order by sum(clubid) desc limit 1"
},
"style": "rule"
} | {
"index": 1668,
"split": "train"
} | |
Among invoices billed in a state starting with "MA," which state has the fewest invoices? For that billing state, on or before July 24, 2009, what is the total and customer ID of the invoice with the lowest total? | store_1 | select t0.total as c0, t0.customer_id from invoices as t0, (select billing_state as c2 from invoices where c2 like 'MA%' group by c2 order by count(*) asc nulls last limit 1) as t0 where t0.billing_state = t0.c2 and t0.invoice_date <= '2009-07-24 00:00:00' 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": "store_1",
"sql": "select t0.total as c0, t0.customer_id from invoices as t0, (select billing_state as c2 from invoices where c2 like 'MA%' group by c2 order by count(*) asc nulls last limit 1) as t0 where t0.billing_state = t0.c2 and t0.invoice_date <= '2009-07-24 00:00:00' order... | {
"index": 2156,
"split": "train"
} | |
How many days have passed between a customer's date of birth and the date they became a customer, for those with last names starting with "Terr"? | driving_school | select julianday(t1.c1) - julianday(t0.c0) from (select date_became_customer as c1 from customers where last_name like 'Terr%' and last_name like 'Terr%') as t1, (select date_of_birth as c0 from customers) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "driving_school",
"sql": "select julianday(t1.c1) - julianday(t0.c0) from (select date_became_customer as c1 from customers where last_name like 'Terr%' and last_name like 'Terr%') as t1, (select date_of_birth as c0 from customers) as t0"
},
"style": "rule"
} | {
"index": 3841,
"split": "train"
} | |
What are the bottom 10 hardware colours, used kilobytes, and types for phones with chip models launched before or during 2005, or between 2002 and 2005, sorted by hardware colours? | phone_1 | select t0.hardware_colours as c1, t0.used_kb, t0.type from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode join chip_model as t2 on t1.chip_model = t2.model_name where t2.launch_year <= 2005.0 or t2.launch_year between 2002.0 and 2005.0 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": "phone_1",
"sql": "select t0.hardware_colours as c1, t0.used_kb, t0.type from screen_mode as t0 join phone as t1 on t0.graphics_mode = t1.screen_mode join chip_model as t2 on t1.chip_model = t2.model_name where t2.launch_year <= 2005.0 or t2.launch_year between 2002.0 and 2005.0 o... | {
"index": 1123,
"split": "train"
} | |
Which fault logs, involving engineers with skills having IDs between 1 and 3, include the date and time of the fault, the asset involved, the contact staff ID, and the fault log entry ID? | assets_maintenance | select t0.fault_log_entry_datetime, t0.asset_id, t1.contact_staff_id, t1.fault_log_entry_id from fault_log as t0 join engineer_visits as t1 on t0.fault_log_entry_id = t1.fault_log_entry_id join maintenance_engineers as t2 on t1.engineer_id = t2.engineer_id join engineer_skills as t3 on t2.engineer_id = t3.engineer_id w... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "assets_maintenance",
"sql": "select t0.fault_log_entry_datetime, t0.asset_id, t1.contact_staff_id, t1.fault_log_entry_id from fault_log as t0 join engineer_visits as t1 on t0.fault_log_entry_id = t1.fault_log_entry_id join maintenance_engineers as t2 on t1.engineer_id = t2.engine... | {
"index": 1320,
"split": "train"
} | |
List up to five of the earliest dates when ministers whose names end with "la (MP)" took office, only including those where the smallest region ID associated with them is less than 5, and show the earliest region ID for each. | party_people | select took_office as c0, min(region_id) from party where minister like '%la (MP)' group by c0 having min(region_id) < 5 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": "party_people",
"sql": "select took_office as c0, min(region_id) from party where minister like '%la (MP)' group by c0 having min(region_id) < 5 order by c0 asc nulls last limit 5"
},
"style": "rule"
} | {
"index": 283,
"split": "train"
} | |
Which five departments have the most entries, along with the count of their unique manager start dates, ordered from the highest to lowest? | company_1 | select dname as c1, count(distinct (mgr_start_date)) from department group by c1 order by count(*) desc limit 5 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "company_1",
"sql": "select dname as c1, count(distinct (mgr_start_date)) from department group by c1 order by count(*) desc limit 5"
},
"style": "rule"
} | {
"index": 172,
"split": "train"
} | |
Find the names of the three ships built after 1998 or in or before 1997, sorted alphabetically by name, with any ships without a name appearing at the end. | ship_1 | select name as c0 from ship where built_year > 1998.0 or built_year <= 1997.0 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": "ship_1",
"sql": "select name as c0 from ship where built_year > 1998.0 or built_year <= 1997.0 order by c0 asc nulls last limit 3"
},
"style": "rule"
} | {
"index": 165,
"split": "train"
} | |
What is the percentage change in the number of unique tweet IDs for user 5 at 2:30 AM on March 12, 2018? | twitter_1 | select (t0.c1 / cast(t0.c1 as real) - 1) * 100 from (select count(distinct (t1.id)) as c1 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 5 and t1.createdate = '2018-03-12 02:30:30' group by t0.uid) as t0 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "twitter_1",
"sql": "select (t0.c1 / cast(t0.c1 as real) - 1) * 100 from (select count(distinct (t1.id)) as c1 from user_profiles as t0 join tweets as t1 on t0.uid = t1.uid where t0.uid = 5 and t1.createdate = '2018-03-12 02:30:30' group by t0.uid) as t0"
},
"style": "rule"
} | {
"index": 3430,
"split": "train"
} | |
For each country where artists are from, how many unique artists and genders are there, sorted by the total number of genders? | music_1 | select country as c1, count(distinct (artist_name)), count(gender) as c2 from artist group by c1 order by c2 asc nulls last | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "music_1",
"sql": "select country as c1, count(distinct (artist_name)), count(gender) as c2 from artist group by c1 order by c2 asc nulls last"
},
"style": "rule"
} | {
"index": 2618,
"split": "train"
} | |
What is the percentage change in the minimum student ID associated with behavior incidents that ended on February 25, 2018, compared to those that ended on March 6, 2018? | behavior_monitoring | select (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select min(t1.student_id) as c0 from students as t0 join behavior_incident as t1 on t0.student_id = t1.student_id where t1.date_incident_end = '2018-02-25 05:38:58' group by t0.student_id) as t0, (select t0.student_id, min(t1.student_id) as c0 from students... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then 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 (max(t0.c0) / cast(max(t1.c0) as real) - 1) * 100 from (select min(t1.student_id) as c0 from students as t0 join behavior_incident as t1 on t0.student_id = t1.student_id where t1.date_incident_end = '2018-02-25 05:38:58' group by t0.student_id... | {
"index": 3005,
"split": "train"
} | |
What are the IDs of the last ten markets when listing all market IDs in ascending order? | phone_market | select market_id as c0 from market 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": "phone_market",
"sql": "select market_id as c0 from market order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 2269,
"split": "train"
} | |
? | customer_complaints | select t0.email_address, t0.customer_id as c1, min(t1.staff_id) from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.date_complaint_raised <= '2007-10-14 21:50:43' or t1.date_complaint_raised between '1973-02-10 22:55:56' and '1977-08-06 00:31:19' 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": "customer_complaints",
"sql": "select t0.email_address, t0.customer_id as c1, min(t1.staff_id) from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.date_complaint_raised <= '2007-10-14 21:50:43' or t1.date_complaint_raised between '1973-02-10 22:5... | {
"index": 344,
"split": "train"
} | |
What are the ten apartments with numbers ending in ". 794" that have the highest `View_Unit_Status` IDs? Please provide both the maximum `View_Unit_Status` apt ID and the apartment's ID, sorted from the highest to the lowest. | apartment_rentals | select max(t0.apt_id) as c1, t1.apt_id as c0 from view_unit_status as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.apt_number like '%. 794' group by c0 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": "apartment_rentals",
"sql": "select max(t0.apt_id) as c1, t1.apt_id as c0 from view_unit_status as t0 join apartments as t1 on t0.apt_id = t1.apt_id where t1.apt_number like '%. 794' group by c0 order by c1 desc limit 10"
},
"style": "rule"
} | {
"index": 408,
"split": "train"
} | |
What is the date of the order placed by the customer with the highest customer ID among those whose order status ends with "mpleted"? | department_store | select t0.order_date, t0.customer_id as c0 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where order_status_code like '%mpleted') as t1 where c0 = t1.c3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "department_store",
"sql": "select t0.order_date, t0.customer_id as c0 from customer_orders as t0, (select max(customer_id) as c3 from customer_orders where order_status_code like '%mpleted') as t1 where c0 = t1.c3"
},
"style": "rule"
} | {
"index": 3888,
"split": "train"
} | |
What is the latest completion date for the student who has the highest student ID among those with registration ID 13? | e_learning | select t0.date_of_completion, t0.student_id as c2 from student_course_enrolment as t0, (select max(student_id) as c1 from student_course_enrolment where registration_id = 13) as t1 where c2 = t1.c1 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "e_learning",
"sql": "select t0.date_of_completion, t0.student_id as c2 from student_course_enrolment as t0, (select max(student_id) as c1 from student_course_enrolment where registration_id = 13) as t1 where c2 = t1.c1"
},
"style": "rule"
} | {
"index": 3769,
"split": "train"
} | |
How many days are between the race times at circuits with IDs less than or equal to 58 and the dates of all races? | formula_1 | select julianday(t1.c0) - julianday(t0.c1) from (select time as c0 from races where circuitid <= 58 and circuitid <= 58) as t1, (select date as c1 from races) 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": "formula_1",
"sql": "select julianday(t1.c0) - julianday(t0.c1) from (select time as c0 from races where circuitid <= 58 and circuitid <= 58) as t1, (select date as c1 from races) as t0"
},
"style": "rule"
} | {
"index": 3808,
"split": "train"
} | |
What are the IDs of the top three sales transactions when sorting by their sales details from highest to lowest? | tracking_share_transactions | select sales_transaction_id from sales order by sales_details desc limit 3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "tracking_share_transactions",
"sql": "select sales_transaction_id from sales order by sales_details desc limit 3"
},
"style": "rule"
} | {
"index": 313,
"split": "train"
} | |
Did Employee 2's hire date come after Employee 5's hire date? | store_1 | select t1.c1 > t0.c1 from (select hire_date as c1 from employees where id = 2) as t1, (select hire_date as c1 from employees 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": "store_1",
"sql": "select t1.c1 > t0.c1 from (select hire_date as c1 from employees where id = 2) as t1, (select hire_date as c1 from employees where id = 5) as t0"
},
"style": "rule"
} | {
"index": 3100,
"split": "train"
} | |
Which invoice with the invoice date of "2018-03-20 00:21:41" has the highest order ID? | customers_and_invoices | select t0.invoice_date, t0.order_id as c1 from invoices as t0, (select max(order_id) as c3 from invoices where invoice_date = '2018-03-20 00:21:41') as t1 where c1 = t1.c3 | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "customers_and_invoices",
"sql": "select t0.invoice_date, t0.order_id as c1 from invoices as t0, (select max(order_id) as c3 from invoices where invoice_date = '2018-03-20 00:21:41') as t1 where c1 = t1.c3"
},
"style": "rule"
} | {
"index": 3756,
"split": "train"
} | |
Can you tell me the names and creation dates of the top three departments along with their head IDs and whether their leaders are temporarily or acting, specifically focusing on heads born in states that contain the letter "i," and sorted so that departments with non-acting heads appear first? | department_management | select t0.name, t0.creation, t1.head_id, t1.temporary_acting as c0 from department as t0 join management as t1 on t0.department_id = t1.department_id join head as t2 on t1.head_id = t2.head_id where t2.born_state like '%i%' 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": "department_management",
"sql": "select t0.name, t0.creation, t1.head_id, t1.temporary_acting as c0 from department as t0 join management as t1 on t0.department_id = t1.department_id join head as t2 on t1.head_id = t2.head_id where t2.born_state like '%i%' order by c0 asc nulls la... | {
"index": 330,
"split": "train"
} | |
Which cinemas have four showings per day but do not have schedules on dates that include the letter "y", and what are their capacities, IDs, and locations? | cinema | select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.capacity as c0, t0.cinema_id as c1, t0.location as c2 from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id where t1.show_times_per_day = 4 except select t0.capacity as c0, t0.cinema_id as c1, t0.location as c2 from cinema as t0 join schedule as t1 o... | spider | [
{
"content": "You are a helpful SQL expert assistant.\nThe assistant first thinks about how to write the SQL query by analyzing the question, database schema and external knowledge, then provides the final SQL query.\nThe reasoning process and SQL query are enclosed within <think> </think> and <answer> </answer... | logic | {
"ground_truth": {
"db_id": "cinema",
"sql": "select anon_1.c0, anon_1.c1, anon_1.c2 from (select t0.capacity as c0, t0.cinema_id as c1, t0.location as c2 from cinema as t0 join schedule as t1 on t0.cinema_id = t1.cinema_id where t1.show_times_per_day = 4 except select t0.capacity as c0, t0.cinema_id as c1, ... | {
"index": 1546,
"split": "train"
} | |
What is the percentage change in the total sum of customer IDs for customer 116 at the specific time '1987-07-11 14:40:30', compared to the maximum total sum at that time? | customer_complaints | select (max(t0.c2) / cast(max(t0.c2) as real) - 1) * 100 from (select sum(t1.customer_id) as c2 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.date_complaint_raised = '1987-07-11 14:40:30' and t0.customer_id = 116 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": "customer_complaints",
"sql": "select (max(t0.c2) / cast(max(t0.c2) as real) - 1) * 100 from (select sum(t1.customer_id) as c2 from customers as t0 join complaints as t1 on t0.customer_id = t1.customer_id where t1.date_complaint_raised = '1987-07-11 14:40:30' and t0.customer_id = ... | {
"index": 3018,
"split": "train"
} | |
What are the ten highest property IDs recorded in the Customer Event Notes? | local_govt_and_lot | select max(property_id) as c0 from customer_event_notes 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": "local_govt_and_lot",
"sql": "select max(property_id) as c0 from customer_event_notes order by c0 asc nulls last limit 10"
},
"style": "rule"
} | {
"index": 404,
"split": "train"
} |
We present text-to-SQL training data produced by RingSQL, a synthetic data generation pipeline that combines schema-independent templates with LLM rephrasing to create high quality question-SQL pairs for training LLMs using reinforcement learning.
Paper Link: https://arxiv.org/abs/2601.05451
GitHub Link: https://github.com/nu-c3lab/RingSQL