Are identifiers always numerical values?


#1

Question

In the context of this lesson, are identifiers, like the id column, always numerical values?

Answer

No, identifiers of a table do not always have to be numerical values. It is most common to use numerical values because the values are easy to keep track of, and for each new row, we simply increment the number by 1, but it is not absolutely necessary.

Instead of numerical values, you can use non-numerical values, such as text values or even dates, as long as they are unique for each row. You can even use multiple columns, in combination, to determine an identifier for each row.

For an example of a non-numerical identifier, consider a table of employees, with a column for emails, which can be used as the id column because each employee has a unique email. Another example is a table of transactions, where dates are specified to milliseconds that they were applied. Transactions cannot happen at the same time, so these dates might be used as the identifier.