數據庫中的多個對象需要用字符串標記(完全是任意的)來標記。一個解決方案是一個典型的多對多一對多關係表示:標記數據庫對象(字符串標記)和標記查找
table Customer CustomerId, CustomerName
table Product ProductId, ProductName
table Tags TagId, TagName
table CustomerTags CustomerId, TagId
table ProductTags ProductId, TagId
另一種解決方案是具有代表通過PATH secondary XML index標籤,以提高連續查詢XML列:
table Customer CustomerId, CustomerName, Tags
table Product ProductId, ProductName, Tags
哪裏的標籤是這將有標籤,如<標籤> <標籤名稱=「標籤1」/> < XML列/標籤>和路徑索引喜歡/標記/標籤
第一種解決方案提供了更快的查找,但添加了更多表格。第二種解決方案更慢但更乾淨。
我是新來的SQL,可能忽略了一些東西,所以任何輸入將不勝感激。
標記刪除的好處...非常好,謝謝! – kateroh 2011-02-09 22:29:18