Counting the rows that match a WHERE
condition can be slow, and may return a very high and precise number that is useful to no one. Let’s see how to just check if a query returns more than N rows.
SQL Server extended properties (comments)
Most DBMSs allow to read and write comments about tables, columns and other database objects. SQL Server has a more complex feature called Extended Properties.
MariaDB/MySQL: Comments on database objects
MariaDB and MySQL support a non-standard syntax to read and write comments for database objects.
Comments on database objects
Why and how to write comments on database, tables, and other objects on most DBMSs. How to read comments.
Find Oracle version and edition
How to know Oracle edition and version number in use for this instance.
Make searches at the end of a text fast
Searching for a string at the end of a text column is typically slow, because no index is used. How to build a suitable index and make LIKE '%end'
fast.
Find texts starting, ending or containing a given string
How to select rows where a text column starts by, ends by, or contains a string. Including slightly less trivial cases.
Find out if you’re running MariaDB, MySQL or Percona Server
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.
MySQL: Find out which edition you 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.
Db2: Copying a table
How to create a copy of a table. The copy can contain data, a selective portion of the data, or it can be empty.