Join
Join in SQL
Schema (should be familiar by now):
create table artist(
artist_id int not null primary key,
name varchar not null,
website varchar default null
);
create table album(
album_id int not null primary key,
artist_id int not null references artist,
title varchar not null,
year int not null check(year > 0),
label_id int not null
);
create table track(
album_id int not null references album,
track int not null,
title varchar not null,
length int not null check(length > 0),
primary key(album_id, track)
);
|