Concept Flow - AUTO_INCREMENT vs SERIAL vs IDENTITY
Start: Insert new row
Check if PK value given?
Yes→Use given value
No
Generate next unique number
Assign number to PK column
Insert row with PK
End
When inserting a new row, the database checks if a primary key (PK) value is given. If not, it generates the next unique number automatically using AUTO_INCREMENT, SERIAL, or IDENTITY depending on the database.