{"item_id": "test-01", "split": "test", "tier": "easy", "gold_sql": "SELECT COUNT(*) FROM Track", "ordered": false, "text": "How many tracks are in the catalog? Return just the count."}
{"item_id": "test-02", "split": "test", "tier": "easy", "gold_sql": "SELECT ArtistId, Name FROM Artist ORDER BY ArtistId", "ordered": true, "text": "List every artist id and name, ordered by artist id."}
{"item_id": "test-03", "split": "test", "tier": "easy", "gold_sql": "SELECT CustomerId FROM Customer WHERE Country='Canada' ORDER BY CustomerId", "ordered": true, "text": "Which customer ids have Canada as their country? Sort by customer id."}
{"item_id": "test-04", "split": "test", "tier": "easy", "gold_sql": "SELECT TrackId, Name FROM Track WHERE Milliseconds > 300000 ORDER BY TrackId", "ordered": true, "text": "List track id and name for tracks longer than five minutes, by track id."}
{"item_id": "test-05", "split": "test", "tier": "easy", "gold_sql": "SELECT COUNT(*) FROM Customer WHERE Company IS NULL", "ordered": false, "text": "How many customers have no company recorded?"}
{"item_id": "test-06", "split": "test", "tier": "easy", "gold_sql": "SELECT DISTINCT BillingCountry FROM Invoice ORDER BY BillingCountry", "ordered": true, "text": "List distinct invoice billing countries alphabetically."}
{"item_id": "test-07", "split": "test", "tier": "easy", "gold_sql": "SELECT ROUND(SUM(Total),2) FROM Invoice", "ordered": false, "text": "Return total invoice revenue rounded to two decimal places."}
{"item_id": "test-08", "split": "test", "tier": "easy", "gold_sql": "SELECT AlbumId, Title FROM Album ORDER BY AlbumId DESC LIMIT 4", "ordered": true, "text": "Return album id and title for the four largest album ids, largest first."}
{"item_id": "test-09", "split": "test", "tier": "easy", "gold_sql": "SELECT TrackId FROM Track WHERE Composer IS NULL ORDER BY TrackId", "ordered": true, "text": "Return track ids with a missing composer, sorted by id."}
{"item_id": "test-10", "split": "test", "tier": "easy", "gold_sql": "SELECT GenreId, Name FROM Genre ORDER BY Name", "ordered": true, "text": "List genre id and name alphabetically by genre name."}
{"item_id": "test-11", "split": "test", "tier": "easy", "gold_sql": "SELECT COUNT(*) FROM Invoice WHERE Total > 10", "ordered": false, "text": "How many invoices have a total strictly greater than ten?"}
{"item_id": "test-12", "split": "test", "tier": "easy", "gold_sql": "SELECT ROUND(AVG(Milliseconds),2) FROM Track", "ordered": false, "text": "What is the mean track duration in milliseconds, rounded to two decimals?"}
{"item_id": "test-13", "split": "test", "tier": "easy", "gold_sql": "SELECT CustomerId, FirstName, LastName FROM Customer ORDER BY CustomerId LIMIT 5", "ordered": true, "text": "Show customer id, first name and last name for the five smallest customer ids, in ascending id order."}
{"item_id": "test-14", "split": "test", "tier": "easy", "gold_sql": "SELECT COUNT(*) FROM Invoice WHERE InvoiceDate >= '2024-01-01' AND InvoiceDate < '2025-01-01'", "ordered": false, "text": "How many invoices are dated during calendar year 2024?"}
{"item_id": "test-15", "split": "test", "tier": "easy", "gold_sql": "SELECT TrackId, UnitPrice FROM Track WHERE UnitPrice > 1 ORDER BY TrackId", "ordered": true, "text": "List track id and unit price where the price exceeds one, sorted by id."}
{"item_id": "test-16", "split": "test", "tier": "easy", "gold_sql": "SELECT EmployeeId FROM Employee WHERE ReportsTo IS NULL", "ordered": false, "text": "Return employee ids with no manager recorded."}
{"item_id": "test-17", "split": "test", "tier": "easy", "gold_sql": "SELECT COUNT(*) FROM Track WHERE Name LIKE 'Track 01%'", "ordered": false, "text": "Count tracks whose name starts with the exact prefix Track 01."}
{"item_id": "test-18", "split": "test", "tier": "easy", "gold_sql": "SELECT MIN(Total), MAX(Total) FROM Invoice", "ordered": false, "text": "Return the minimum invoice total followed by the maximum."}
{"item_id": "test-19", "split": "test", "tier": "easy", "gold_sql": "SELECT InvoiceId FROM Invoice WHERE Total BETWEEN 5 AND 15 ORDER BY InvoiceId", "ordered": true, "text": "List invoice ids with totals from five through fifteen inclusive, in ascending id order."}
{"item_id": "test-20", "split": "test", "tier": "easy", "gold_sql": "SELECT Country, COUNT(*) FROM Customer GROUP BY Country ORDER BY Country", "ordered": true, "text": "Count customers per country. Return country and count, alphabetically by country."}
{"item_id": "test-21", "split": "test", "tier": "medium", "gold_sql": "SELECT a.AlbumId, ar.Name FROM Album a JOIN Artist ar ON ar.ArtistId=a.ArtistId ORDER BY a.AlbumId", "ordered": true, "text": "For every album, return album id and its artist name, by album id."}
{"item_id": "test-22", "split": "test", "tier": "medium", "gold_sql": "SELECT g.Name, COUNT(*) FROM Track t JOIN Genre g ON g.GenreId=t.GenreId GROUP BY g.GenreId ORDER BY g.Name", "ordered": true, "text": "Count tracks per genre. Return genre name and track count, alphabetically by genre name."}
{"item_id": "test-23", "split": "test", "tier": "medium", "gold_sql": "SELECT c.CustomerId, ROUND(SUM(i.Total),2) FROM Customer c JOIN Invoice i ON i.CustomerId=c.CustomerId GROUP BY c.CustomerId ORDER BY c.CustomerId", "ordered": true, "text": "For customers with invoices, return customer id and total invoice spending rounded to two decimals, by customer id."}
{"item_id": "test-24", "split": "test", "tier": "medium", "gold_sql": "SELECT ar.ArtistId FROM Artist ar LEFT JOIN Album a ON a.ArtistId=ar.ArtistId WHERE a.AlbumId IS NULL ORDER BY ar.ArtistId", "ordered": true, "text": "Return ids of artists with no albums, sorted by artist id."}
{"item_id": "test-25", "split": "test", "tier": "medium", "gold_sql": "SELECT a.AlbumId, COUNT(t.TrackId) FROM Album a LEFT JOIN Track t ON t.AlbumId=a.AlbumId GROUP BY a.AlbumId ORDER BY a.AlbumId", "ordered": true, "text": "List every album id and its track count, including empty albums, by album id."}
{"item_id": "test-26", "split": "test", "tier": "medium", "gold_sql": "SELECT i.BillingCountry, ROUND(SUM(l.UnitPrice*l.Quantity),2) FROM Invoice i JOIN InvoiceLine l ON l.InvoiceId=i.InvoiceId GROUP BY i.BillingCountry ORDER BY i.BillingCountry", "ordered": true, "text": "Sum sold line revenue by billing country. Return country and revenue rounded to two decimals, by country. Use line price times quantity."}
{"item_id": "test-27", "split": "test", "tier": "medium", "gold_sql": "SELECT TrackId, SUM(Quantity) FROM InvoiceLine GROUP BY TrackId ORDER BY SUM(Quantity) DESC, TrackId LIMIT 5", "ordered": true, "text": "Which five tracks sold the most units? Return track id and total quantity, quantity descending then track id ascending."}
{"item_id": "test-28", "split": "test", "tier": "medium", "gold_sql": "SELECT c.CustomerId FROM Customer c LEFT JOIN Invoice i ON i.CustomerId=c.CustomerId WHERE i.InvoiceId IS NULL ORDER BY c.CustomerId", "ordered": true, "text": "Return customer ids that have never received an invoice, by customer id."}
{"item_id": "test-29", "split": "test", "tier": "medium", "gold_sql": "SELECT e.EmployeeId, COUNT(c.CustomerId) FROM Employee e LEFT JOIN Customer c ON c.SupportRepId=e.EmployeeId GROUP BY e.EmployeeId ORDER BY e.EmployeeId", "ordered": true, "text": "For every employee, return employee id and the number of customers they support, including zero, by employee id."}
{"item_id": "test-30", "split": "test", "tier": "medium", "gold_sql": "SELECT p.PlaylistId, COUNT(pt.TrackId) FROM Playlist p LEFT JOIN PlaylistTrack pt ON pt.PlaylistId=p.PlaylistId GROUP BY p.PlaylistId ORDER BY p.PlaylistId", "ordered": true, "text": "Return every playlist id and its track count, including empty playlists, by playlist id."}
{"item_id": "test-31", "split": "test", "tier": "medium", "gold_sql": "SELECT m.Name, ROUND(AVG(t.Milliseconds),2) FROM Track t JOIN MediaType m ON m.MediaTypeId=t.MediaTypeId GROUP BY m.MediaTypeId ORDER BY m.Name", "ordered": true, "text": "For media types having tracks, return media type name and average duration in milliseconds rounded to two decimals, by name."}
{"item_id": "test-32", "split": "test", "tier": "medium", "gold_sql": "SELECT DISTINCT c.CustomerId FROM Customer c JOIN Invoice i ON i.CustomerId=c.CustomerId WHERE i.InvoiceDate >= '2025-01-01' AND i.InvoiceDate < '2026-01-01' ORDER BY c.CustomerId", "ordered": true, "text": "List distinct customer ids invoiced in calendar year 2025, by customer id."}
{"item_id": "test-33", "split": "test", "tier": "medium", "gold_sql": "SELECT AlbumId FROM Track GROUP BY AlbumId HAVING COUNT(*) >= 6 ORDER BY AlbumId", "ordered": true, "text": "Return album ids with at least six tracks, sorted by album id."}
{"item_id": "test-34", "split": "test", "tier": "medium", "gold_sql": "SELECT e.EmployeeId, m.FirstName FROM Employee e JOIN Employee m ON m.EmployeeId=e.ReportsTo ORDER BY e.EmployeeId", "ordered": true, "text": "For employees with a manager, return employee id and their manager first name, by employee id."}
{"item_id": "test-35", "split": "test", "tier": "medium", "gold_sql": "SELECT t.TrackId FROM Track t LEFT JOIN InvoiceLine l ON l.TrackId=t.TrackId WHERE l.InvoiceLineId IS NULL ORDER BY t.TrackId", "ordered": true, "text": "Return track ids never purchased, sorted by track id."}
{"item_id": "test-36", "split": "test", "tier": "medium", "gold_sql": "SELECT strftime('%Y-%m',InvoiceDate), ROUND(SUM(Total),2) FROM Invoice GROUP BY strftime('%Y-%m',InvoiceDate) ORDER BY 1", "ordered": true, "text": "Return each invoice calendar month as YYYY-MM and its total revenue rounded to two decimals, oldest month first."}
{"item_id": "test-37", "split": "test", "tier": "medium", "gold_sql": "SELECT c.SupportRepId, ROUND(SUM(i.Total),2) FROM Customer c JOIN Invoice i ON i.CustomerId=c.CustomerId GROUP BY c.SupportRepId ORDER BY c.SupportRepId", "ordered": true, "text": "Return support employee id and the sum of their customers invoice totals rounded to two decimals, by support employee id. Include only employees with such invoices."}
{"item_id": "test-38", "split": "test", "tier": "medium", "gold_sql": "SELECT g.GenreId, SUM(l.Quantity) FROM Genre g JOIN Track t ON t.GenreId=g.GenreId JOIN InvoiceLine l ON l.TrackId=t.TrackId GROUP BY g.GenreId ORDER BY g.GenreId", "ordered": true, "text": "Return genre id and total units purchased for each purchased genre, by genre id."}
{"item_id": "test-39", "split": "test", "tier": "medium", "gold_sql": "SELECT CustomerId, COUNT(*) FROM Invoice GROUP BY CustomerId HAVING COUNT(*) >= 3 ORDER BY CustomerId", "ordered": true, "text": "Return customer id and invoice count for customers with at least three invoices, by customer id."}
{"item_id": "test-40", "split": "test", "tier": "medium", "gold_sql": "SELECT a.ArtistId, COUNT(t.TrackId) FROM Album a JOIN Track t ON t.AlbumId=a.AlbumId GROUP BY a.ArtistId ORDER BY a.ArtistId", "ordered": true, "text": "For artists with tracks, return artist id and total track count across their albums, by artist id."}
{"item_id": "test-41", "split": "test", "tier": "hard", "gold_sql": "WITH s AS (SELECT CustomerId,SUM(Total) AS total FROM Invoice GROUP BY CustomerId) SELECT CustomerId,ROUND(total,2) FROM s WHERE total > (SELECT AVG(total) FROM s) ORDER BY CustomerId", "ordered": true, "text": "Among customers with invoices, return ids and spending above the mean of those customers total spending. Round spending to two decimals and sort by customer id."}
{"item_id": "test-42", "split": "test", "tier": "hard", "gold_sql": "WITH s AS (SELECT c.Country,c.CustomerId,SUM(i.Total) AS total FROM Customer c JOIN Invoice i ON i.CustomerId=c.CustomerId GROUP BY c.Country,c.CustomerId), r AS (SELECT *,ROW_NUMBER() OVER(PARTITION BY Country ORDER BY total DESC,CustomerId) AS pos FROM s) SELECT Country,CustomerId,ROUND(total,2) FROM r WHERE pos=1 ORDER BY Country", "ordered": true, "text": "Return the highest-spending invoiced customer in each customer country. Return country, customer id and rounded spending. Break equal spending by smallest customer id; order countries alphabetically."}
{"item_id": "test-43", "split": "test", "tier": "hard", "gold_sql": "SELECT t.TrackId FROM Track t WHERE EXISTS(SELECT 1 FROM PlaylistTrack p WHERE p.TrackId=t.TrackId) AND NOT EXISTS(SELECT 1 FROM InvoiceLine l WHERE l.TrackId=t.TrackId) ORDER BY t.TrackId", "ordered": true, "text": "Return track ids on at least one playlist but never purchased, sorted by track id."}
{"item_id": "test-44", "split": "test", "tier": "hard", "gold_sql": "SELECT a.ArtistId FROM Artist a WHERE EXISTS(SELECT 1 FROM Album b WHERE b.ArtistId=a.ArtistId) AND NOT EXISTS(SELECT 1 FROM Album b WHERE b.ArtistId=a.ArtistId AND NOT EXISTS(SELECT 1 FROM Track t WHERE t.AlbumId=b.AlbumId)) ORDER BY a.ArtistId", "ordered": true, "text": "Return artist ids with at least one album and no empty albums. Sort by artist id."}
{"item_id": "test-45", "split": "test", "tier": "hard", "gold_sql": "WITH m AS (SELECT strftime('%Y-%m',InvoiceDate) AS month,SUM(Total) AS revenue FROM Invoice GROUP BY month) SELECT month,ROUND(revenue,2),ROUND(SUM(revenue) OVER(ORDER BY month ROWS UNBOUNDED PRECEDING),2) FROM m ORDER BY month", "ordered": true, "text": "Return month YYYY-MM, monthly invoice revenue and cumulative revenue through that month. Round both revenue columns to two decimals; sort oldest month first."}
{"item_id": "test-46", "split": "test", "tier": "hard", "gold_sql": "SELECT i.InvoiceId, ROUND(i.Total-SUM(l.UnitPrice*l.Quantity),2) FROM Invoice i JOIN InvoiceLine l ON l.InvoiceId=i.InvoiceId GROUP BY i.InvoiceId HAVING ABS(i.Total-SUM(l.UnitPrice*l.Quantity)) > 0.01 ORDER BY i.InvoiceId", "ordered": true, "text": "Return invoice id and the rounded difference between invoice total and summed line price times quantity, only when the absolute difference exceeds one cent. Sort by invoice id."}
{"item_id": "test-47", "split": "test", "tier": "hard", "gold_sql": "WITH s AS (SELECT AlbumId,TrackId,Milliseconds,DENSE_RANK() OVER(PARTITION BY AlbumId ORDER BY Milliseconds DESC) AS r FROM Track) SELECT AlbumId,TrackId,Milliseconds FROM s WHERE r=1 ORDER BY AlbumId,TrackId", "ordered": true, "text": "Return album id, track id and duration for every longest-duration track within each album, including equal-duration tracks, ordered by album id then track id."}
{"item_id": "test-48", "split": "test", "tier": "hard", "gold_sql": "SELECT c.CustomerId FROM Customer c WHERE EXISTS(SELECT 1 FROM Invoice i JOIN InvoiceLine l ON l.InvoiceId=i.InvoiceId JOIN Track t ON t.TrackId=l.TrackId JOIN Genre g ON g.GenreId=t.GenreId WHERE i.CustomerId=c.CustomerId AND g.Name='Rock') AND NOT EXISTS(SELECT 1 FROM Invoice i JOIN InvoiceLine l ON l.InvoiceId=i.InvoiceId JOIN Track t ON t.TrackId=l.TrackId JOIN Genre g ON g.GenreId=t.GenreId WHERE i.CustomerId=c.CustomerId AND g.Name='Jazz') ORDER BY c.CustomerId", "ordered": true, "text": "Return customer ids who purchased Rock tracks but never Jazz tracks, by customer id."}
{"item_id": "test-49", "split": "test", "tier": "hard", "gold_sql": "SELECT t.TrackId, ROUND(100.0*SUM(l.Quantity)/(SELECT SUM(Quantity) FROM InvoiceLine),2) FROM Track t JOIN InvoiceLine l ON l.TrackId=t.TrackId GROUP BY t.TrackId ORDER BY SUM(l.Quantity) DESC,t.TrackId LIMIT 3", "ordered": true, "text": "Return the three top tracks by units sold and each track share of all units sold as a percentage rounded to two decimals. Columns: track id, percentage. Sort units descending, then track id ascending."}
{"item_id": "test-50", "split": "test", "tier": "hard", "gold_sql": "WITH s AS (SELECT CustomerId,InvoiceId,InvoiceDate,ROW_NUMBER() OVER(PARTITION BY CustomerId ORDER BY InvoiceDate,InvoiceId) AS r FROM Invoice) SELECT CustomerId,InvoiceId,InvoiceDate FROM s WHERE r=2 ORDER BY CustomerId", "ordered": true, "text": "Return customer id, invoice id and invoice date for the second invoice chronologically per customer. Break equal dates by invoice id. Exclude customers with fewer than two invoices, and sort by customer id."}
{"item_id": "dev-01", "split": "dev", "tier": "easy", "gold_sql": "SELECT COUNT(*) FROM Album", "ordered": false, "text": "Count all albums."}
{"item_id": "dev-02", "split": "dev", "tier": "easy", "gold_sql": "SELECT MAX(Milliseconds) FROM Track", "ordered": false, "text": "Return the largest track duration in milliseconds."}
{"item_id": "dev-03", "split": "dev", "tier": "easy", "gold_sql": "SELECT CustomerId FROM Customer WHERE Country='Brazil' ORDER BY CustomerId", "ordered": true, "text": "Return Brazil customer ids sorted by id."}
{"item_id": "dev-04", "split": "dev", "tier": "easy", "gold_sql": "SELECT COUNT(*) FROM Customer WHERE Company IS NOT NULL", "ordered": false, "text": "Count customers with a company recorded."}
{"item_id": "dev-05", "split": "dev", "tier": "easy", "gold_sql": "SELECT InvoiceId FROM Invoice ORDER BY InvoiceId DESC LIMIT 2", "ordered": true, "text": "Return the two largest invoice ids, descending."}
{"item_id": "dev-06", "split": "dev", "tier": "easy", "gold_sql": "SELECT MediaTypeId,COUNT(*) FROM Track GROUP BY MediaTypeId ORDER BY MediaTypeId", "ordered": true, "text": "Count tracks by media type id; return id and count, by id."}
{"item_id": "dev-07", "split": "dev", "tier": "medium", "gold_sql": "SELECT a.AlbumId,ar.ArtistId,ar.Name FROM Album a JOIN Artist ar ON ar.ArtistId=a.ArtistId ORDER BY a.AlbumId", "ordered": true, "text": "List album id, artist id and artist name ordered by album id."}
{"item_id": "dev-08", "split": "dev", "tier": "medium", "gold_sql": "SELECT InvoiceId,SUM(Quantity) FROM InvoiceLine GROUP BY InvoiceId ORDER BY InvoiceId", "ordered": true, "text": "List invoice id and total sold quantity, by invoice id."}
{"item_id": "dev-09", "split": "dev", "tier": "medium", "gold_sql": "SELECT AlbumId,ROUND(SUM(Milliseconds)/60000.0,2) FROM Track GROUP BY AlbumId ORDER BY AlbumId", "ordered": true, "text": "Return album id and total duration in minutes rounded to two decimals, by album id."}
{"item_id": "dev-10", "split": "dev", "tier": "medium", "gold_sql": "SELECT CustomerId,ROUND(AVG(Total),2) FROM Invoice GROUP BY CustomerId ORDER BY CustomerId", "ordered": true, "text": "Return customer id and average invoice total rounded to two decimals, by customer id."}
{"item_id": "dev-11", "split": "dev", "tier": "medium", "gold_sql": "SELECT ArtistId,COUNT(*) FROM Album GROUP BY ArtistId ORDER BY ArtistId", "ordered": true, "text": "Return artist id and album count for artists with albums, by artist id."}
{"item_id": "dev-12", "split": "dev", "tier": "medium", "gold_sql": "SELECT t.TrackId,COUNT(p.PlaylistId) FROM Track t LEFT JOIN PlaylistTrack p ON p.TrackId=t.TrackId GROUP BY t.TrackId ORDER BY t.TrackId", "ordered": true, "text": "For every track, return id and playlist count, including zero, by track id."}
{"item_id": "dev-13", "split": "dev", "tier": "hard", "gold_sql": "SELECT InvoiceId FROM Invoice WHERE Total > (SELECT AVG(Total) FROM Invoice) ORDER BY InvoiceId", "ordered": true, "text": "Return ids of invoices above the overall average invoice total, ordered by id."}
{"item_id": "dev-14", "split": "dev", "tier": "hard", "gold_sql": "WITH r AS (SELECT TrackId,GenreId,ROW_NUMBER() OVER(PARTITION BY GenreId ORDER BY Milliseconds,TrackId) AS pos FROM Track) SELECT GenreId,TrackId FROM r WHERE pos=1 ORDER BY GenreId", "ordered": true, "text": "Return each genre id and its shortest track id, breaking equal durations by track id, ordered by genre id."}
{"item_id": "dev-15", "split": "dev", "tier": "hard", "gold_sql": "SELECT c.CustomerId FROM Customer c WHERE NOT EXISTS(SELECT 1 FROM Invoice i WHERE i.CustomerId=c.CustomerId AND i.Total>15) ORDER BY c.CustomerId", "ordered": true, "text": "Return ids of customers with no invoice greater than fifteen, including customers without invoices, ordered by id."}
