Any approach will basically include a normalized database . Here is a basic example of what your database structure looks like:
// terms
+-------------------+
| id | name |
| 1 | tomatoes |
| 2 | strawberries |
| 3 | peaches |
| 4 | plums |
+-------------------+
// descriptions
+-------------------+
| id | name |
| 1 | red |
| 2 | edible |
| 3 | fruit |
| 4 | purple |
| 5 | orange |
+-------------------+
// connections
+-------------------------+
| terms_id | descript_id |
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 2 | 1 |
| 2 | 2 |
| 2 | 3 |
| 3 | 1 |
| 3 | 2 |
| 3 | 5 |
| 4 | 1 |
| 4 | 2 |
| 4 | 4 |
+-------------------------+
This will be a fairly simple setup, but it should give you an idea of ββhow many-to-many relationships using the lookup table work in databases.
Your application will have to break lines and be able to handle input normalization, for example, get rid of suffixes with user input. Then the script will query the table connectionsand return the results.
source
share