Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Course it will scale. That will work just fine, it is a commonly used structure. </p> <p>Include a <code>level_no</code>. That will assist in the code, but more important, it is required to exclude duplicates. </p> <p>If you want a really tight structure, you need something like the Unix concept of inodes.</p> <p>You may have difficulty getting your head around the code required to produce the hierarchy, say from a <code>product</code>, but that is a separate issue.</p> <p>And please change </p> <ul> <li>(<code>product_category</code>)) <code>id</code> to <code>product_category_id</code></li> <li>(<code>product</code> <code>id</code> to <code>product_id</code></li> <li><code>parent_id</code> to <code>parent_product_category_id</code></li> </ul> <p><strong>Responses to Comments</strong></p> <ol> <li><p><code>level_no</code>. Have a look at this Data Model, it is for a Directory Tree structure (eg. the FlieManager Explorer window):</p> <p><a href="http://www.softwaregems.com.au/Documents/Student%20Resolutions/Andrew%20DM.pdf" rel="nofollow"><strong>Directory Data Model</strong></a></p> <p>See if you can make sense of it, that's the Unix inode concept. The FileNames have to be unique within the Node, hence the second Index. That is actually complete, but some developers these days will have a hissy fit writing the code required to navigate the hierarchy, the levels. Those developers need a <code>level_no</code> to identify what level in the hierarchy they are dealing with.</p></li> <li><p>Recommended changes. Yes, it is called Good Naming Conventions. I am rigid about it, and I publish it, so it is a Naming Standard. There are reasons for it, which will become clear to you when you write some SQL with 3 or 4 levels of joins; especially when you go to same one parent two different ways. If you search SO, you will find many questions for this; always the same answer. It will also be highlit in the next model I write for you.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload