title: How to calculate the smallest period of time between consecutive events?
body: <p>Lets say that I have a table with a timestamp column full of records and I want to calculate  the smallest time difference between two consecutive records using only one query.</p>
  
  <p>Maybe a table like...</p>
  
  <pre><code>CREATE TABLE `temperatures` (
    `temperature` double,
    `time` timestamp DEFAULT CURRENT_TIMESTAMP
  );
  </code></pre>