MariaDB LENGTH() vs LENGTHB(): What’s the Difference?

Ever since version 10.3.1, MariaDB has included both a LENGTH() function and a LENGTHB() function.

That second one has a B at the end of the name. So it’s kind of like Length A and Length B, except that Length A doesn’t have the A.

Confused?

I was, when I first encountered LENGTHB(). I already knew about LENGTH(), so why the need for a “B” version?

Let’s find out.

Continue reading

8 Functions to Return the Day from a Date in MariaDB

MariaDB has quite a number of functions that return the day from a date. It all depends on how you want to do it, and what you mean by “day”.

MariaDB needs to know whether you want the day name, the day of the week number, the day of the month, day of year, etc.

Below are 8 functions that enable you to return the day from a date in MariaDB, in its various forms.

Continue reading