8.4 inner join


#1

PROBLEM:
Combine the albums and tracks tables using an INNER JOIN.

My solution looks like this one

CREATE TABLE tracks (id INTEGER PRIMARY KEY, title TEXT, album_id INTEGER);

INSERT INTO tracks (title, album_id)
VALUES ('Smooth Criminal', 8);

INSERT INTO tracks (title, album_id)
VALUES ('Song1', 4);

INSERT INTO tracks (title, album_id)
VALUES ('Song2', 1);

INSERT INTO tracks (title, album_id)
VALUES ('Song 3', 8);

SELECT albums.name, tracks.name
FROM albums
JOIN tracks
ON albums.id=tracks.album_id;

..for some reason my query doesn't work.. any idea?

Thanks
Davide


#2

There isn't a name column in tracks.