MySQL CRC32 Function

MySQL CRC32 function is one of the Mathematical Functions which computes the cyclic redundancy value. The return value of this is 32 bit unsigned integer. The syntax of the CRC32 is as shown below:

SELECT CRC32(expression);

This MySQL method accepts string expression as an output. If not, it converts the given value into a string.

MySQL CRC32 Function Example

The CRC32 function returns the Cylindric Redundancy value of the given value. The following query shows multiple ways to use this method. Also, read about the MySQL MOD function.

SELECT CRC32('MySQL');

SELECT CRC32('tutorial gateway');

SELECT CRC32('Hello'), CRC32('Hi'), CRC32('World');
CRC32 Function Example 1

In this CRC32 Mathematical method example, we are going to find the Cylindric Redundancy value of the Last Name and Occupation columns.

TIP: Please refer to the MySQL RAND and MySQL PI functions from the available list of MySQL Numeric Functions.

SELECT EmpID, 
       FirstName,
       LastName,
       CRC32(LastName),
       Occupation,
       CRC32(Occupation),
       YearlyIncome,
       Sales
 FROM customer;
CRC32 Function Example