Add Column

Put a new column on the right of your table. Fill it with a fixed value, a formula, or nothing at all.

What it does

Add Column creates one new column. The new column goes to the right of your existing columns. You choose the name, the type, and what goes in it.

Create the column

  1. Type add column in the Search transforms box, in the Pipeline panel.
  2. Click Add Column. The panel opens below the grid.
  3. Go to Column type. Click Text, Number or Date.
  4. Fill in the Value (optional) box at the top of the panel.
  5. Type a name in New column name.
  6. Click Apply.

The name is required. Apply reports an error if you leave it empty.

Two ways to fill the column

The Value (optional) row has a small toggle on the right. It has two settings.

  • Value: type one fixed value. Every row gets that same value.
  • Expression: write a formula. Each row gets its own result. Example: "list_price" * "units_sold".
  • Leave the box empty and the new column has no values. This is a good way to make a blank column for notes.

What Column type changes

ButtonThe Value box becomesValues are stored as
T TextA plain text boxText
# NumberA number boxNumber
D DateA date and time pickerDate

The step converts each result to the type you chose. A value that cannot convert becomes empty. Nothing fails and no row is lost.

Fill only some of the rows

Click Add Condition near the bottom of the panel. A window with the same name opens.

  1. Keep the Visual tab selected.
  2. Open Select a column... and pick a column.
  3. Pick a comparison, then type the value.
  4. Click + And or + Or for more conditions. Click Nested group to group them.
  5. Click Apply Condition.

Rows that match get the value. Rows that do not match stay empty in the new column.

For SQL users

The SQL Expression tab of the condition window takes any DuckDB expression. A Number column with a formula runs as:

SELECT *, TRY_CAST("list_price" * "units_sold" AS DOUBLE) AS "revenue" FROM "products"
Try Add Column with sample data →

Related Operations