---
title: "Even Friendlier SQL with DuckDB"
description: "DuckDB extends SQL syntax with features that simplify everyday queries and enable dynamic analysis."
url: "https://swe.quest/articles/even-friendlier-sql-with-duckdb-26e7b4e6715ab305"
canonical: "https://duckdb.org/2023/08/23/even-friendlier-sql.html"
source: "DuckDB"
published: "2023-08-23"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 16
tags: ["sql","analytics","databases"]
---

# Even Friendlier SQL with DuckDB

A post on [DuckDB](https://swe.quest/sources/duckdb.md), published 2023-08-23, 16 min read, Deep dive. Original: [https://duckdb.org/2023/08/23/even-friendlier-sql.html](https://duckdb.org/2023/08/23/even-friendlier-sql.html)

## Summary

DuckDB extends SQL syntax with features that simplify everyday queries and enable dynamic analysis. Additions include reusable column aliases within a SELECT, COLUMNS() for selecting and transforming columns by regex, EXCLUDE/REPLACE or lambda, automatic JSON-to-nested-type conversion with dot notation, FROM-first queries, dot-operator function chaining, UNION/INSERT BY NAME, and dynamic PIVOT/UNPIVOT that need no hardcoded column values. Each feature is shown next to the verbose standard-SQL equivalent it replaces.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [SQL](https://swe.quest/tags/sql.md) (Languages)
- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)

## Prerequisites

- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))

## Keywords

DuckDB, COLUMNS expression, PIVOT, UNION BY NAME, httpfs, JSON

## Related posts

- [Gems of DuckDB 2.0.0](https://swe.quest/articles/gems-of-duckdb-2-0-0-0cf205137ec12582.md): DuckDB · 2026-10-26 · Medium · 8 min read · Databases, SQL, Analytics & OLAP, Python
  DuckDB 2.0.0 LTS includes a set of smaller features beyond its headline items.
- [Ducks in a Column](https://swe.quest/articles/ducks-in-a-column-ce42623eb848a791.md): DuckDB · 2026-11-10 · Medium · 12 min read · SQL, Analytics & OLAP, Query engines
  DuckDB stores data by column and processes it in vectors of 2,048 values, which drives its compression, projection pushdown and aggregation speed.
- [SQL or NoSQL? Why not use both (with PostgreSQL)?](https://swe.quest/articles/sql-or-nosql-why-not-use-both-with-postgresql-98c239e2ff7e761c.md): Supabase · 2022-11-24 · Medium · 12 min read · PostgreSQL, SQL, Databases
  PostgreSQL's JSONB columns let an app store nested, variable-length data (here, a daily food, water and exercise log) as a single row instead of spreading it across several normalized tables, while keeping SQL available for analysis.
- [DuckDB: analyze 50,000+ datasets stored on the Hugging Face Hub](https://swe.quest/articles/duckdb-analyze-50-000-datasets-stored-on-the-hugging-face-hub-05ca0d0e06164c0a.md): Hugging Face · 2023-06-07 · Medium · 3 min read · Analytics & OLAP, SQL, Python
  Every public dataset on the Hugging Face Hub is now automatically converted to Parquet by the dataset viewer and can be queried with SQL through DuckDB.
- [DuckDB Tricks – Part 1](https://swe.quest/articles/duckdb-tricks-part-1-99ece69aab247417.md): DuckDB · 2024-08-19 · Medium · 5 min read · SQL, Databases, Analytics & OLAP
  Five DuckDB SQL tricks for interactive use, built around a small example CSV and DuckDB's friendly SQL shorthands such as FROM-first syntax.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
