Creating Auto-Incrementing Columns

Question:
How can I make a column that will automatically increment by one each timea new row is inserted into the table?

Answer:
The solution will depend upon the database server you are using. Manydatabases have implemented specialized functions that will automaticallyincrement a column, or otherwise automatically create a unique column(usually based on a timestamp or similar). Check your documentation’sindex for COUNTER(), “auto increment”, or similar topics — or scan areference of all the available functions to determine if one will serveyour purpose.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: