Understanding SQLite’s CAST() Expression

SQLite is a widely-used lightweight database engine that powers many mobile, embedded, and desktop applications. One of its key features is its dynamic type system, which allows flexibility in handling data. While this is advantageous in many scenarios, there are cases where developers need precise control over how data is treated or converted between types. This is where SQLite’s CAST() expression comes in.

Continue reading

What ?TABLE? Means When using .help mode in DuckDB

If you’ve ever run .help mode in the DuckDB command line interface (CLI), you may have noticed that it returns information about the .mode command, including its syntax.

You might’ve noticed that there’s a ?TABLE? part in the syntax. What’s this about? Maybe you’ve tried it out and found that it didn’t appear to do anything?

In this article, I’ll explain what the ?TABLE? part is for, and I’ll run an example to demonstrate.

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