nl2sql-api / backend /src /scripts /test_cases.json
dvwn's picture
Merge branch 'main' into NL2SQL-V1.0
f3f9320
Raw
History Blame Contribute Delete
4.57 kB
[
{
"id": 1,
"difficulty": "easy",
"taxonomy": "Selection",
"question": "List all the artists name in the database.",
"gold_sql": "SELECT Name FROM Artist;"
},
{
"id": 2,
"difficulty": "easy",
"taxonomy": "Aggregation",
"question": "How many genres are there?",
"gold_sql": "SELECT COUNT(*) FROM Genre;"
},
{
"id": 3,
"difficulty": "easy",
"taxonomy": "Selection, Limit",
"question": "List the names of the first 5 tracks.",
"gold_sql": "SELECT Name FROM Track LIMIT 5;"
},
{
"id": 4,
"difficulty": "easy",
"taxonomy": "Aggregation, Filtering",
"question": "Count the number of customers located in the USA.",
"gold_sql": "SELECT COUNT(*) FROM Customer WHERE Country = 'USA';"
},
{
"id": 5,
"difficulty": "easy",
"taxonomy": "Selection, Filtering",
"question": "Find all invoices for the customer with ID 1.",
"gold_sql": "SELECT * FROM Invoice WHERE CustomerId = 1;"
},
{
"id": 6,
"difficulty": "medium",
"taxonomy": "Simple Join",
"question": "List each album title along with the artist's name.",
"gold_sql": "SELECT Album.Title, Artist.Name FROM Album JOIN Artist ON Album.ArtistId = Artist.ArtistId;"
},
{
"id": 7,
"difficulty": "medium",
"taxonomy": "Simple Join, Filtering, Aggregation",
"question": "How many tracks belong to the 'Rock' genre?",
"gold_sql": "SELECT COUNT(*) FROM Track JOIN Genre ON Track.GenreId = Genre.GenreId WHERE Genre.Name = 'Rock';"
},
{
"id": 8,
"difficulty": "medium",
"taxonomy": "Aggregation, Grouping",
"question": "Show the total revenue generated from each country.",
"gold_sql": "SELECT BillingCountry, SUM(Total) FROM Invoice GROUP BY BillingCountry;"
},
{
"id": 9,
"difficulty": "medium",
"taxonomy": "Multi-Join, Aggregation, Grouping",
"question": "Find the total number of items sold for each media type.",
"gold_sql": "SELECT MediaType.Name, SUM(InvoiceLine.Quantity) FROM InvoiceLine JOIN Track ON InvoiceLine.TrackId = Track.TrackId JOIN MediaType ON Track.MediaTypeId = MediaType.MediaTypeId GROUP BY MediaType.Name;"
},
{
"id": 10,
"difficulty": "easy",
"taxonomy": "Selection, Filtering",
"question": "List the first and last names of all employees who are Sales Support Agents.",
"gold_sql": "SELECT FirstName, LastName FROM Employee WHERE Title = 'Sales Support Agent';"
},
{
"id": 11,
"difficulty": "medium",
"taxonomy": "Simple Join, Aggregation, Grouping, Ordering, Limit",
"question": "List the top 5 customers who have spent the most money in total.",
"gold_sql": "SELECT c.FirstName, c.LastName, SUM(i.Total) as TotalSpent FROM Customer c JOIN Invoice i ON c.CustomerId = i.CustomerId GROUP BY c.CustomerId ORDER BY TotalSpent DESC LIMIT 5;"
},
{
"id": 12,
"difficulty": "hard",
"taxonomy": "Multi-Join, Aggregation, Grouping, Ordering, Limit",
"question": "Which artist has the most tracks in the database? Give the name and count.",
"gold_sql": "SELECT ar.Name, COUNT(t.TrackId) as TrackCount FROM Artist ar JOIN Album al ON ar.ArtistId = al.ArtistId JOIN Track t ON al.AlbumId = t.AlbumId GROUP BY ar.ArtistId ORDER BY TrackCount DESC LIMIT 1;"
},
{
"id": 13,
"difficulty": "medium",
"taxonomy": "Simple Join, Aggregation, Grouping, Having",
"question": "Which genres have more than 100 tracks? List the genre name and count.",
"gold_sql": "SELECT g.Name, COUNT(t.TrackId) as TrackCount FROM Genre g JOIN Track t ON g.GenreId = t.GenreId GROUP BY g.GenreId HAVING TrackCount > 100;"
},
{
"id": 14,
"difficulty": "medium",
"taxonomy": "Simple Join, Aggregation, Arithmetic, Grouping",
"question": "Calculate the average track length in seconds for each genre.",
"gold_sql": "SELECT g.Name, AVG(t.Milliseconds) / 1000.0 as AvgSeconds FROM Genre g JOIN Track t ON g.GenreId = t.GenreId GROUP BY g.GenreId;"
},
{
"id": 15,
"difficulty": "hard",
"taxonomy": "Multi-Join, Aggregation, Grouping, Ordering, Limit",
"question": "Identify the artist who has earned the most revenue from customers in Canada.",
"gold_sql": "SELECT ar.Name, SUM(il.UnitPrice * il.Quantity) AS Revenue FROM Artist ar JOIN Album al ON ar.ArtistId = al.ArtistId JOIN Track t ON al.AlbumId = t.AlbumId JOIN InvoiceLine il ON t.TrackId = il.TrackId JOIN Invoice i ON il.InvoiceId = i.InvoiceId WHERE i.BillingCountry = 'Canada' GROUP BY ar.ArtistId ORDER BY Revenue DESC LIMIT 1;"
}
]