Auto Increment
ELI5 — The Vibe Check
Auto increment means the database assigns the next ID number automatically every time you insert a row. You insert user #1, #2, #3 without ever thinking about it. No need to track 'what was the last ID' yourself.
Real Talk
Auto increment is a column property (SERIAL or IDENTITY in PostgreSQL, AUTO_INCREMENT in MySQL) that generates a unique, sequential integer value for each new row. It is the most common implementation for surrogate primary keys. The sequence is managed by the database engine.
Show Me The Code
-- PostgreSQL (SERIAL)
CREATE TABLE users (
id SERIAL PRIMARY KEY -- 1, 2, 3...
);
-- MySQL
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY
);
When You'll Hear This
"The id column auto-increments so you never have to set it manually." / "Gaps in auto-increment IDs are normal — don't worry about them."
Related Terms
Default Value
A default value is what gets stored in a column when you do not provide one.
Primary Key
A primary key is the unique ID that every row in a table must have. Like a social security number for your data — no two rows can have the same one.
UUID (Universally Unique Identifier)
A UUID is a randomly generated ID that looks like 'a3b4c5d6-...' and is practically guaranteed to be unique across the entire universe.