Challenge: Albums with Two Songs
Congratulations! Now you are ready to create queries in SQL.
We will use the same database with tables songs, singers and albums.
songs
albums
singers
Oppgave
Swipe to start coding
Find the album's ids (id
), titles (title
) and release dates (year
) with number of songs equal to 2. Order these albums from oldest to newest.
Løsning
9
1
2
3
4
5
6
7
SELECT albums.id, albums.title, year
FROM albums
INNER JOIN songs
ON songs.album_id = albums.id
GROUP BY albums.id
HAVING count(songs.id) = 2
ORDER BY year
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 1
single
9
1
2
3
4
5
SELECT _ _ _
FROM _ _ _
_ _ _
_ _ _ = 2
ORDER BY _ _ _
No query executed yet... |
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår