diff options
| author | yo mama <pepper@scannerjammer.com> | 2014-09-25 21:34:30 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2014-09-25 21:34:30 -0700 |
| commit | e7eaa7ff396723ce93d73f275e7ed156d059b07f (patch) | |
| tree | a10f0b4befe25670d5958f2c6596035eff8f3f9e /many_to_many_example.postgres | |
| parent | f68564b88dfb3ac08df2d01f883a0276883b96aa (diff) | |
test
Diffstat (limited to 'many_to_many_example.postgres')
| -rw-r--r-- | many_to_many_example.postgres | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/many_to_many_example.postgres b/many_to_many_example.postgres new file mode 100644 index 0000000..6a4ef56 --- /dev/null +++ b/many_to_many_example.postgres @@ -0,0 +1,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) +); + |
