Sometimes we want to extract a literal value with a
SELECT. This works perfectly fine if the literal value is
'a', but it fails with an error if the value is
NULL. Let’s discuss why and how to solve the problem.
How to know Oracle edition and version number in use for this instance.
How to select rows where a text column starts by, ends by, or contains a string. Including slightly less trivial cases.
MariaDB and MySQL are mostly compatible, while Percona Server is basically MySQL with some optimisations. For this reason, it’s quite common for developers not being sure which of them they are using.
Sometimes, no one in a company knows how many databases they have, or how many commercial licenses they have. So you may be asked to write a report with all the existing MySQL instances, and whether they are Enterprise Editions or Community Editions.
How to select text values that contain HTML tags. How to disallow inserting texts that contain HTML tags.
How to find rows that contain, or don’t contain, a value from a list. The list may be written in the query, or stored in a table.
How to get the length of the longest text in a column. Including Db2 specific syntax.
How to select invalid email addresses from a column. How to reject attempts to insert invalid emails into a column.
How to get statistical data from a column in standard SQL. In particular it shows how to get the minimum, maximum, average values, and the standard deviation.