0

I want to know if i'm setting up this database schema the most effective way. I am trying to output snowboarding terminology and what it means for each product on my website. The tables that I have set up for this:

products

+----+--------+--------+-------------+
| id | brand  | name   | product_type|
+----+--------+--------+-------------+
|8000| burton | diode  | binding     |
+----+--------+--------+-------------+

terminology_products

+----+--------+------------+
| id | att_id | product_id |
+----+--------+------------+
| 1  | 51     |  8000      |
| 2  | 52     |  8000      |
+----+--------+------------+

terminology

+--------+-----------+--------+---------------------+
| att_id |    type   | key    | value               |
+--------+-----------+--------+---------------------+
|   52   | baseplate | EST    | details about EST   |
|   53   | baseplate | Hinge  | details about Hinge |
+--------+-----------+--------+---------------------+

Then I query

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

And get the results that I am looking for, but I feel like this could be an over complicated way of doing it. Is there a simpler way? Thank you for any insight or help.

4
  • looks 'standard' to me. and this rally belongs in codereview Commented Oct 1, 2013 at 19:46
  • I've never heard of codereview, is it apart of this site? Commented Oct 1, 2013 at 19:49
  • codereview.stackexchange.com Commented Oct 1, 2013 at 19:50
  • Thanks! I'll go post it there. Commented Oct 1, 2013 at 19:51

1 Answer 1

1

Yes, it is a correct way. It's common solution.

Your "terminology_products" table contains foreign keys, and it allows you to make "many to many" relation between tables.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.