MySQL CRC32() Function – Examples

In MySQL, the CRC32() function computes a cyclic redundancy check value and returns a 32-bit unsigned value.

CRC stands for Cyclic Redundancy Check. A CRC is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to raw data (although, it doesn’t necessarily guard against malicious or intentional changes).

Continue reading

MySQL PI() Function – Return the Value of π (pi)

In MySQL, the PI() function returns the value of π (pi). The number π is a mathematical constant approximately equal to 3.14159 (although it can also be displayed with much greater precision than this).

The PI() function displays π with a default precision of 7 (i.e. 3.141593), however MySQL uses the full double-precision value internally.

Continue reading

MySQL ROUND() Function – Round a Number to a Given Number of Decimal Places

In MySQL, the ROUND() function allows you to round a number up or down to a given number of decimal places.

The way it works is, you provide the number as an argument, and you have the option of choosing how many decimal places to round the number to. If you don’t specify the number of decimal places, the result will have no decimal places.

Continue reading