In SQLite we can use the lower()
function to convert uppercase characters to lowercase.
Category: SQLite
Find 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 readingAdd Years to a Date in SQLite
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.
Find 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 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 readingSubtract Minutes from a Time Value in SQLite
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.
Return 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).
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.