Which sql data type should we use for number bases primary key:
- int
- bigint
- numeric
- float
Which sql data type should we use for number bases primary key:
Generally, int
.
bigint
if you think you'll have more rows than there are atoms in the universe.
uniqueidentifier
is useful if you need globally unique keys (keys that are guaranteed to be unique across all tables in your schema, maybe even universally unique (I don't remember))
The other two I wouldn't use they're not integral types (they have fractions, which just don't make a lot of sense as keys)