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.
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.
If you have a table with duplicate rows in PostgreSQL, you can use any of the following queries to return the duplicate rows.
Below are two methods for returning rows that only contain alphanumeric characters in Oracle Database.
Alphanumeric characters are alphabetic characters and numeric characters.
The following example returns all rows that don’t contain any numbers in PostgreSQL.
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.
Here are four options for returning rows that contain uppercase letters in PostgreSQL.
Oracle Database provides us with the ability to return the month from a date using roman numerals.
For example, if the month is August, its decimal value would be 08 and it’s roman numeral equivalent would be VIII.
The way to do this is to use the RM or rm format element in your format mask. That will format the month using roman numerals in uppercase or lowercase respectively.
Specifying the date format can be done in several places.