title: How to get the latest record for each device in DolphinDB?
body: <p>I create a streaming table named device in DolphinDB to store the real-time data for 3000 devices. Now I want to query the last record for each device. How to write the sql statement?</p>
  <p>The structure of this streaming table is as below:</p>
  <pre><code>Name        typeString  typeInt
  ----------  ----------  -------
  time        DATETIME    11     
  device_id   SYMBOL      17     
  mem_free    LONG        5      
  mem_used   LONG         5
  </code></pre>