title: PostgreSQL jsonb value in WHERE BETWEEN clause
body: <p>I've got jsonb field in my database table (a_table) with int value within, say:</p>
  
  <pre><code>{
    "abc":{
         "def":{
              "ghk":500
          }
     }
  }
  </code></pre>
  
  <p>I'm about to create SELECT with filter by this field ("ghk") using WHERE clause:</p>
  
  <pre><code>SELECT * FROM a_table WHERE ghk BETWEEN 0 AND 1000;
  </code></pre>
  
  <p>How should i create such a query? Couldn't find good tutorial for jsonb usage so far.</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>EDIT</strong>
  <strike>I found this solution:</p>
  
  <pre><code>SELECT * FROM a_table WHERE a_field #&gt; '{abc,def,ghk}' BETWEEN '0' AND '10000' ;
  </code></pre>
  
  <p>Is it correct?</strike></p>