Just somewhere to keep my notes while I'm playing.

Thursday, May 8, 2008

Reworking the CD table

The CD table works, but needs a unique key to link to the tracks on the CD.

CREATE TABLE cdtable
(
cdnum serial NOT NULL,
pubnum int4 NOT NULL,
artnum int4 NOT NULL,
cdtitle varchar(50) NOT NULL,
datepublished date,
CONSTRAINT artnum FOREIGN KEY (artnum) REFERENCES artist (artnum) ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT pubnum FOREIGN KEY (pubnum) REFERENCES publisher (pubnum) ON UPDATE NO ACTION ON DELETE NO ACTION
) WITHOUT OIDS
TABLESPACE ts_cddb_1;


insert into cdtable (artnum, pubnum, cdtitle, datepublished)
values (1,3,'Heavenbound','02apr2002');

No comments: