blob: 6a4ef565cf9bca4fbafc3a7a9c49badcc714e2b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
CREATE TABLE cds(
id serial PRIMARY KEY -- implicit primary key constraint,
title text NOT NULL
);
CREATE TABLE artists(
id serial PRIMARY KEY,
name text NOT NULL
);
CREATE TABLE cds_and_artists(
cds_id integer REFERENCES cds (id) ON UPDATE CASCADE ON DELETE CASCADE,
artists_id integer REFERENCES artisys (id) ON UPDATE CASCADE,
CONSTRAINT cds_and_artists_pkey PRIMARY KEY (cds_id, artists_id)
);
|