Effective SQL: 61 Specific Ways to Write Better SQL, First Edition
by John L. Viescas, Douglas J. Steele, Ben G. Clothier
10. Modeling Hierarchical Data
You already know that the relational model is not quite hierarchical, which is generally a good thing when we need to describe more complex relationships between different entities. Nonetheless, it is not uncommon to run into requirements where you need to maintain hierarchical data in your relational database. This also happens to be one of SQL’s weaker areas.
Whenever you have requirements for modeling hierarchical data with your SQL database, you must make a trade-off between data normalization, and ease of querying and maintenance of metadata. There are four different models that you can use, each represented as an item within the chapter. Each model will work optimally depending on your answers to the following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access