another interesting thread about autonumbers, and numeric keys.
I think the issues are these
1. Why use a numeric key at all?
- because numeric keys are more efficient than strings
2. Why use an autonumber, rather than just a number?
- because in most cases all you want/need is a number/any number, and access can add the autonumber automatically without the need for any programming at all. In some cases (eg, a status code, or a VAT rate, or even a Branch Reference in a sales system), however, you may feel it better to control the numeric key values, rather than let the dbmanager allocate randomly. That's just a matter of system design,, and user interface.
3. Why use an auto sequence other than that provided by an autonumber?
- where more control is required, or where you need/want an intact sequence - or where you want to be able to create a sequence starting from a specific value. Personally I prefer to use a separate next value table, rather than a dmax+1, because you get more flexibility.
4. Visibility of numeric keys.
- absolutely no reason to hide them. It's useful in some cases to see them. But equally, there is no reason to design a system to expect users to need to know them.
5. "Real/Natural Keys".
I think numeric keys are there to make the dbs work efficiently, and make the programmer's task easier. For example, a single field numeric PK is much easier to handle than a multi-field key consisting of text fields.
A second great benefit of using a numeric keys as a PK, is that you do not need to propagate/cascade changes in real-world keys through the database.
However, where you use numeric keys, you almost certainly need a second natural-key to assure data integrity. For example, having a numeric key for a US State table does not in itself prevent you from having two rows for Florida, say. So you ALSO need a unique index on the "StateName" field.