Resetting PostgreSQL Sequence

February 21, 2015 by

Okay folks, this is going to be a short one! Sometimes you may want to reset a PostgreSQL sequence, for instance after removing data from a tabel. You can do this very easily by executing the following statement: ALTER SEQUENCE company_id_seq RESTART WITH 1; company_id_seq is the name of the sequence that you want to… read more

Calculate Age From Date of Birth in MySQL

July 14, 2013 by

If you have ever needed to calculate the age of someone based on their date of birth, then you might have been left puzzled at first. Many people seem to over complicate things, so in this article, a simple function is provided to convert dates to ages.

Primary Index

May 19, 2012 by

The primary index is essential in databases. In this article, we present the main characteristics of the primary index along with its problems and solutions. A primary index physically orders the records on the secondary storage device to speed up the retrieval of data records. The index is sparse or non-dense because it only contains a block pointer for each block in the data file.