Obviously this question is impossible to answer without more information, so let me expand.
Im building a stores database with about 1000 stores
They are divided into 13 major categories of products.
Those 13 major categories each have about 4 or 5 sub categories
Those 4 or 5 (about 65 total) each have about 4 or 5 of their own.
What ive done is make a table for every single parent and its direct children. And then tables for each of its children and their children.
In terms of logic, it will meet my programming needs, but i am wondering if this it completely unorthodox to have this many tables and if there is a better way to do it.
Also wondering if that many tables will overload/lag the system when querying.
I could have done the entire thing in like 2 tables, where i just assigned a parent_id to each category, but from a visual perspective that didnt look very organized or hierarchal, whereas this is like a perfect tree.
Use a relational database structure (with one-to-many or many-to-many relations) with proper indexing. Having a separate table for each category does not make any sense logically – this is why relational databases were invented.
Your solution should work, but in a datamatic sense, it’s not very good practice.
To get more specific
A database structure like
Then sort the result you get from this using some recursion in PHP.