sql-style · git:20260925.63a0a57 · 2026-09-25 · sha256 ed8985963e5579bf

sql-style git:20260925.63a0a57A

Immutable. This exact content never changes and is served at /api/v1/blob/ed8985963e5579bf.

No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_lggtuztwjsm35557/ed8985963e5579bf910a71128bd09a938718b5cbae26520bec087d9b81ea2dfe.json

Then /plugin install sql-style@markdownregistry-lggtuztwjsm35557 in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.

---
name: sql-style
description: How to query the shop warehouse (tables, joins, date ranges).
---

# Warehouse SQL style

Tables:

- `orders(id INTEGER, placed_at TEXT /* YYYY-MM-DD */, amount_cents INTEGER)`
- `refunds(order_id INTEGER, refunded_at TEXT, amount_cents INTEGER)`

Rules:

1. Money is stored in cents. Divide by `100.0` only in the final projection.
2. Net revenue = `SUM(o.amount_cents - COALESCE(r.amount_cents, 0))` with
   `LEFT JOIN refunds r ON r.order_id = o.id`.
3. Date ranges are half-open: `placed_at >= :start AND placed_at < :end`.
4. Always filter by date. A query without `WHERE` scans every order and needs
   a person's approval.