Solution: Get Over It
The values in any primary key must be unique and non-null so you can use them to reference individual rows, but that’s the only rule—they don’t have to be consecutive numbers to identify rows.
Numbering Rows
Most pseudokey generators return numbers that look almost like row numbers, because they’re monotonically increasing (that is, each successive value is one greater than the preceding value), but this is only a coincidence of their implementation. Generating values in this way is a convenient way to ensure uniqueness.
Don’t confuse row numbers with primary keys. A primary key identifies one row in one table, whereas row numbers identify rows in a result set. Row numbers in a query result set don’t correspond to primary ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access