Most RDBMSs provide at least a few ways to return rows that contain uppercase characters. Here are some options available in the major RDBMSs.
Continue readingCategory: PostgreSQL
How to Get the Last Day of the Month in SQL
Below are examples of using SQL to return the last day of the month across various DBMSs.
This could be the last day of the current month, or the last day of a month based on a given date.
Continue readingFind Duplicate Rows that have a Primary Key in SQL
Here are examples of using SQL to return duplicate rows when those rows have a primary key or other unique identifier column.
These queries work in most of the major RDBMSs, including SQL Server, Oracle, MySQL, MariaDB, PostgreSQL, and SQLite.
Continue readingHow to Get the Definition of a Generated Column in PostgreSQL
If you have a generated column in PostgreSQL, you can use the following methods to find the definition of that column.
Continue readingFind Rows that Contain Lowercase Characters in SQL
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 readingHow to Create a Generated Column in PostgreSQL
In PostgreSQL, a generated column is a special column that is always computed from other columns. A generated column doesn’t have a fixed value like in a base column. Rather, its value is determined by an expression that references other columns in the table.
Generated columns are included in the SQL standard (ISO/IEC 9075), and are supported by most major RDBMSs. Generated columns were first introduced in PostgreSQL 12.
Continue readingSelect Duplicate Rows in SQL
Here’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 readingHow to Convert a Unix Timestamp to a Date/Time in SQL
Here 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 readingReturn Rows that Contain Only Alphanumeric Characters in SQL
Alphanumeric characters are alphabetic characters and numeric characters.
Below are examples of using SQL to return rows that contain only alphanumeric characters.
Continue readingSQL ISNULL() Explained
Some 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).