I have a table with some fixed columns id,title,created.., but there I need put some optional data from the user that I cant define a specif column, but I need this data for search from others users. What the best way?
the data would be like key:value pair
What should the best way to record any undefined optionals data from the user and optimize to search?
Good Day
Definitively 3). Storing a serialized array means being dependend on a language (php, json etc), and selecting via sql is impossible. 2) ist bad, because of several reasons; mainly, you are less flexible in extending and selecting. Create a meta table like 3), this is an established approach.
Update: 3) must be improved a bit: Create a table like this:
UID | key | value
not:
UID | key_value
第三种方法是最好的,因为您可以轻松地在数据库中搜索,并且您不必担心每个用户有多少个值
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.