In SQLite, we can use the DATE()
function to add one or more years to a date.
For datetime values, we can use the DATETIME()
function.
In SQLite, we can use the DATE()
function to add one or more years to a date.
For datetime values, we can use the DATETIME()
function.
Most RDBMSs provide at least a few ways to return rows that contain lowercase characters. Here are some options available in the major RDBMSs.
Continue readingHere’s an example of using SQL to find duplicate rows in a database table. This technique can be used in most of the major RDBMSs, including SQL Server, Oracle, MySQL, MariaDB, PostgreSQL, and SQLite.
Continue readingHere are examples of converting a Unix timestamp to a date/time value in some of the major RDBMSs.
The Unix timestamp (also known as Unix Epoch time, Unix time, or POSIX time) is the number of seconds that have elapsed since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC).
Continue readingIn SQLite, we can use the TIME()
function to subtract one or more minutes from a time value.
For datetime values, we can use the DATETIME()
function.
Alphanumeric characters are alphabetic characters and numeric characters.
Below are examples of using SQL to return rows that contain only alphanumeric characters.
Continue readingSome RDBMSs provide an ISNULL()
function that can be used when dealing with potentially null values.
MySQL, MariaDB, and Oracle Database each have an ISNULL()
function that returns 1
if its argument is null
, and 0
if it’s not.
SQL Server also has an ISNULL()
function, but it works differently. It works more like how the IFNULL()
function works in some other RDBMSs.
Other RDBMSs, such as PostgreSQL and SQLite don’t include an ISNULL()
function, but they do support the IS NULL
predicate (as do the other RDBMSs).
In SQLite, we can use the TIME()
function to add a given number of seconds to a time value.
If we’re dealing with datetime values, we can use the DATETIME()
function.
Below are examples of using some of the more popular RDBMSs to return the Unix timestamp.
The Unix timestamp (also known as Unix Epoch time, Unix time, or POSIX time) is the number of seconds that have elapsed since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC).
Continue readingHere are two options for returning the number of days in a given month in SQLite. This could be the number of days in the current month, or it could be based on a given date.
Continue reading