Robin Moffatt 2/27/2025

DuckDB tricks - renaming fields in a SELECT * across tables

Read Original

This technical article explains a common problem in DuckDB where SELECT * across joined tables with overlapping column names creates ambiguity. It demonstrates the solution using DuckDB's COLUMNS expression to automatically prefix column names (e.g., t1_\0) from specific tables, providing a clean and reusable alternative to manually aliasing each column. It also mentions newer prefix alias syntax introduced in DuckDB 1.20.

DuckDB tricks - renaming fields in a SELECT * across tables

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week