3 Ways to Get the Minimum Value from a List in DuckDB

Most SQL developers are familiar with the min() function that allows us to get the minimum value from a data set. But if we want to get the minimum value from a list, passing the list to the min() function won’t quite cut it. But don’t despair! Finding the minimum value in a list is just as easy. Here are three ways to do it. And yes, we can even use the min() function if we want.

Read more

4 Ways to Concatenate 3 or More Lists in DuckDB

If you’ve ever used list_concat() or any of its aliases to concatenate lists in DuckDB, you may have been disappointed to find out that it only concatenates two lists. Any more than two lists and it returns an error. At least that’s how it works at the time of this writing.

Fortunately, there are some alternatives we can use in order to concatenate three or more lists.

Here are four ways to concatenate three or more lists in DuckDB.

Read more

Calculating Time Differences in DuckDB

DuckDB has emerged as a powerful analytical database system designed for fast in-memory data processing. One common analytical task involves calculating time differences between events—whether measuring intervals between transactions, tracking service response times, or analyzing temporal patterns in time series data.

This article provides an exploration of calculating time differences in DuckDB, covering both basic and slightly more advanced techniques.

Read more

TYPEOF() vs PG_TYPEOF() in DuckDB: What’s the Difference?

You may be aware that DuckDB includes a typeof() function that works just like the SQLite equivalent; it returns the data type of its argument. But did you know that DuckDB also provides us with a pg_typeof() function that does essentially the same thing?

So why would DuckDB need a pg_typeof() function that does basically the same thing as typeof()? Let’s find out!

Read more

Subtract Days from a Date in DuckDB

DuckDB provides us with a couple of easy ways to perform additions and subtractions on dates. In particular, we can use the - operator to do the job, or the date_add() operator combined with the - operator.

Here are two options for subtracting days from a date in DuckDB.

Read more