Challenge: Decades
Завдання
Swipe to start coding
- Group songs into decades. Your result should record in such a format: Decade, songs.id, songs.title, songs.price. For example:
1970 5 Time 200
1970 4 Stairway to Heaven 510
1980 16 Billie Jean 1200
And so on for all the songs.
For songs from one decade, sort them, starting from the most expensive.
- Change your query to not include albums with the undefined decade.
Рішення
9
1
2
3
4
5
6
SELECT albums.year - albums.year % 10 AS year, songs.id, songs.title, songs.price
FROM songs
INNER JOIN albums
ON albums.id = songs.album_id
WHERE year is not NULL
ORDER BY year, songs.price DESC
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 3. Розділ 4
9
1
2
3
4
5
SELECT _ _ _ AS year, _ _ _
FROM songs
INNER JOIN _ _ _
WHERE _ _ _
ORDER BY _ _ _
No query executed yet... |
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат