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
- Type add column in the Search transforms box, in the Pipeline panel.
- Click Add Column. The panel opens below the grid.
- Go to Column type. Click Text, Number or Date.
- Fill in the Value (optional) box at the top of the panel.
- Type a name in New column name.
- 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
| Button | The Value box becomes | Values are stored as |
|---|---|---|
| T Text | A plain text box | Text |
| # Number | A number box | Number |
| D Date | A date and time picker | Date |
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.
- Keep the Visual tab selected.
- Open Select a column... and pick a column.
- Pick a comparison, then type the value.
- Click + And or + Or for more conditions. Click Nested group to group them.
- 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
- Select Columns - Pick and reorder columns
- Delete Columns - Remove columns from the table
- Copy Columns - Duplicate columns with custom names