In DuckDB, avg()
is an aggregate function that returns the average of all non-NULL values in its argument (usually a column).
In this article we’ll take a quick look at this function, along with some basic examples.
Continue readingIn DuckDB, avg()
is an aggregate function that returns the average of all non-NULL values in its argument (usually a column).
In this article we’ll take a quick look at this function, along with some basic examples.
Continue readingDuckDB is a high-performance, in-process SQL database management system that supports various modes of operation, including the ability to create an in-memory database. An in-memory database stores all data in RAM, ensuring fast access and excellent performance.
This article explores how to create an in-memory database in DuckDB.
Continue readingSQLite is a lightweight, self-contained database engine renowned for its simplicity and flexibility. One of its unique features is the way it handles data types through type affinity, which determines how SQLite associates values with storage classes.
Unlike many database systems that enforce strict type constraints, SQLite’s type affinity system is more flexible, accommodating a broader range of data.
Continue readingIn DuckDB, arg_min()
is an aggregate function that finds the row with the minimum value in one column and returns the corresponding value from another column at that row. Rows where either of the first two expressions is NULL
 are ignored.
In this article we explore DuckDB’s arg_min()
function with some simple examples.
In DuckDB, arg_max()
is an aggregate function that finds the row with the maximum value in one column and returns the corresponding value from another column at that row. Rows where either of the first two arguments is NULL
 are ignored.
Let’s take a look at the arg_max()
with some straightforward examples.
In SQLite, the pow()
function calculates the result of raising one number to the power of another. In other words, it performs an exponentiation operation.
The pow()
function is particularly useful for mathematical operations where powers or exponents are required.
It’s also available as power()
. Both syntaxes do the same thing.
When using DuckDB’s command line interface (CLI), we can use the .mode
command to change how query results are formatted. For example, we can output query results as a table, in CSV format, or even JSON. Another option is to output it in “line” mode, which outputs the query results vertically, as opposed to horizontally across the screen.
This article demonstrates how to enable vertical query output in the DuckDB CLI with line
mode.
In DuckDB, the CONCAT_WS()
function provides an efficient way to join strings with a specified separator. CONCAT_WS()
stands for “concatenate with separator”, and many RDBMSs have such a function.
CONCAT_WS()
is particularly useful when you need to combine multiple fields or values with a consistent delimiter.
Let’s explore its features and practical applications.
Continue readingString concatenation is a common operation in database queries, and many database management systems (DBMSs) provide at least one or two ways to concatenate strings. DuckDB is no exception.
One option for concatenating strings in DuckDB is with the CONCAT()
function. This function provides a robust and NULL-safe way to combine strings.
Unlike the concatenation operator (||
), CONCAT()
handles NULL values gracefully and provides a cleaner syntax for combining multiple strings.
In this article, we’ll explore everything from basic usage to advanced techniques and best practices.
Continue readingPartial indexing is a feature in many DBMSs, including SQLite, that allows developers to optimize database performance by creating indexes only for specific subsets of data. This can significantly reduce the index size and improve query speed, especially in cases where only a portion of the data is frequently queried.
In this article, we’ll look at how to create a partial index in SQLite, why it’s useful, and provide an example to illustrate its use.
Continue reading