In PostgreSQL, the COALESCE() operator returns the first non-null value from its list of arguments. If all arguments are null, it returns null.
DBMS
Database Management Systems
Add Seconds to a Time Value in SQLite
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.
MySQL CASE Statement
In MySQL, the CASE statement can be used in stored programs to perform a complex conditional construct. It compares a list of conditions and returns a different result depending on which condition (if any) is matched.
The CASE statement is different to the CASE operator, in that the CASE statement is specifically for use in stored programs. Also, there’s a slight difference in the syntax.
2 Ways to Delete Duplicate Rows in PostgreSQL (Ignoring the Primary Key)
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.
Subtract Hours from a Time Value in PostgreSQL
In 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.
2 Ways to Convert to Lowercase in Oracle
Below are two Oracle Database functions that convert uppercase characters to their lowercase equivalent.
MySQL CASE Operator
In MySQL, the CASE operator compares a list of conditions and returns one of multiple possible result expressions.
The CASE expression is included in the SQL standard (ISO/IEC 9075), and most major RDBMSs support it.
MySQL also has the CASE statement, which is slightly different to the CASE operator. This article is about the CASE operator.
4 Ways to Find Rows that Contain Lowercase Letters in PostgreSQL
Here are four options for returning rows that contain lowercase characters in PostgreSQL.
MariaDB CASE Operator
In MariaDB, we can use the CASE operator to compare a list of conditions and return a different result depending on which condition (if any) is matched.
The CASE expression is included in the SQL standard (ISO/IEC 9075), and most major RDBMSs support it.
MariaDB also has the CASE statement, which is slightly different to the CASE operator. This article is about the CASE operator.