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: Relational
Get the Current Login ID in SQL Server (T-SQL)
You can use the SUSER_ID()
function to return the login identification number of the current user.
You can also use it to return the login ID of another user.
This is similar to returning the current login name, except here we’re returning the ID instead.
Continue readingMariaDB 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
).
Return the Current Workstation Name that’s Connected to SQL Server (T-SQL)
Occasionally you might find yourself in the situation where you need to get the name of the current workstation that’s connected to SQL Server.
For example, maybe you have a stored procedure that inserts data, and you want to record the name of the workstation that inserted the data.
In such cases, you can use the HOST_NAME()
function.
This is not to be confused with getting the server name.
Continue reading