title: Calculate difference in seconds between two dates in various SQL databases (MySQL, Oracle, H2)
body: <p>I need to calculate the difference in seconds between two dates in SQL. The problem is that the same query will be executed in different environments, with different database engines.</p>
  
  <p>There is MySQL locally, Oracle in production environment and H2 for tests.</p>
  
  <p>I wrote a query using <code>TIME_TO_SEC</code> function, it worked perfectly, but then the integration tests failed, because there I had H2 instead of MySQL. I also tried to use <code>DATEDIFF</code> function, but its implementation is different in all of these databases.</p>
  
  <p>Is there a possibility to write a single, universal query for all these databases?</p>