[Tutor] Generating unique ID

Serdar Tumgoren zstumgoren at gmail.com
Wed Oct 28 20:07:48 CET 2009


> I'm writing an application which will hold a database of people. Ofcourse,
> people can have the same name, so I want to stock them with an unique ID.
>

If you're using an actual database rather than a plain old text file,
you can let the database do the work for you.

Most flavors (sqlite, postgresql, mysql, oracle) have an autoincrement
option that will generate unique IDs for you when you insert new
records.

Below are the docs for sqlite that explain the feature:

http://www.sqlite.org/autoinc.html


More information about the Tutor mailing list