We had a meeting this morning about how would should store our ID for some assets that we have in our database that we are making, the descusion generated a bit of heat so I
This is a decision between surrogate and natural keys, the first being surrogate (or "technical") and the second being natural.
I've come to the conclusion that you should pretty much always use surrogate keys. If you use natural keys, those may change and updating primary/foreign keys is not generally a good idea.
I personally believe the first approach is far, far better. It lets the database software do simple integer comparisons to find and sort by the key, which will improve table operation performance (SELECTs, complex JOINs, by-key INDEX lookups, etc.)
Of course, I'm assuming that either way, you're using some kind of auto-incrementing method to produce the IDs - either a sequence, an AUTO_INCREMENT, or something similar. Do me a favor, and don't build those in your program's code, OK?
Well, I want to make some points and suggestions,
Consider having a separate table for Type, say with the column Id and Desc, then make a foreign key TypeId in this table. One step further in order to normalize the thing. But it may not desirable. Do it if you think it serve some purpose
Making it String does make sense, if later you folks think of shifting towards UUID. You don't need to change the data-type then
[Edited]
I agree with Cletus here. That surrogate key proved to be beneficial in some real life projects. They allow change, and you know well that, change is the only constant.
The one and only advantage of example 2 is that you can easily tell just from the primary key alone which row of which table this key applies to. The idea is nice, but whether or not it is useful depends on your logging and errormessage strategies. It does probably have a performance disadvantage, so I would not use it unless you can name some specific reasons why to use it.
(You can have this advantage also by using a global sequence to generate numerical keys, or by using different numeric ranges, last digits or whatever. Then you don't have performance disadvantages, but maybe you won't find the table so easily.)
Usually the rule of thumb is that never use meaningful information in primary keys (like Social Security number or barcode). Just plain autoincremented integer. However constant the data seems - it may change at one point (new legislation comes and all SSNs are recalculated).
If your assets already have unique natural identifiers (such as employees with their employee IDs), use them. There's no point creating another unique identifier.
On the other hand, if there's no natural unique ID, use the shortest one you can that'll ensure enough unique keys for your expected table size (such as your integer). It'll require less disk space and probably be faster. And, in addition, if you find yourself needing to use a string-based key later, it's a simple substitution job:
Some of these steps may be problematic on specific DBMS', perhaps requiring a table unload/reload to delete the integer primary key columns but that strategy is basically what's required.