title: PostgreSQL IF statement
body: <p>How can I do such query in Postgres?</p>
  
  <pre><code>IF (select count(*) from orders) &gt; 0
  THEN
    DELETE from orders
  ELSE 
    INSERT INTO orders values (1,2,3);
  </code></pre>