Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- Table Design for Users - One table for each or single table?


brotherhood_of_LAN - 6:56 pm on Oct 10, 2012 (gmt 0)


The userid is the primary key for all the tables I've put in the code above, no user will be able to have the same ID in the user credentials table as it has to be unique.

However there isn't anything stopping the user ID existing in more than one of the user type tables.

You may want to consider whether that's desirable or not (i.e. can a person belong to two different groups). If that's the case the procedure would need to be updated, and the usertype column would be better off being SET rather than ENUM.

Foreign keys are good for maintaining database integrity but if you design your code well enough then you don't really need them.


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4505569.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com