title: mysql query with condition to query one record
body: <p>Is there a way I check if the record exist in mysql?</p>
  
  <pre><code>Select name FROM test as p 
  Where (category = 'cat'
  OR category = 'dog')
  </code></pre>
  
  <p>What I want to achieve is query name from test table, if category is cat. If there is no record from this query, then query where category is dog.</p>
  
  <p>If category cat is available, don't query category dog.</p>