MySQL provides us with a bunch of functions that can modify JSON values. Here are ten functions that we can use to modify JSON values in MySQL.
Continue readingCategory: MySQL
6 Ways to Extract JSON Data in MySQL
In MySQL, we have several options when it comes to extracting data from JSON documents. Below are six methods we can use to do this.
Continue reading7 Functions that Create JSON Values in MySQL
MySQL includes some inbuilt functions that can be used to create JSON values, such as JSON arrays, JSON objects, or a quoted string literal.
Here are seven functions that allow us to create JSON values in MySQL.
Continue readingMySQL JSON Functions & Operators
Below is a list of the JSON functions and operators available in MySQL.
Continue reading3 Ways to Unquote a JSON Value in MySQL
In MySQL, we have several options when it comes to removing the quotes from a JSON value.
For example, normally if we return a string value from a JSON document, we would get that value along with its quotes. But sometimes we might not want the quotes. Below are three methods we can use to unquote a JSON value in MySQL.
Continue readingUnderstanding the JSON_SCHEMA_VALIDATION_REPORT() Function in MySQL
In MySQL, the JSON_SCHEMA_VALIDATION_REPORT()
function validates a JSON document against a JSON schema and returns a report of the outcome of that validation. The report is returned as a JSON document.
If the document is valid, only one field is returned: "valid" : true
. If the document is not valid, a more extensive report is provided.
7 Functions to Format a Number to 2 Decimal Places in MySQL
A common task when working with numbers is to format them to a certain amount of decimal places. Two decimal places seems to be the most common format, but we can format to any number of decimal places we want. MySQL provides us with a number of functions that can help us achieve this.
Below are seven functions that can be used to format a number to two decimal places in MySQL.
Continue readingHow JSON_SCHEMA_VALID() Works in MySQL
In MySQL, the JSON_SCHEMA_VALID()
function validates a JSON document against a JSON schema. It returns true (1
) if the document is valid, and false (0
) if it is not.
How to Convert Time Zones in MySQL using the Time Zone Name
When using a function like CONVERT_TZ()
to convert between time zones in MySQL, we provide the date/time value, along with the original time zone and the destination time zone (i.e. the time zone that we’re converting to).
One typical way to do this is to use the time zone offset, such as −05:00
to specify the time zone. Another method is to use the time zone name. However, this requires that we have configured named time zones in MySQL.
Understanding the ->> Operator in MySQL
In MySQL, we can use the ->>
operator to extract a value from a JSON document, and unquote that value.
We provide the column that contains the JSON document to the left of the operator, and the path to the value that we want to extract to the right.
The ->>
operator is equivalent to JSON_UNQUOTE(JSON_EXTRACT())
, and it provides the same results.