Spaces:
Sleeping
Sleeping
| [ | |
| { | |
| "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": false, | |
| "generated_sql": "SELECT COUNT(g.genreid) AS number_of_genres FROM genre g;", | |
| "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 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": false, | |
| "esm_pass": false, | |
| "generated_sql": "SELECT COUNT(*) FROM \"Customer\" c WHERE c.Country ILIKE '%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": true, | |
| "esm_pass": false, | |
| "generated_sql": "SELECT * 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\" AS \"Artist 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) AS number_of_tracks 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": false, | |
| "esm_pass": false, | |
| "generated_sql": "SELECT c.country_name, SUM(i.total) AS total_revenue FROM \"Invoice\" i JOIN \"Customer\" c ON i.customer_id = c.customer_id GROUP BY c.country_name ORDER BY total_revenue 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 m.name AS media_type, COUNT(*) AS total_items_sold FROM \"MediaType\" m JOIN \"Sales\" s ON m.media_type_id = s.media_type_id GROUP BY m.name;", | |
| "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": false, | |
| "esm_pass": false, | |
| "generated_sql": "SELECT e.first_name, e.last_name 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, c.firstname, c.lastname, SUM(oi.productid * oi.quantity) AS total_spent FROM customer c JOIN orders o ON c.customerid = o.customerid JOIN orderitems oi ON o.orderid = oi.orderid GROUP BY c.customerid, c.firstname, c.lastname ORDER BY total_spent 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": "", | |
| "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 COUNT FROM genre g JOIN track t ON g.genreid = t.genreid GROUP BY g.name HAVING COUNT(t.trackid) > 100 ORDER BY COUNT 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 g.Name, AVG(t.Milliseconds / 1000)) AS AverageDuration FROM Track t JOIN Genre g ON t.GenreId = g.GenreId GROUP BY g.Name ORDER BY AverageDuration DESC 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\" FROM \"Artist\" a JOIN \"Album\" al ON a.\"ArtistId\" = al.\"AlbumArtistId\" WHERE al.\"AlbumCountry\" = 'Canada' ORDER BY a.\"Name\" DESC NULLS LAST 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;" | |
| } | |
| ] |