Spaces:
Running
Running
File size: 7,491 Bytes
c96208b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | [
{
"id": 1,
"question": "List all the artists name in the database.",
"taxonomy": "Selection",
"ex_pass": true,
"esm_pass": false,
"generated_sql": "SELECT a.Name FROM Artist a;",
"gold_sql": "SELECT Name FROM Artist;"
},
{
"id": 2,
"question": "How many genres are there?",
"taxonomy": "Aggregation",
"ex_pass": true,
"esm_pass": true,
"generated_sql": "SELECT COUNT(*) FROM Genre;",
"gold_sql": "SELECT COUNT(*) FROM Genre;"
},
{
"id": 3,
"question": "List the names of the first 5 tracks.",
"taxonomy": "Selection, Limit",
"ex_pass": true,
"esm_pass": false,
"generated_sql": "SELECT t.Name FROM Track t ORDER BY t.TrackId LIMIT 5;",
"gold_sql": "SELECT Name FROM Track LIMIT 5;"
},
{
"id": 4,
"question": "Count the number of customers located in the USA.",
"taxonomy": "Aggregation, Filtering",
"ex_pass": true,
"esm_pass": false,
"generated_sql": "SELECT COUNT(*) FROM Customer c WHERE c.Country = 'USA';",
"gold_sql": "SELECT COUNT(*) FROM Customer WHERE Country = 'USA';"
},
{
"id": 5,
"question": "Find all invoices for the customer with ID 1.",
"taxonomy": "Selection, Filtering",
"ex_pass": false,
"esm_pass": false,
"generated_sql": "SELECT i.InvoiceId, i.InvoiceDate, i.Total FROM Invoice i WHERE i.CustomerId = 1;",
"gold_sql": "SELECT * FROM Invoice WHERE CustomerId = 1;"
},
{
"id": 6,
"question": "List each album title along with the artist's name.",
"taxonomy": "Simple Join",
"ex_pass": true,
"esm_pass": false,
"generated_sql": "SELECT a.Title, ar.Name FROM Album a JOIN Artist ar ON a.ArtistId = ar.ArtistId;",
"gold_sql": "SELECT Album.Title, Artist.Name FROM Album JOIN Artist ON Album.ArtistId = Artist.ArtistId;"
},
{
"id": 7,
"question": "How many tracks belong to the 'Rock' genre?",
"taxonomy": "Simple Join, Filtering, Aggregation",
"ex_pass": true,
"esm_pass": false,
"generated_sql": "SELECT COUNT(t.TrackId) FROM Track t JOIN Genre g ON t.GenreId = g.GenreId WHERE g.Name = 'Rock';",
"gold_sql": "SELECT COUNT(*) FROM Track JOIN Genre ON Track.GenreId = Genre.GenreId WHERE Genre.Name = 'Rock';"
},
{
"id": 8,
"question": "Show the total revenue generated from each country.",
"taxonomy": "Aggregation, Grouping",
"ex_pass": true,
"esm_pass": false,
"generated_sql": "SELECT i.BillingCountry, SUM(i.Total) AS TotalRevenue FROM Invoice i GROUP BY i.BillingCountry ORDER BY TotalRevenue DESC NULLS LAST;",
"gold_sql": "SELECT BillingCountry, SUM(Total) FROM Invoice GROUP BY BillingCountry;"
},
{
"id": 9,
"question": "Find the total number of items sold for each media type.",
"taxonomy": "Multi-Join, Aggregation, Grouping",
"ex_pass": false,
"esm_pass": false,
"generated_sql": "SELECT mt.Name, COUNT(*) AS total_items_sold FROM MediaType mt JOIN (SELECT MediaType.MediaTypeId, COUNT(*) AS items_sold FROM Album JOIN MediaType ON Album.MediaTypeId = MediaType.MediaTypeId GROUP BY MediaType.MediaTypeId) AS ms ON mt.MediaTypeId = ms.MediaTypeId GROUP BY mt.Name ORDER BY total_items_sold DESC NULLS LAST;",
"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,
"question": "List the first and last names of all employees who are Sales Support Agents.",
"taxonomy": "Selection, Filtering",
"ex_pass": true,
"esm_pass": false,
"generated_sql": "SELECT e.FirstName, e.LastName FROM Employee e WHERE e.Title = 'Sales Support Agent';",
"gold_sql": "SELECT FirstName, LastName FROM Employee WHERE Title = 'Sales Support Agent';"
},
{
"id": 11,
"question": "List the top 5 customers who have spent the most money in total.",
"taxonomy": "Simple Join, Aggregation, Grouping, Ordering, Limit",
"ex_pass": false,
"esm_pass": false,
"generated_sql": "SELECT c.CustomerId, SUM(o.TotalAmount) AS TotalSpent FROM Customer c JOIN Order o ON c.CustomerId = o.CustomerId GROUP BY c.CustomerId ORDER BY TotalSpent DESC LIMIT 5;",
"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,
"question": "Which artist has the most tracks in the database? Give the name and count.",
"taxonomy": "Multi-Join, Aggregation, Grouping, Ordering, Limit",
"ex_pass": false,
"esm_pass": false,
"generated_sql": "SELECT a.\"ArtistId\", COUNT(a.\"AlbumId\") AS track_count FROM \"Album\" a GROUP BY a.\"ArtistId\" ORDER BY track_count DESC LIMIT 1;",
"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,
"question": "Which genres have more than 100 tracks? List the genre name and count.",
"taxonomy": "Simple Join, Aggregation, Grouping, Having",
"ex_pass": true,
"esm_pass": false,
"generated_sql": "SELECT g.Name, COUNT(t.TrackId) AS TrackCount FROM Genre g JOIN Track t ON g.GenreId = t.GenreId GROUP BY g.Name HAVING COUNT(t.TrackId) > 100 ORDER BY TrackCount DESC NULLS LAST;",
"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,
"question": "Calculate the average track length in seconds for each genre.",
"taxonomy": "Simple Join, Aggregation, Arithmetic, Grouping",
"ex_pass": false,
"esm_pass": false,
"generated_sql": "SELECT t.GenreId, AVG(t.Milliseconds / 1000.0) AS average_length FROM Track t GROUP BY t.GenreId ORDER BY t.GenreId NULLS LAST;",
"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,
"question": "Identify the artist who has earned the most revenue from customers in Canada.",
"taxonomy": "Multi-Join, Aggregation, Grouping, Ordering, Limit",
"ex_pass": false,
"esm_pass": false,
"generated_sql": "SELECT a.Name, SUM(al.Sales) AS TotalRevenue FROM Artist a JOIN Album al ON a.ArtistId = al.ArtistId JOIN Customer c ON al.CustomerId = c.CustomerId WHERE c.Country = 'Canada' GROUP BY a.Name ORDER BY TotalRevenue DESC LIMIT 1;",
"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;"
}
] |