Creating a Strong Primary Key


Creating a strong primary key is a very good idea to make your database as powerful as you can! As most of you might know you can make a primary key by using an auto-enetered serial number. This is great because it will automatically generate a new number for each record and will allow each record to be uniquely identified. But what if you wanted to create a system where multiple users could create records online and offline? With a serial number this cannot be done because the offline user and the online user could create a record at the same time and generate the same primary key number! This could lead to multiple data problems.

So what is the alternative?

The answer is using the Get ( UUID ) function. This function generates a universally unique identifier ( UUID ), a 16-byte alpha numeric string such as “C1507CEA-E3C1-425D-BA86-CE04FA4EE1E6”. This ID is extremely unlikely to be duplicated in another table or file you may be using, and thus is particularly useful if you are developing a solution in which a group of users will be creating records offline and syncing those new records to the server.

Leave a Reply