# Exploring with DuckDB

> A database in your browser, pointed at Parquet over HTTP. Work the Catgirl University case with SQL, from a password spray to a stolen answer key.

Source: https://jaredgore.com/guides/data-lakes/duckdb/

Because it's the least ceremony per unit of insight in the entire database world. One binary, no server, no daemon, no container. It reads Parquet straight out of S3 (or a folder on disk, or your browser via WASM) without importing anything — the file *is* the table. And it's fast enough that most security questions live comfortably on a laptop. SQL is the one skill from the last thirty years everyone in this industry half-knows; DuckDB cashes that in.

## How the lab works

DuckDB runs in your browser here (it's WebAssembly), and each table is a view over the lake's Parquet files. Write a query and run it. A question is cracked when its answer shows up in the **first row** of your result, so sort your results. Each one you crack pins a clue to the case file.

Stuck? Hints are free. "Show a solution" works too, but it breaks your clean-solve streak.

> *LakeLab runs on the web page: https://jaredgore.com/guides/data-lakes/duckdb/*

## What you just did

Every lake investigation has the same skeleton, and you just ran it: count things, group things, filter, pivot from one table to the next on the field they share — an IP, a username, a host. Start wide and boring ("what's even in this table?"), then narrow: which source IP tried the most usernames, which user got touched most, which *other* tables mention either of them. Keep a running timeline as you go; timestamps from different tables sorted together are how "random spray" turns into "coordinated intrusion". The tool doesn't matter. The pivot does.

## Running it locally

Same SQL, two homes. Grab the [DuckDB CLI](https://duckdb.org/docs/installation/) (`brew install duckdb`, or the binary for your platform), then either download the lake's files and point at them, or query them in place with `INSTALL httpfs; LOAD httpfs;` and read the URLs directly — for a public bucket you don't even need credentials. Run the same queries you just ran in the browser. The browser is the demo; the CLI is where the real work happens — output to CSV, pipe it into whatever, iterate without a browser tab eating your RAM. Nothing about the queries changes. That's the trick of the whole architecture.

## Check it

**Why can DuckDB query the lake without importing anything first?**

It reads Parquet in place, from disk, S3 over httpfs, or the browser through WASM. The file is the table.

**What's the skeleton of every lake investigation?**

Count, group, filter, then pivot to the next table on a shared field such as an IP, username or host. Start wide, narrow down, and keep a timeline as you go.

**What changes when you move these queries from the browser to the DuckDB CLI?**

Nothing in the SQL. You get local files or httpfs, CSV output and pipes, and no browser tab eating your RAM.
