Skip to content
Initializing playground engine...

Projection

DQL has many ways to choose, reshape, and reorder columns. This tutorial walks through each form. Press Run (or Ctrl+Enter) to execute.

Pick Columns

The pipe operator |> followed by parentheses selects specific columns.

Exclude Columns

-(columns) keeps everything except the listed columns.

Rename

*(column as new_name) renames columns in-place without changing column order or dropping the others.

Pattern Matching

Use a regex between slashes to select columns whose names match.

Column Ordinals

|N| selects the Nth column by position. |-1| is the last column.

Ordinal Ranges

|N:M| selects a contiguous range. Open ends are allowed: |5:| means "from column 5 onwards", |:3| means "first three columns".

Try |5:| to select from column 5 onward, or |-3:-1| for the last three.

Negative Ordinals

Negative ordinals count from the end. |-1| is the last column, |-3:-1| is the last three.

Reposition

*[column as N] moves a column to position N without dropping anything. Use negative positions to count from the end.

Try *[id as -1] to move id to the end instead.

Embed Column

+(expression as name) embeds a new column without dropping existing ones.

Map Cover

$(fn)(columns) applies a function to selected columns in-place, leaving everything else untouched.

Transform

$$( ) replaces columns in-place with computed expressions. The column keeps its position in the row.

Map Embed

+$(template)(selector) adds new columns derived from matched columns.

Argumentative Selection

Name the columns you want in positional order -- use _ to skip a column.

Argumentative Rename

Giving a positional slot a new name renames the column it maps to.