Database relationships using phpmyAdmin (composite keys)

Posted by Cool Hand Luke UK on Stack Overflow See other posts from Stack Overflow or by Cool Hand Luke UK
Published on 2010-04-04T11:16:15Z Indexed on 2010/04/04 11:23 UTC
Read the original article Hit count: 308

Hi,

I hope this question is not me being dense. I am using phpmyAdmin to create a database. I have the following four tables. Don't worry about that fact place and price are optional they just are.

  1. Person (Mandatory)
  2. Item (Mandatory)
  3. Place (Optional)
  4. Price (Optional)

Item is the main table. It will always have person linked. * I know you do joins in mysql for the tables. If I want to link the tables together I could use composite keys (using the ids from each table), however is this the most correct way to link the tables? It also means item will have 5 ids including its own. This all cause null values (apparently a big no no, which I can understand) because if place and price are optional and are not used on one entry to the items table I will have a null value there. Please help!

Thanks in advance. I hope this makes sense.

© Stack Overflow or respective owner

Related posts about database

Related posts about relationships