0

I wanted to have a primary key in the form of 1_5_4 where

1 is user id

5 is comp id

4 is round id

Could anyone tell me if this is good/bad practice for MySQL p key design and how it would affect indexing etc.. I know you are meant to keep the p key short but I'm willing to sacrifice this for simplicity of the db design.

Thanks,

DavidJB
  • 2,272
  • 12
  • 30
  • 37
  • 3
    very bad design. normalize your table always. It's a table that colntains 3 columns: `userID`, `compID`, `roundID` – John Woo Mar 14 '13 at 11:36

1 Answers1

5

This is a more confusing db design. I would reccommend the following:

user_id
comp_id
round_id

as separate fields. You can then configure a composite primary key to cover all 3 fields ensuring uniqueness accross all 3

This question may be useful. How to properly create composite primary keys - MYSQL

Community
  • 1
  • 1
cowls
  • 24,013
  • 8
  • 48
  • 78