You seem to be assuming a record order; SQL doesn't really have that. (You can hack stuff together but you're still building on an essentially orderless foundation.) That's a fine text document format, though tabs or spaces would be more traditional in that role.
For short trees and in-memory management another option would be:
Where depth levels are represented by slashes only.Replace with indexes and you have a shorter version.
Let's see what else we can come up with just for fun...