title: H2: how to tell if table exists?
body: <p>I'm trying to write Java code that checks to see if an H2 table exists: if it doesn't exist, it first executes a <code>CREATE TABLE</code> query that creates the table before it proceeds any further.</p>
  
  <p>I followed the advice in <a href="https://groups.google.com/forum/#!topic/h2-database/oq902hJSwWU">this Google Groups question</a> but it simply does not work.</p>
  
  <p>If I run the following query:</p>
  
  <pre><code>SELECT COUNT(*) AS count FROM information_schema.tables WHERE table_name = 'word_types'
  </code></pre>
  
  <p>I get back a single row with a <code>COUNT</code> field which has a value of 0; this indicates that the <code>word_types</code> tables doesn't exist. But when I run:</p>
  
  <pre><code>SELECT * FROM word_types
  </code></pre>
  
  <p>I get back 0 result sets, but the SQL frontend/GUI that I'm using shows me all the fields/columns that exist in the <code>word_types</code> table. Additionally, when I drill down into my database's list of available tables (using the same GUI), I see <code>word_types</code> exists.</p>
  
  <p>So what is the correct query to use when trying to determine if an H2 table exists or not? <strong>Using v1.3.173</strong>. Thanks in advance!</p>