Here are five ways to check whether or not a table exists in a MySQL database.
how to
How to Return Query Results as a Comma Separated List in PostgreSQL
In Postgres, we can use the STRING_AGG() function to transform our query results into a comma separated list.
Instead of each value being output in a separate row (as with any regular query), the values are output to a single row, separated by a comma (or some other delimiter of our choosing).
How to Generate a Random Integer Within a Range in MariaDB
MariaDB includes a RAND() function that returns a random number. More precisely, it returns a DOUBLE precision floating point value v in the range 0 <= v < 1.0.
This is great, but what if you want to generate an integer within a larger range – and a range that you specify?
Fortunately, there’s an easy technique for doing this.
Fix: “operator does not exist: integer || integer” in PostgreSQL
If you get the “operator does not exist: integer || integer” error in PostgreSQL, it’s probably because you’re trying to concatenate two numbers.
If you really want to concatenate two numbers, the easiest way to overcome this issue is to cast at least one of them to a string data type first.
Another way to do it is to use the CONCAT() function.
2 Ways to List all Stored Procedures in MySQL
Below are two options for returning a full list of stored procedures in MySQL.
Fix: “BACKUP LOG cannot be performed because there is no current database backup.” in SQL Server/SQL Edge
If you’re trying to back up the transaction logs in a SQL Server or SQL Edge database, but you get an error that states BACKUP LOG cannot be performed because there is no current database backup, you’ll need to perform at least one full backup of the database before you attempt to back up the transaction logs.
2 Ways to Get the Size of a Database in PostgreSQL
Below are two ways to return the size of a specific database in PostgreSQL.
Subtract Microseconds from a Datetime Value in MariaDB
Here are some options for subtracting one or more microseconds from a datetime expression in MariaDB.