The following PostgreSQL examples return only those rows that have numeric values in a given column.
Continue readingAuthor: Ian
4 Ways to Insert Multiple Rows in Oracle
If you use DBMSs such as MySQL or SQL Server, the syntax for inserting multiple rows into a table with a single statement is quite straightforward.
But if you use Oracle Database, you’ll need to use a different syntax.
Continue reading2 Ways to Return Rows that Contain Only Alphanumeric Characters in PostgreSQL
Below are two methods for returning rows that only contain alphanumeric characters in PostgreSQL.
Alphanumeric characters are alphabetic characters and numeric characters.
Continue readingFix Error Msg 4151 “The type of the first argument to NULLIF cannot be the NULL constant because the type of the first argument has to be known” in SQL Server
If you get error Msg 4151 “The type of the first argument to NULLIF cannot be the NULL constant because the type of the first argument has to be known” in SQL Server, it’s because you’re passing a null value as the first argument to the NULLIF()
function.
To fix this error, make sure you do not pass the null constant as the first argument to the function. Or if you do, then convert it to a specific data type.
Continue readingHow to Create a Table Only if it Doesn’t Exist in SQLite
In SQLite, you can use the IF NOT EXISTS
clause of the CREATE TABLE
statement to check whether or not a table or view of the same name already exists in the database before creating it.
Creating a table without this clause would normally result in an error if a table of the same name already existed in the database. But when using the IF NOT EXISTS
clause, the statement has no effect if a table already exists with the same name.
How to Remove the Right Padding on the Day Name in Oracle
In Oracle Database, when using the TO_CHAR()
function to return the day name from a date, padding will be appended to the day name if it’s shorter than the longest valid day name for the given language and calendar.
Well, that’s the default behaviour. However, you can change this if you wish.
To suppress this padding, all you need to do is prepend the day name format element with fm
.
How to Return the Day Number with a Suffix in MariaDB
MariaDB includes a large collection of date and time functions that return a given date in a certain format.
One thing you can do is return the day number with the relevant “st/nd/rd/th” suffix. For example, instead of returning it as say, 10 July 2025, it’s returned as 10th July 2025.
Below is an example of adding the relevant suffix to a day number in MariaDB.
Continue reading2 Ways to Return Rows that Contain Alphanumeric Characters in MySQL
Below are two options for finding those rows that contain alphanumeric characters in MySQL.
Alphanumeric characters are alphabetic characters and numeric characters.
Continue readingConvert Query Results to a Comma Separated List in MariaDB
In MariaDB, we can use the GROUP_CONCAT()
function to return our query results as a comma separated list. By that I mean, for a given column, we can convert all rows into a single row that contains a comma separated list of the values that made up that column. Each row is a separate item in the list.
4 Ways to Find Rows that Contain Lowercase Letters in Oracle
Here are four options for returning rows that contain lowercase characters in Oracle Database.
Continue reading