In MariaDB, the UNION
operator combines the results from multiple SELECT
statements into a single result set.
Author: Ian
Return Rows that Only Contain Non-Alphanumeric Characters in SQLite
Here’s an example of returning rows that contain only non-alphanumeric characters in SQLite.
Non-alphanumeric characters include punctuation characters like !@#&()–[{}]:;',?/*
and symbols like `~$^+=<>“
, as well as whitespace characters like the space or tab characters.
MariaDB INTERSECT Operator Explained
In MariaDB, the INTERSECT
operator intersects two queries and returns only those rows that are returned in both queries.
It returns all rows from the left SELECT
result set that are also present in the right SELECT
result set.
6 Ways to Select Duplicate Rows in SQLite
The following queries can be used to return duplicate rows in SQLite.
Here, the duplicate rows contain duplicate values across all columns, including the ID column.
Continue readingMariaDB EXCEPT Operator Explained
In MariaDB, the EXCEPT
operator returns rows from the left input query that aren’t output by the right input query.
Another way of putting it is that it returns all rows from the left SELECT
result set except rows that are in right SELECT
result set.
5 Ways to Select Rows with the Maximum Value for their Group in SQL
Here are five options for using SQL to return only those rows that have the maximum value within their group.
These examples work in most major RDBMSs, including MySQL, MariaDB, Oracle, PostgreSQL, SQLite, and SQL Server.
Continue reading3 Ways to Create a Table if it Doesn’t Already Exist in Oracle
The very useful CREATE TABLE IF NOT EXISTS
syntax was finally introduced in Oracle Database – Oracle Database 23c to be precise. This syntax allows us to run a CREATE TABLE
statement without getting an error if the table already exists.
Earlier versions of Oracle don’t support the IF NOT EXISTS
clause, and so if we want to avoid any nasty errors resulting from trying to create a table that already exists, we need to do a bit of extra work.
Find Values That Don’t Contain Numbers in MySQL
If you need to return all rows that don’t contain any numbers, the following might help.
Strictly speaking, numbers can be represented by words and other symbols, but for this article “number” simply means “numerical digit”. So we’re finding values that don’t contain any numerical digits.
Continue readingHow to Format Numbers as Roman Numerals in Oracle
When using the TO_CHAR()
function in Oracle Database, you can use the RN
format element to return the number as roman numerals. Using lowercase (rn
) returns the roman numerals in lowercase.
3 Ways to Select the Row with the Maximum Value in SQL
Here are three examples that use SQL to find and select the row with the maximum value in a given column.
The examples work in most major RDBMSs, including MySQL, MariaDB, PostgreSQL, SQLite, Oracle, and SQL Server.
Continue reading