title: Limitting data in tables MySql
body: <p>I have a lot of entries for some devices in one table, and I have to limit size for every device:</p>
  
  <pre><code>ENTIRES
  -ID
  -DEVICE_ID
  -TIMESTAMP
  -VALUE
  </code></pre>
  
  <p>I want to limit to e.g. 100 entries for each device. In mongo I would use capped collections. How can I do it in MySql?</p>
  
  <p>I can periodically run count and delete queries, but maybe are there some better solutions?</p>