Below are 5 functions that enable you to return the week number from a date in MariaDB. Four return just the week, and one returns both the week and year combined.
Continue readingCategory: MariaDB
MariaDB RTRIM() vs RTRIM_ORACLE(): What’s the Difference?
MariaDB has an RTRIM()
function and a RTRIM_ORACLE()
function. Both functions do essentially the same thing. But there is a minor difference.
6 Ways to Check your MariaDB Version
Here are six ways to check what version of MariaDB you’re currently running.
Continue readingWEEKDAY() vs DAYOFWEEK() in MariaDB: What’s the Difference?
MariaDB provides a WEEKDAY()
function and a DAYOFWEEK()
function, both of which return the day of the week, represented as a number.
But the number returned is different between these functions.
This post looks at the difference.
Continue readingHow to Calculate Age in MariaDB
In MariaDB, you can use the TIMESTAMPDIFF()
function to calculate a person’s age (or the age of anything for that matter).
TIMESTAMPDIFF()
is a built-in date and time function that returns the difference between two date or datetime expressions. Passing YEAR
as the first argument, date of birth as the second argument, and the current date as the third, will return the age in years.
MariaDB JSON_VALUE() vs JSON_QUERY(): What’s the Difference?
In MariaDB, the JSON_VALUE()
function and JSON_QUERY()
function do similar things – they return data from a JSON document.
So what’s the difference?
The main difference is that JSON_VALUE()
returns scalar values, whereas JSON_QUERY()
returns arrays and objects.
MariaDB Numeric Functions (Full List)
This article contains a full list of built-in MariaDB numeric functions and operators.
Continue readingHow to Get the Short Day Name from a Date in MariaDB
In MariaDB, you can use the DATE_FORMAT()
function to return various date parts from a date. One of the things you can return is the short day name. For example Tue
or Wed
(instead of Tuesday
or Wednesday
).
MariaDB FIELD() vs FIND_IN_SET(): What’s the Difference?
Two similar functions in MariaDB are FIELD()
and FIND_IN_SET()
. At first glance, these appear to do the same thing, but there is a difference.
This article looks at the difference between these two functions.
Continue readingMariaDB 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