SQL interview question: Convert Seconds to Minutes
Convert Track Duration to Minutes
The music app needs to display track lengths in a user-friendly format.
Convert each track's duration_seconds to minutes, rounded to 2 decimal places.
Return title and duration_minutes. Order by track_id and limit to 10 results.
Skills: arithmetic operations and ROUND function
Tables
tracks 40 rows
- track_id integer PK
- title text
- album_id integer → albums
- duration_seconds integer
| track_id | title | album_id | duration_seconds |
|---|---|---|---|
| 1 | Come Together | 1 | 259 |
| 2 | Something | 1 | 182 |
| 3 | Here Comes the Sun | 1 | 185 |