- 1 table for each class of data (where each record will share the same fields)
- 1 table defining relationships (recording the definition of the relationship between records)
- 1 relationship table (recording all the relationships)
Here's a simple example to illustrate the point:
Relationship table
| ID | Class | Relationship ID | ID | Class |
|---|---|---|---|---|
| 1618 | People | 7348 | 1234 | Company |
| 9371 | People | 0829 | 5678 | Company |
Companies table (a class of data about companies)
| ID | Company name | Company registration number |
|---|---|---|
| 1234 | Blob inc. | 555-666 |
| 5678 | Yodle inc. | 314159 |
People table (a class of data about people)
| ID | First name | Second name |
|---|---|---|
| 1618 | Albus | Dumbledore |
| 9373 | Michael | Jackson |
Defining relationships table
| ID | Relationship name |
|---|---|
| 0829 | is employee of |
| 7348 | is shareholder of |
This structure should facilitate all of the necessary queries. For example, a query of all the employees of a company.
A key feature is the directionality of the relationship: i.e. from A to B.
No comments:
Post a Comment