标签系统

https://stackoverflow.com/questions/334183/what-is-the-most-efficient-way-to-store-tags-in-a-database

One item is going to have many tags. And one tag will belong to many items. This implies to me that you'll quite possibly need an intermediary table to overcome the many-to-many obstacle.

Something like:

Table: Items
Columns: Item_ID, Item_Title, Content

Table: Tags
Columns: Tag_ID, Tag_Title

Table: Items_Tags
Columns: Item_ID, Tag_ID

It might be that your web app is insanely popular and need denormalising down the road, but it's pointless muddying the waters too early.

posted @ 2018-03-25 20:37  GordonDicaprio  阅读(366)  评论(0编辑  收藏  举报