WITH playlist_info AS ( SELECT playlist.playlist_id AS playlist_id, playlist.name AS playlist_name, track.name AS track_name, track.milliseconds / 1000.0 AS track_length_s FROM playlist LEFT JOIN playlist_track ON playlist.playlist_id = playlist_track.playlist_id LEFT JOIN track ON track.track_id = playlist_track.track_id ) SELECT playlist_id, playlist_name, COUNT(track_name) AS number_of_tracks, SUM(track_length_s) AS length_seconds FROM playlist_info GROUP BY playlist_name, playlist_id ORDER BY playlist_id;
What I expected to happen:
- pass test and move onto next screen
What actually happened:
- “The value for result doesn’t look right.”
This seems to be because my “length_seconds” column isn’t rounded to the nearest second (since I made sure to use a float when converting from milliseconds to seconds), whereas the ‘correct’ answer uses integer division and therefore returns answers rounded to the nearest second. But I don’t see anywhere in the question where it asks us to round our results. Did I miss this instruction, or did whoever wrote this answer forget about floats vs integers?