In 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.
In 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.
This article contains an example of adding a generated column to a table in MySQL.
Also known as computed columns, generated columns usually contain values that are dependent on other factors (such as the values in other columns).
Creating (or adding) a generated column in MySQL is basically the same as creating a normal column, except that the definition of the generated column contains an expression that determines the column’s value.
Continue readingAlphanumeric characters are alphabetic characters and numeric characters.
Below are examples of using SQL to return rows that contain only alphanumeric characters.
Continue readingHere are three methods we can use to return the first day of a given month in MySQL.
This could be the first day of the current month, or the first day of the month based on a date that we specify.
Getting the first day of the month allows us to perform further calculations on the resulting date, like adding a certain number of days to the start of the month, etc.
Continue readingIn 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 two options for removing duplicate rows from a table in PostgreSQL when those rows have a primary key or unique identifier column. The primary key is used in the query, but it’s ignored when comparing duplicates (due to the fact that primary keys prevent duplicate rows by definition).
The following examples delete duplicate rows but keep one. So in the case of say, three identical rows, it deletes two and keeps one.
Continue readingIn PostgreSQL, we can use the -
operator to subtract one or more hours from a time value.
By “time” value, this could be an actual time
value, a timestamp
, or an interval
. We can also subtract hours from a date
value or a date
and time
combination.
Below are two Oracle Database functions that convert uppercase characters to their lowercase equivalent.
Continue readingHere are four options for returning rows that contain lowercase characters in PostgreSQL.
Continue readingBelow 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 reading