autocounter()

This expression is used to create ascending lists of numbers. It can be used to create mock data or simple, unique ascending values, although it is not guaranteed to be serial in nature or to start at any particular value.

 

Example:

SELECT autocounter() from customers

 

Another example would be:

 

Example:

SELECT 1e10 -autocounter() * 100 from customers

 

Since autocounter() returns a number, it can be used in math expressions like any other function. Here we have selected 10 billion and subtracted autocounter() times 100 to create a descending value.