What's better - many small tables or one big table?

前端 未结 9 1195
半阙折子戏
半阙折子戏 2020-12-12 19:29

I\'ve got a database which will store profiles about individuals. These individuals have about 50 possible fields.

Some are common things like, first name, last nam

9条回答
  •  情深已故
    2020-12-12 20:06

    IMO, it is more important to worry about the quality of data stored than the number of tables that you need.

    For example, do you need to track changes? If John was 5'2" in January 2007 and is 5'11" in Oct 2010, do you want to know? If so, you will need to separate out the person from the height into two tables.

    How about hobbies - are they allowed to only have 3 hobbies? Can they have more / less? Is this something you would want to query in the future? If so, you need a separate table.

    You should read up on database design and normalization (there are several excellent threads on this site itself).

    https://stackoverflow.com/questions/tagged/normalization

提交回复
热议问题