MySQL Forums
Forum List  »  Newbie

Re: DB Design - Users Table
Posted by: Rick James
Date: June 11, 2009 08:20PM

If the items have different sets of data (columns) associated with them, generally it is better to put the items in different tables.

You can use UNION if you need to fetch different types of data from the different tables.

It might be that some information is "common" among all items. You could have a common table for that stuff. Using your Parents and Teachers example:
Common table: id, name, phone
Parent table: id, num_kids_in_school
Teacher table: id, classroom, grade
In this case, the id would be AUTO_INCREMENT PRIMARY KEY on the common table, then that value would be used as the PRIMARY KEY for the other tables.

Options: ReplyQuote


Subject
Written By
Posted
June 10, 2009 01:35AM
Re: DB Design - Users Table
June 11, 2009 08:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.