In MySQL and MariaDB we can use the AUTO_INCREMENT
keyword to create an automatically incrementing column in a table. In SQLite, we’d use the AUTOINCREMENT
keyword. And in SQL Server we can use the IDENTITY
property. Some of those DBMSs also allow us to create sequence objects, which provide us with more options for creating an auto-increment type column.
When it comes to PostgreSQL, there are a few ways to create an auto-incrementing column. Below are three options for creating an AUTO_INCREMENT
style column in Postgres.