SELECT name
FROM track
WHERE media_type_id LIKE (SELECT media_type_id
FROM media_type
WHERE name LIKE '%AAC%')
AND genre_id LIKE (SELECT genre_id
FROM genre
WHERE name LIKE '%Rock%'
OR name LIKE '%Metal%');
Test says that it didn't find the expected column.
SELECT ct.country, ROUND((i.invoice_tally / ct.customer_tally), 2) AS sale_avg
FROM (SELECT billing_country, SUM(total) AS invoice_tally
FROM invoice
GROUP BY billing_country) AS i
JOIN (SELECT country, COUNT(*) AS customer_tally
FROM customer
GROUP BY country) AS ct
ON i.billing_country = ct.country
LIMIT 5;
Same thing as above, the test cannot find the expected column with the expected result.
Write a query to find Metal or Rock AAC Audio tracks that have a composer.
This isn’t a helpful feedback message. The issue is that because the columns in the result are not what we expect, we’re saying the column (as in the right values) isn’t there.
As to why your answer is wrong, that is because the questions asks (or at least wants to ask) for the top five countries with the highest average sale. Your answer does not provide that.
Probably not that specifically, but rather something else that was there from the start, namely media_type_id LIKE and genre_id LIKE. Are you sure you want to use LIKE there?
Note that the subquery SELECT media_type_id FROM media_type WHERE name LIKE '%AAC%' results in a column that looks like this:
SELECT invoice_date
FROM invoice
GROUP by invoice_date
HAVING MAX(total) > (SELECT SUM(total)/COUNT(invoice_id)
FROM invoice);
But i keep pulling the wrong data. Do you mind sharing your code?