Simple 1:M Relationship Database, Suggestions?
Posted 08 October 2003 - 04:46 AM
My first table is a users table, primary key will be a auto increment userid.
My second table is a album table, its primary key will be a albumid and secondary userid.
I would like to be able to add as many albums as I would like for any particular user and relate them using the unique userid. So albums 2, 5, 35 all belong to userid 34. Is this the way to do it? Or should I create a third table?
The third table would contain both primary keys from each table. userid from the users table and albumid from the album table.
Also which is the best way to query to lookup? So if I want to view all albums for a particular user. Would using the SQL join commands work fine or is there a better method?
I\'m a SQL newbie but would love to figure this out, I could get it work on my own, I would just like some expert opinions on it.
Thanks all in advance. I look forward to reading some responses!
Posted 08 October 2003 - 05:03 AM
On the query, I\'d do something like
select username where user_id = $id
select album_id, album_name where user_id=$id
Posted 19 October 2003 - 07:33 PM
Donations gratefully received
|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users