# 1 See [this stackoverflow](https://stackoverflow.com/questions/2944499/how-to-add-an-auto-incrementing-primary-key-to-an-existing-table-in-postgresql) ``` ALTER TABLE table_name ADD COLUMN id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY; ALTER TABLE table_name ADD COLUMN id INTEGER PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY; ``` and the `generate always as identity` it can be done in a `create table`. # 2 See [[Postgres_Data_Types]].