Fix “No function matches the given name and argument types ‘bool_and(INTEGER)'” in DuckDB

If you’re getting an error that reads something like “No function matches the given name and argument types ‘bool_and(INTEGER)’” in DuckDB, it’s probably because you’re passing a non-boolean value to the bool_and() function.

The bool_and() function is for use against boolean expressions, so to fix this issue, be sure that the argument you pass to the function is a boolean expression.

Continue reading

Enable Vertical Query Output in DuckDB

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.

Continue reading

How to Create a Partial Index in SQLite

Partial 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

How to Output Query Results as JSON in the DuckDB CLI

DuckDB is a lightweight, fast database management system designed for analytics and embedded use cases. Its versatility makes it an excellent choice for developers and data analysts.

One useful feature of DuckDB is the ability to output query results in different formats, such as JSON, directly from the command-line interface (CLI). By default, the DuckDB CLI uses the duckbox output mode for query results (which outputs the results in a table-like format), but we can change that.

In this article, we’ll walk through the steps to output query results as JSON when using the DuckDB CLI.

Continue reading