相关疑难解决方法(0)

需要MySQL查询以从存储键值对的表中进行选择

我需要在数据库(mySQL)中以键值对的形式存储少量项目及其属性.我打算按照以下方式做到这一点.

我将使用两个表itemsitem_properties.

items

 itemId | itemName 
-------------------
 1923   | AC
 1235   | Fridge
 8273   | Heater

item_properties

 itemId | property    | value
--------------------------------
 1923   | effect      | cooling
 1923   | consumption | efficient
 1923   | type        | split
 1235   | effect      | cooling
 1235   | volume      | 20 liters
 8273   | effect      | heating
 8273   | consumption | efficient
 8273   | heatMethod  | coil

现在,如果我必须选择"效果"为"冷却"的项目,我可以使用以下查询(这将在结果中给出'AC'和'Fridge').

SELECT itemName FROM items i, item_properties p 
WHERE i.itemId=p.itemId 
AND (p.property …

mysql key-value key-value-store

4
推荐指数
1
解决办法
4173
查看次数

标签 统计

key-value ×1

key-value-store ×1

mysql ×1