开发者

Simple database scheme help

开发者 https://www.devze.com 2023-02-06 21:56 出处:网络
I need to store multiple 4 letters strings for each database row but th开发者_开发知识库e amount of 4 letter strings could be different every time.

I need to store multiple 4 letters strings for each database row but th开发者_开发知识库e amount of 4 letter strings could be different every time.

So would it be easier to setup a new table and add a new row for each 4 letter string with the id of the related row in the other table ?


For normalisation reasons and performance as well as being able to later perform efficient queries, you would want to store it in a related table.

Main    : ID, other columns
Related : Main_ID, 4-letter-string

If there is nothing else you will store in the Main table, then just store them as multiple rows, and relate via a common ID.

You can store it on one record and still search efficiently, if FULLTEXT searching is turned on, but I doubt your 4-letter strings are natural language words, so it may not suit as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号