I'm blinded to my error

I have an error even when looking at the answer… what am I missing???

Screen Link:
https://app.dataquest.io/m/190/building-and-organizing-complex-queries/3/the-with-clause

My Code:

WITH playlist_info AS
     (
     SELECT
         p.playlist_id playlist_id,
         p.name playlist_name,
         t.name track_name,
         (t.milliseconds/1000) length_seconds
     FROM playlist p
     LEFT JOIN playlist_track pt ON pt.playlist_id = p.playlist_id
     LEFT JOIN track t ON t.track_id=pt.track_id
     )
     
SELECT  playlist_ID,
        playlist_name,
        COUNT(track_name) number_of_tracks,
        sum(length_seconds) length_seconds
FROM playlist_info
GROUP BY playlist_ID, playlist_name
ORDER BY playlist_id ASC;

ANSWER:

WITH playlist_info AS
    (
     SELECT
         p.playlist_id,
         p.name playlist_name,
         t.name track_name,
         (t.milliseconds / 1000) length_seconds
     FROM playlist p
     LEFT JOIN playlist_track pt ON pt.playlist_id = p.playlist_id
     LEFT JOIN track t ON t.track_id = pt.track_id
    )

SELECT
    playlist_id,
    playlist_name,
    COUNT(track_name) number_of_tracks,
    SUM(length_seconds) length_seconds
FROM playlist_info
GROUP BY 1, 2
ORDER BY 1;
The value for result doesn't look right.

My code resulted in a table that was 18x4

I was able to subbmit it successfully @daniellij. Do you mind refreshing the code screen (or restoring initial code) and trying again?

Thanks for testing it.

I think it had something to do with how DataQuest was reading the code, not an issue with the results. I got it to work now, though I changed playlist_ID to playlist_id (lowercase “id”) everywhere.

??? The world may never know.

I don’t think the casing really matters that much in SQL @daniellij. Occasionally these issues happen to others in the community too and the advice I would first give them is to refresh their page else use a different browser. Software ain’t perfect so sometimes we just have to be patient.

Good to hear that.

Cheers and Happy Learning!

Hi daniellij,
You forgot to format the data type of length_seconds, it should be a float not an integer: “1000.0”
I’ve faced same issue, when I changed it, it is correct

(t.milliseconds / 1000) length_seconds

Unfortunately, this SQL lesson is running on an old code runner on which the case actually matters (and it shouldn’t).