Record Numbers and UUIDs
Every record in your database must have a unique identifier. It's like your Social Security or National Insurance number: once it has been issued, it never changes. So you can always be correctly identified even if your other details, such as your name, address, or phone number, change.
In CatBase there are actually two unique identifiers: RecordNumber and UUID. Each has its uses, which we'll explain here.
RECORD NUMBERS VERSUS UUIDS
-
The RecordNumber field is an integer (whole number). It is unique for each record within a table. You can import your own IDs into this field, but if you try to import a duplicated number, that record will be rejected. If you don't import ID numbers, CatBase will assign a sequential number to each new record.
-
The UUID field in CatBase is a 32-character text field consisting of letters and numbers. "UUID" stands for Universal Unique IDentifier and as the name suggests, these are strings that are universally unique. An algorithm that uses various bits of information such as the user's IP address, the date and time at which the UUID was created, plus a random component, is used to ensure each UUID's uniqueness.
WHY DO WE NEED TWO UNIQUE IDS FOR EACH RECORD?
They each have their uses:
Record Numbers
Because they are integers, they are easy to refer to. You could say, for example, "Find record number 1234". But record numbers are only unique within that table. You might have a record number 1234 in your Products table, and a record number 1234 in your Suppliers table. For most purposes, this isn't an issue, and record numbers are fine.
UUIDS
UUIDs, however, are unique across all your data. You'll never find a UUID of C50120B51C2641D1A12B86C41170365E in more than one record, in any table, anywhere.
WHY USE UUIDS INSTEAD OF RECORDNUMBERS?
A good example of a use for UUIDs is demonstrated in our Building Simple and Complex Indexes tutorial.