我想知道我是否以最有效的方式设置此数据库模式。我正在尝试输出滑雪术语及其对我网站上每种产品的含义。我为此设置的表:
产品
+----+--------+--------+-------------+
| id | brand | name | product_type|
+----+--------+--------+-------------+
|8000| burton | diode | binding |
+----+--------+--------+-------------+
术语_产品
+----+--------+------------+
| id | att_id | product_id |
+----+--------+------------+
| 1 | 51 | 8000 |
| 2 | 52 | 8000 |
+----+--------+------------+
术语
+--------+-----------+--------+---------------------+
| att_id | type | key | value |
+--------+-----------+--------+---------------------+
| 52 | baseplate | EST | details about EST |
| 53 | baseplate | Hinge | details about Hinge |
+--------+-----------+--------+---------------------+
然后我查询
SELECT products.ProductName, products.Brand, terminology.type, terminology.key, terminology.value
FROM products
JOIN terminology_products
ON terminology_products.product_id = products.ID
JOIN terminology
ON terminology_products.att_id = terminology.att_id
WHERE products.id = 8000
并获得我正在寻找的结果,但我觉得这可能是一种过于复杂的方法。有没有更简单的方法?感谢您的任何见解或帮助。