We saw in another article how to build an array from an SQL query (from each row, or from a column). This article shows how to loop over an array items.
Tag: level-beginner
Simple articles that can be understood by beginners, but can be useful to experts as well.
MariaDB/MySQL: How to get the first and last day of the month
Different databases support different ways to get the first and last day of the month. Let’s see how to do it in MariaDB and MySQL.
How to get the highest and lowest value in a row in SQL
It is well-known how to get the highest and lowest values in a table column, but it is a bit less known how to get the highest and lowest values in a row. Let’s see how to do it.
MariaDB CRUD operations Hello World
Let’s see a slightly elaborated “Hello world”, to demonstrate the most common SQL operations with MariaDB: creating a database and a table, inserting a row, reading it, modifying it, deleting it.
SQL Server: Concatenate strings (NULL-safe)
There are several ways to concatenate strings in SQL, and they mainly differ in how they handle NULL
values.
PostgreSQL: Tables without columns
PostgreSQL allows to create, read and write tables without columns. Let’s see how to work with them, and whether they can have practical uses.
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.
The difference between WHERE and HAVING
SQL clauses WHERE
and HAVING
have different functions. But they both filter out rows, so many people don’t know the important difference between them. Let’s shred some light.