What does a primary key actually guarantee, and what does it not?
It guarantees that every row can be told apart from every other row, and that every row has one.
So what does it actually guarantee? Four things.
It guarantees that the value is not null, because a key that is missing cannot identify anything. It guarantees that no two rows have the same value. It gives the table exactly one key, so there is never a question about which one to use. And it gives you an index on that column, so looking a row up by its key is quick.
And what does it not guarantee? Four things that people expect it to guarantee.
It does not guarantee that the value means anything. The key can be a number that was made up and that nobody will ever read.
It does not guarantee that the value is never reused. If you delete the row with the key five, then a later row can have the key five in some engines, and then a link that pointed at the old row five points at the new one. That is a real bug in systems that use made up numbers as keys.
It does not guarantee that the value is in order. The keys come out in whatever order the engine finds them, and the only way to be sure of the order is to ask for it.
And it does not guarantee that the row is correct. A key identifies a row, and it says nothing about whether the values in that row are right.
So the rule to remember is this. A key identifies and nothing more. If you want the number to be in order, or to never be reused, or to mean something, then you have to arrange that yourself, and in some cases you need to use a key that comes from the real world rather than from the database.
The next two questions in this topic look at breaking the key and at the composite version.