Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Albums with Two Songs | SQL Tasks
Data Manipulation using SQL

book
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

Uppgift

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

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

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 1
single

single

SELECT _ _ _
FROM _ _ _
_ _ _
_ _ _ = 2
ORDER BY _ _ _
Query ResultQuery Result
No query executed yet...

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

some-alt