Below is a full list of the date and time units that can be used in MariaDB.
Continue readingAuthor: Ian
How SUBDATE() Works in MariaDB
In MariaDB, SUBDATE()
is a built-in date and time function that subtracts an amount from a given date.
It allows you to change a date by specifying the date, the unit to subtract, and the amount to subtract. You can pass a negative amount in order to add to the date, instead of subtracting from it.
SUBDATE()
also has a shortcut syntax that allows you to specify the days to subtract.
How DATE_SUB() Works in MariaDB
In MariaDB, DATE_SUB()
is a built-in date and time function that allows you to subtract an amount from a date.
It allows you to change a date by specifying the date, the unit to subtract, and the amount to subtract. You can pass a negative amount in order to add to the date, instead of subtracting from it.
Continue readingHow ADDDATE() Works in MariaDB
In MariaDB, ADDDATE()
is a built-in date and time function that performs date arithmetic.
It allows you to change a date by specifying the date, the unit to add, and the amount to add. You can pass a negative amount if you need to subtract the date by a certain interval.
ADDDATE()
also has a shortcut syntax that allows you to add a given number of days to the date.
How DATE_ADD() Works in MariaDB
In MariaDB, DATE_ADD()
is a built-in date and time function that performs date arithmetic.
It allows you to change a date by specifying the date, the unit to add, and the amount to add. You can pass a negative amount if you need to subtract the date by a certain interval.
Continue reading3 Ways to Hide an Index from the Query Plan in MongoDB
Starting from MongoDB 4.4, we can now hide indexes from the query plan. This enables us to evaluate the potential impact of dropping an index without actually dropping the index.
If hiding it has a negative impact, we can unhide the index. This saves us from having to drop the index, then recreate it again.
Below are 3 ways to hide an index in MongoDB.
Continue readingOPENROWSET does not accept variables for its arguments (SQL Server)
If you’re trying to use OPENROWSET
to run an ad hoc distributed query in SQL Server, but you keep getting an “incorrect syntax” error, and you just can’t see anything wrong with your syntax, it could be that you’re trying to use a variable for one of the arguments.
As mentioned in the title of this post, OPENROWSET
does not accept variables for its arguments.
If you’re using variables as arguments, try changing these to string literals.
Continue readingHow REGEXP_REPLACE() Works in MariaDB
In MariaDB, the REGEXP_REPLACE()
function replaces occurrences of the substring within a string that matches the given regular expression pattern.
The whole string is returned along with the replacements.
If there’s no match (i.e. the input string doesn’t contain the substring), the the whole string is returned unchanged.
Continue readingHow REGEXP_SUBSTR() Works in MariaDB
In MariaDB, the REGEXP_SUBSTR()
function returns the substring that matches the given regular expression pattern.
If there’s no match (i.e. the input string doesn’t contain the substring), the result is an empty string.
Continue readingHow REGEXP_INSTR() Works in MariaDB
In MariaDB, the REGEXP_INSTR()
function returns the starting index of a substring that matches the regular expression pattern.
The index starts at 1
. If there’s no match, the result is 0
.