P. 4 - Combine the albums and tracks tables using an INNER JOIN. Order the query by album_id


#1

p. 4 - Combine the albums and tracks tables using an INNER JOIN. Order the query by album_id.

I've completed 3 previous item: create table set, added to her some records.
Now i can't join two tables.

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

INSERT INTO tracks (id, title, album_id) VALUES (1, "Smooth Criminal", 8);
INSERT INTO tracks (id, title, album_id) VALUES (2, "Yellow Submarine", 4);
INSERT INTO tracks (id, title, album_id) VALUES (3, "Thriller", 12);
INSERT INTO tracks (id, title, album_id) VALUES (4, "The Wall", 14);

SELECT
*
FROM
albums
JOIN tracks ON
albums.id = tracks.albums_id;

What wrong? And how i must use "ORDER BY albums.id" or "ORDER BY id" ?


#2

@evsasha,

have a look at the pictures,
so you can get a better feeling on what you are achieving with your SELECT.
= http://stackoverflow.com/questions/565620/difference-between-join-and-inner-join
= http://stackoverflow.com/questions/448023/what-is-the-difference-between-left-right-outer-and-inner-joins?sort=newest%3E


Strings II - Manipulate Many Criteria
#3

try
select * from albums
join artists on albums.artist_id = artists.id
order by albums.artist_id;