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

JSON_STORAGE_FREE() – Find Out How Much Storage Space was Freed Up After an Update of a JSON Document in MySQL

In MySQL, the JSON_STORAGE_FREE() function shows how much storage space was freed up after a JSON Document was updated.

For a JSON column value, it shows how much storage space was freed in its binary representation after it was updated in place using JSON_SET(), JSON_REPLACE(), or JSON_REMOVE().

For a JSON document (or a string which can be parsed as one), this function returns 0.

Continue reading

JSON_STORAGE_SIZE() – Find the Storage Size of a JSON Document in MySQL

In MySQL, the JSON_STORAGE_SIZE() function returns the number of bytes used to store the binary representation of a JSON document.

You provide the JSON document as an argument.

When the argument is a JSON column, this function returns the space used to store the JSON document as it was inserted into the column, prior to any partial updates that may have been performed on it afterwards.

When the argument is a string, the function returns the amount of storage space in the JSON binary representation that is created by parsing the string as JSON and converting it to binary.

Continue reading