Building data-driven components and applications doesn't have to be so ducking hardWasm SDK

Back to Table of Contents

This is a summary of a book chapter from DuckDB in Action, published by Manning. Download the complete book for free to read the complete chapter.

Chapter 2: Getting Started with DuckDB

Installing and learning how to use the DuckDB command-line interface (CLI)

The chapter introduces the DuckDB CLI, providing instructions for installing it on various operating systems. For macOS, the recommended approach is using the Homebrew package manager. On Linux and Windows, there are multiple packages available depending on the specific architecture and version. The installation process for each system is straightforward, requiring minimal steps.

Executing commands in the DuckDB CLI

Once installed, the DuckDB CLI can be launched simply by typing duckdb. This connects to a transient in-memory database, which means all data will be lost when the CLI is exited. Users can enter SQL statements directly into the CLI, and results are displayed in a compact table format. Special dot commands, such as .open, .read, and .tables, extend the CLI's functionality, allowing for various operations and configurations.

Querying remote files

DuckDB's CLI can query remote CSV files directly, which is particularly useful for data engineers. By using the httpfs extension, users can query files hosted on HTTP(S) servers without downloading them locally. This feature is demonstrated with examples querying population data from a remote CSV file, showcasing DuckDB's capability to handle external data sources efficiently.