How a primary key works: why a database refuses a duplicate id
How a primary key works: why a database refuses a duplicate id
Id 3 is taken, so the new row bounces.
A primary key is the column that names each row. The database refuses a row that reuses a key or leaves it empty, which is why one id always finds exactly one row.
Save it for the next time a database throws a constraint error at you.
#sql #database #primarykey #coding #learnsql #technology