Back to Code Snippets
Filter column names using a pattern
Editor's note: DuckDB aims to make SQL even easier, while supporting standards whenever possible. When you have extremely wide tables, it's often helpful to return only columns matching a regex, and COLUMNS() does exactly that. With the EXCLUDE() and REPLACE() functions you get even more simplicity.
Execute this SQL
-- select only the column names that start with the dim_ SELECT COLUMNS('^dim_') FROM fact_table;
Copy code
Octavian Zarzu
Expand
Share link