title: SQLite: Number rows of query output
body: <p>I am learning SQLite and I am currently posing the question whether there is a simple way of adding a sequential numbering to the output of a query.  Underneath, I provide an example of what I am trying to achieve.</p>
  
  <p>For instance, I have the following query:</p>
  
  <pre><code>SELECT
      splTicker AS 'Ticker',
      count(splTicker) AS '# of Splits'
  FROM Splits
  GROUP BY splTicker
  ORDER BY count(splTicker) DESC, splTicker ASC;
  </code></pre>
  
  <p>The output of this query is as follows:</p>
  
  <pre><code>bash-3.2$ sqlite3 myShares &lt; Queries/Split.sql
  Ticker      # of Splits
  ----------  -----------
  AI.PA       7          
  ASML.AS     3          
  BN.PA       3          
  ALTR.LS     2          
  BOKA.AS     2          
  DG.PA       2 
  ...
  SON.LS      1          
  SU.PA       1          
  SW.PA       1          
  TEC.PA      1          
  UMI.BR      1          
  VIV.PA      1          
  VPK.AS      1 
  </code></pre>
  
  <p>I am trying to add a sequential number to the rows to obtain the following output:</p>
  
  <pre><code>#  Ticker      # of Splits
  -- ----------  -----------
  1  AI.PA       7          
  2  ASML.AS     3          
  3  BN.PA       3          
  4  ALTR.LS     2          
  5  BOKA.AS     2          
  6  DG.PA       2
  ... 
  </code></pre>
  
  <p>Currently, I use a workaround and add the row numbers post-query in Perl.  I am posing the question whether I could do this directly in SQLite.  The idea seems simple, but I have not found a solution yet.  Any help would be appreciated.</p>
  
  <p>Best regards,</p>
  
  <p>GAM</p>