Consider a table like this:
folders_table
-----------------------
INT id_folder
INT id_folder_parent
VARCHAR folder_name
Which stores a simple directory structure. How could I get all subdirectories of a directory with a single SELECT query?
It is possible, but you need to change your database structure; once the changes are made, you can retrieve a tree of any depth in one query. The queries are slightly more complex, but it’s still pretty straightforward.