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
Pseudokey generators return numbers that look almost like row numbers, because theyâre monotonically increasing (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 ...
Get SQL Antipatterns, Volume 1 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.