How CAST() Works in MySQL

In MySQL, CAST() is a built in function that converts a value to another data type. It takes a value of one type and returns a value of the specified type.

You provide the value as an argument when you call the function, as well as the type that you’d like it converted to.

CAST() works similar to CONVERT(), except that the syntax used is slightly different.

Read more

Fix “ERROR 1298 (HY000): Unknown or incorrect time zone…” in MySQL

If you’re getting error 1298 that reads something like “ERROR 1298 (HY000): Unknown or incorrect time zone: ‘UTC’” in MySQL, it’s probably because you’re specifying a time zone name, but your MySQL installation hasn’t yet been configured for named time zones.

To fix this issue, be sure that your MySQL installation has been configured for named time zones.

Read more

How LAST_INSERT_ID() Works in MySQL

In MySQL, the LAST_INSERT_ID() function returns the first automatically generated value successfully inserted for an AUTO_INCREMENT column as a result of the most recently executed INSERT statement.

It can also be called with an argument, in which case, it returns the value of the expression and the next call to LAST_INSERT_ID() will return the same value.

Read more

MySQL ICU_VERSION() Explained

In MySQL, the ICU_VERSION() function returns the version of the International Components for Unicode (ICU) library used to support regular expression operations.

The ICU_VERSION() function is primarily intended for use in test cases.

Read more

MySQL COERCIBILITY() Explained

In MySQL, the COERCIBILITY() returns the collation coercibility value of its string argument.

The COERCIBILITY() function defines how collations will be converted in the case of collation conflict. In such conflicts, an expression with a higher coercibility is converted to the collation of an expression with a lower coercibility.

Read more