Using the .nullvalue Command to See NULL Output in the DuckDB CLI

By default, when a query returns a null value in the DuckDB command line interface (CLI), an empty string is displayed. This may or may not be what you want. But if you’re like me, you probably want DuckDB to explicitly tell you that it’s a null value. After all, if an empty string is returned, perhaps the data contained an empty string?

Fortunately, DuckDB provides us with the .nullvalue dot command so that we can change the output of null values.

Continue reading

A Quick Look at the LIST() Function in DuckDB

DuckDB, an in-memory analytical SQL database management system, provides a good selection of functions for data manipulation and analysis. One of the these functions is list().

The list() function enables users to group multiple values into a single list, allowing for more advanced data aggregation and operations.

In this article, we’ll explore how the list() function works, along with some simple examples.

Continue reading

RESERVOIR_QUANTILE() Examples in DuckDB

DuckDB includes a reservoir_quantile() function that allows us to compute approximate quantiles efficiently. It provides the approximate quantile using reservoir sampling. This function can be handy when working with large datasets where exact quantile computation would be too slow or resource-intensive.

In this article, we will explore how the reservoir_quantile() function works, along with examples to demonstrate its usage.

Continue reading