I need to store few items and its properties in form of a key value pairs in the database (mySQL). I am planning to do it as following.
I\'ll use two tables it
Here is an example query:
SELECT
itemName
FROM
items i,
JOIN
item_properties effect
ON i.itemId = effect.itemId AND effect.property = 'effect'
JOIN
item_properties consumption
ON i.itemId = consumption.itemId AND consumption.property = 'consumption'
WHERE effect.value = 'cooling' AND consumption.value = 'efficient';
I'll leave the oR query as something you can try yourself. It's simply adding more tables and using OR instead of AND in the WHERE.