title: SQL startswith (using `LIKE`) on an expression
body: <p>What's an appropriate way to do <code>startswith(expression)</code> in SQL?</p>
  
  <p>I can do it with <code>LIKE ((expression) || '%')</code>, but it doesn't look very nice to me.</p>
  
  <p>Full query is in form:</p>
  
  <pre><code>SELECT …, (SELECT COUNT(*) 
             FROM post AS child 
             WHERE child.path LIKE (post.path || '%') 
            AND child.depth &gt;= post.depth)
  FROM post WHERE …
  </code></pre>
  
  <p>I suppose it is preferable to use <code>LIKE</code> because of DB indexing for this case.</p>