MySQL supports the use of the pipe concatenation operator (||
) for concatenating its operands. However, you need to enable it first.
Author: Ian
3 Functions that Get the Day, Month, and Year from a Date in PostgreSQL
PostgreSQL provides us with several ways to get the day, month, and year from a date.
Three functions that immediately come to mind are; DATE_PART()
, EXTRACT()
, and TO_CHAR()
.
Export Query Results to an XML File when using SQLcl (Oracle)
When using SQLcl with Oracle Database, you can export your query results to an XML file with the SPOOL
command.
Return the Day, Month, and Year in MySQL
MySQL has a bunch of different functions that enable us to get various date parts – such as the day, month, and year – from a date.
Continue readingYEAR() Examples – MySQL
In MySQL, YEAR()
is a built-in date and time function that returns the year from a given date expression.
It returns the year as a number in the range 1000
to 9999
. For zero dates, it could return 0
or NULL
with a warning, depending on the values in your sql_mode
.
Format a Number as Currency in MariaDB
Here’s an example of formatting a number as currency in MariaDB.
Continue readingHow to Format Numbers as Currency in MySQL
Some DBMSs provide us with the ability to format a number as a currency by providing a format specifier for the currency symbol. Providing such a format specifier allows the DBMS to return the appropriate currency symbol for the locale.
MySQL doesn’t have a currency format specifier, and so we need to do a bit of extra work if we want the currency symbol to be returned.
Continue readingInstall MySQL on a Mac
Below are the steps that I used to install MySQL on my M1 Mac via the Homebrew package manager.
As mentioned, this is an M1 Mac (which uses the ARM64 architecture) but that didn’t cause any issues. The current version (MySQL 8.0.26) supports the ARM architechure.
Continue readingHow to Get the Short Month Name from a Date in MySQL
In MySQL, you can use the DATE_FORMAT()
function with the %b
format specifier to return the short month name. For example, you can return Jan
or Feb
instead of January
or February
.
How to Back Up an Azure SQL Edge Database to Local Disk using T-SQL
Microsoft Azure SQL Edge’s backup capabilities are similar to those in SQL Server on Linux, and SQL Server running in containers.
Azure SQL Edge supports T-SQL, and so you can back up your SQL Edge databases by running a T-SQL statement.
In this article, I back up a SQL Edge database to the local disk in my Docker container.
Continue reading