> I have a query which is more complex (taking advantage of relational
> databases more) than I have ever done before... and I'm not sure where in
> the docs to be looking for examples.
> 
> I have three tables...
> 
> cd (id, title, etc)
> artist (id, name)
> cd_to_artist (cdid, artistid)
> 

In my CD database, I use the following structure:
CREATE TABLE Artists (Artist VARCHAR (50) NOT NULL, ArtistID INT
UNSIGNED NOT NULL PRIMARY KEY)

CREATE TABLE Titles (Title VARCHAR (50) NOT NULL, TitleID INT UNSIGNED
NOT NULL PRIMARY KEY, ArtistID INT UNSIGNED NOT NULL)
        
CREATE TABLE Tracks (ArtistID INT UNSIGNED, TitleID INT UNSIGNED,
Sequence DECIMAL(1,2), Track VARCHAR(100))

which is close to what you have. You're on the right track with your
thinking. Use the ID of the Artist to find CD titles; use them both to
find tracks. If you're wondering why I set the Sequence field as a
decimal, it's the only way I could think of to deal with releases
containing more than 1 CD. So, CD1 sequences look like 1.01, 1.02 ...
1.10 and CD2 sequences look like 2.01, 2.02, ... 2.13 and so on.
-- 
/* All outgoing email scanned by Norton Antivirus 2002 */
Amer Neely, Softouch Information Services
W: www.softouch.on.ca
E: [EMAIL PROTECTED]
V: 519.438.5887
Perl | PHP | MySQL | CGI programming for all data entry forms.
"We make web sites work!"


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to