DataBrighten

    DuckDB sample databases for practice

    DuckDB is an in-process analytics database: like SQLite it needs no server, but it is built for fast GROUP BY and window queries over large tables, and it reads CSV and Parquet files directly. Here are 13 practice databases as DuckDB scripts, each with six questions whose answers were produced by DuckDB 1.5.6.

    DuckDB SQL in these exercises

    The questions are the same on every engine; what changes is the syntax. These are the DuckDB-specific parts you will meet:

    • strftime(date, '%Y-%m') formats a date as year-month text (note the argument order differs from SQLite).
    • year(date) returns the year as a number.
    • date_diff('day', earlier, later) returns the number of days between two dates.
    • LIMIT n at the end returns the first n rows.
    • Yes/no columns are real BOOLEAN values.
    • || joins strings.
    • substr(text, start, length) cuts out part of a string.
    • 1.0 * a / b gives a decimal result.
    • AVG works on integers and decimals directly.
    • DuckDB supports all standard window functions.
    • LENGTH counts characters.
    • Text comparison is case-sensitive by default.

    Other engines

    SQLite · PostgreSQL · MySQL · SQL Server

    The data is fictional and released under CC0. AdventureWorks, Northwind and Sakila are well-known sample databases from their vendors; we do not copy them here.