[Answer]-How to store nested, numbered paragraphs (1, 1.1, 1.1.1)?

1👍

This is a general question, so the answer is necessarily general. What you are describing is a hierarchical data structure: an ordered sequence of steps, each of which may be the parent of a sequence of sub-steps. The two standard ways of handling this in MySQL is with either an adjacency list or a nested set structure. Both of these structures are described in many places on the web. One nice write-up is this one by Mike Hillyer.

This doesn’t address the formatting issues, but that’s more about the kind of data you’ll store at each node in the hierarchy, and is independent of how to represent the hierarchical structure itself.

Leave a comment