DuckDB has a max_by()
function that finds the row with the maximum value in one column and returns the corresponding value from another column at that row.
Below are some examples that demonstrate how it works.
Continue readingDuckDB has a max_by()
function that finds the row with the maximum value in one column and returns the corresponding value from another column at that row.
Below are some examples that demonstrate how it works.
Continue readingOne of the aggregate functions available in DuckDB is the FIRST()
function, which returns the first value from each group in a query.
Let’s take a look at some examples of using the FIRST()
function in DuckDB
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.
In DuckDB, the strftime()
function is a handy tool for formatting date and timestamp values as strings. It accepts the date/timestamp value and a format string as arguments. The function then returns the date/time in the format provided by the format string.
DuckDB provides us with a good selection of date/time functions. The strptime()
function is a useful one for times where you need to convert a date string into a valid timestamp value; its sole purpose is to parse strings into timestamps.
In this article, we’ll look at how the strptime()
function works, along with some examples to demonstrate.
One of the more commonly used aggregate functions in SQL databases is the sum()
function, which provides an easy way to calculate the total sum of a numeric column. DuckDB is no exception.
In this article, we’ll explore how the sum()
function works in DuckDB, along with some straightforward examples to demonstrate.
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.
DuckDB has a min_by()
function that’s similar to the min()
function, but with a twist. While the min()
function simply returns the minimum value, the min_by()
function finds the row with the minimum value in one column and returns the corresponding value from another column at that row.
Here are some examples that demonstrate how it works.
Continue readingIn SQL databases, COUNT()
is a commonly used aggregation function that returns the number of rows in a group. In this article, I run some examples of the COUNT()
function in DuckDB. DuckDB is a high-performance analytical database system that’s designed to be fast, reliable, portable, and easy to use.
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.