An attempt to explain this as best as possible:
To begin, I have a table called vocabulary
:
+-----+---------------------+
| id | name |
+-----+---------------------+
| 1 | Farming |
| 2 | Agriculture |
| 3 | Design |
| 4 | Graphic Design |
| 5 | Interactive Design |
| 6 | Animal Husbandry |
| ... | ... |
| 887 | Carpentry |
+-----+---------------------+
In an excel sheet, I have lists of 'related vocabulary items' which might look like:
Interactive Design Farming
-------------------- --------------------
Graphic Design Agriculture
Design Animal Husbandry
What I want to do is create a table called vocabulary_relations
and create relationships between the header (in the above excel sheet example) to every item below it. For example, Interactive Design would point to Graphic Design and Design. Farming would point to Agriculture and Animal Husbandry.
For example, the table would look like this (using the vocabulary
table as reference):
+----------------+--------------+
| vocabulary_id | related_id |
+----------------+--------------+
| 5 | 4 |
| 5 | 2 |
| 1 | 2 |
| 1 | 6 |
+----------------+--------------+
That way, I can pull all the related_id
for any vocabulary_id
.
For example, if I requested vocabulary_id = 1
(farming) it would return related_id => 2, 6
(agriculture, animal husbandry, respectively).
Does anyone have any ideas on how to automate something like this? I am NOT looking for a user interface, this is static data.
Thank you!