Db2 supports three different hash functions, and each of them can use different algorithms. Let’s shred some light on them to understand their use cases.
Are RIGHT JOINs ever necessary?
RIGHT JOIN
s can always be rewritten as LEFT JOIN
s, and some people consider RIGHT JOIN
s a bad practice. This article explains why.
PostgreSQL: Making a comparison case-insensitive
In PostgreSQL, string comparisons are case-sensitive by default. Making them case-insensitive requires the ILIKE operator and may require an additional index for performance reasons.
Find values above the average
How to find values in a table column that are above (or below) the average of that column.
SQL Server: Raise errors and warnings
Transact-SQL provides facilities to raise errors and warnings, as well as handling them. Here’s an introduction to this subject.
Find values that appear in multiple columns, in different rows
There are situations when you need to find values that occur in multiple columns, but oitentially in different rows. This can be done with the JOIN
or the INTERSECT
statement.
Db2 temporary tables: ON COMMIT and ON ROLLBACK
Let’s see how to preserve, empty or drop temporary tables when a transaction succeeds (COMMIT
) or fails (ROLLBACK
).
Concatenate multiple columns from the same table
Sometimes we want to concatenate multiple table columns, and see them as a single column in our resultset. This may be the case, for example, if we have columns like email1, email2, email3.
Copying tables in MariaDB and MySQL
There are many reasons why we may want to duplicate a table. We may want to copy the table structure alone, or include the rows, we may only want to copy some sample rows. Let’s see how to copy a table in MariaDB and MySQL.
Find dates in a given year
Sometimes we want to find all events that happened in a given year. For example, a count of the sales that happened in the year 2000. It’s frequent to run a correct query that turns out to be slow. Let’s see how to do it properly.