Re: [SQL] Question about One to Many relationships

2006-03-27 Thread Jim C. Nasby
On Fri, Mar 24, 2006 at 06:29:25PM +0100, PFC wrote: And I want to link the band to the album, but, if the album is a compilation it'll be linked to multiple band.ids, so i can't just add a column like: For a compilation, you should link a band to a track, not an album.

[SQL] Question about One to Many relationships

2006-03-24 Thread Todd Kennedy
Hi, This should be a simple idea, but I've been going back and forth on it with various people in my tech group. So I've got two tables, one for albums and one for bands, for simplicity's sake, they look like this: CREATE TABLE bands ( id serial PRIMARY KEY, name varchar(64) NOT NULL CHECK(

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread D'Arcy J.M. Cain
On Fri, 24 Mar 2006 11:52:31 -0500 Todd Kennedy [EMAIL PROTECTED] wrote: So I've got two tables, one for albums and one for bands, for simplicity's sake, they look like this: CREATE TABLE bands ( id serial PRIMARY KEY, name varchar(64) NOT NULL CHECK( name ''), UNIQUE(name) ); CREATE

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread Milorad Poluga
Child table references a not-existing table: ('band' insted of 'bands') Error: ERROR: relation band does not exist CREATE TABLE bands ( CREATE TABLE bands_on_album ( - - - band_id integer REFERENCES band (id), - - - Regards, Milorad Poluga [EMAIL PROTECTED]

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread Todd Kennedy
We're not concerned with the track info. This is a listing of album information, hence the one to many relationship between the album and the artist. and for the record, i should correct myself. he said it was bad not wrong. but i hadn't given him all the details. But. Yes. Thank you all

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread D'Arcy J.M. Cain
On Fri, 24 Mar 2006 13:34:34 -0500 Joe [EMAIL PROTECTED] wrote: Todd Kennedy wrote: They haven't responded me as of yet. There should be a band associated with each album -- this is handled in code, but other than that this is the only relational db way I can think of to do it. But if a

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread Joe
Todd Kennedy wrote: They haven't responded me as of yet. There should be a band associated with each album -- this is handled in code, but other than that this is the only relational db way I can think of to do it. But if a band can have songs in many albums and an album can have songs from