Shape / columns · All operations
Add a calculated column
New column from a formula or expression.
Status
- In arcform
Runs as a SQL step
arcform carries it as a
sql:step today.- Shape of the result
- one row out per row in, with columns added or changed
- Level
- one clause of SQL
The DuckDB step
A column from an expression
It reads the orders table the proofs share. Create it first:
CREATE TABLE orders AS SELECT * FROM (VALUES
(1, 'Alice Ng', 'north', DATE '2026-01-03', 120.00, 'widget', 'a|b', '{"channel":"web","items":[1,2]}'),
(2, 'alice ng', 'north', DATE '2026-01-05', 80.50, 'gadget', 'b', '{"channel":"shop","items":[3]}'),
(3, 'Bob Okafor', 'south', DATE '2026-01-05', 300.00, 'widget', 'a|c', '{"channel":"web","items":[4,5,6]}'),
(4, 'Carla Díaz', 'east', DATE '2026-01-09', NULL, 'gizmo', NULL, '{"channel":"web","items":[]}'),
(5, 'Bob Okafor', 'south', DATE '2026-01-12', 45.25, 'gadget', 'c', '{"channel":"phone","items":[7]}'),
(6, 'Dev Patel', 'west', DATE '2026-01-12', 510.00, 'widget', 'a', '{"channel":"web","items":[8,9]}'),
(7, 'Carla Diaz', 'east', DATE '2026-01-20', 99.99, 'gizmo', 'b|c', '{"channel":"shop","items":[10]}'),
(8, 'Dev Patel', 'west', DATE '2026-02-02', 510.00, 'widget', 'a', '{"channel":"web","items":[8,9]}'),
(9, 'Eve Larsen', NULL, DATE '2026-02-03', 15.00, 'gadget', NULL, '{"channel":"web","items":[11]}'),
(10, 'Alice Ng', 'north', DATE '2026-02-10', 220.00, 'gizmo', 'a|b|c', '{"channel":"phone","items":[12,13]}')
) t(order_id, customer, region, order_date, amount, product, tags, meta);Then run the statement:
CREATE TEMP TABLE result AS
SELECT order_id, amount, round(amount * 1.2, 2) AS gross FROM orders;
SELECT * FROM result;
SELECT CASE WHEN ((SELECT max(gross) FILTER (WHERE order_id = 1) = 144 AND count(gross) = 9 FROM result)) THEN 'as expected' ELSE error('gross is not amount times 1.2') END AS verdict;- It needs nothing installed beyond DuckDB itself.
- The statement checks its own result and raises an error when it is wrong: “gross is not amount times 1.2”.
- It passed on DuckDB
v2.0.0 (Cyanoptera) d54cbbe3df.
Variants
- Copy a column
Add a copy of an existing column under a new name.
- Stamp rows with load metadata
Add columns recording where and when each row was loaded, such as a timestamp, source file, batch id or change kind.
- Apply one formula to many columns
Apply the same expression to each of a set of columns, creating or updating one column per input.
- Overwrite a column with a formula
Replace the values of an existing column with the result of an expression or another column's values, adding no column.
- Aggregate across columns in each row
Combine the values of several columns within each row, such as their sum, mean or maximum, into a new column.
Add a column from an expression
Add a column whose value for each row is computed by an expression over that row's columns.
Add a constant or empty column
Add a column holding the same literal value, or no value, in every row.
What other tools call it
Meridian's classification; an independent blind rating agreed on 86.2% of 312 rows (exact class, version 2).
Alteryx Designer (3)
Formularead 2026-09-27Create or update columns from one or more expressions
Formula In-DBread 2026-09-27Create or update fields inside the database with a native SQL expression
Multi-Field Formularead 2026-09-27Apply one expression across many fields to create or update them
Apache DataFusion (5)
Comparison Operatorsread 2026-09-2717 operators: =, !=, <, IS DISTINCT FROM, ~ (regex match), also ~~ (LIKE)
EXTENDread 2026-09-27Pipe: add computed columns to the input, BigQuery-style |> syntax
Logical Operatorsread 2026-09-272 operators: AND, OR
Other Operatorsread 2026-09-273 operators: || (concatenate), @> (array contains), <@ (array is contained by)
with_columnread 2026-09-27DataFrame method: Add or replace a column from an expression
Apache Hop (6)
Add Constantsread 2026-09-27Add columns holding constant values to every row
Calculatorread 2026-09-27New columns from a menu of predefined arithmetic, date and string calculations
Formularead 2026-09-27New columns from Excel-style formulas evaluated by Apache POI
Set field Value to a fieldread 2026-09-27Overwrite a field with the value of another field
Set field value to a constantread 2026-09-27Overwrite a field with a constant value
User Defined Java Expressionread 2026-09-27New or replaced columns from Java expressions compiled by Janino
Apache NiFi (5)
Evaluating Multiple Attributesread 2026-09-278 functions: anyAttribute, allAttributes, anyMatchingAttribute, allMatchingAttributes, anyDelineatedValue, …
Standalone Functionsread 2026-09-2732 functions: substring, substringAfter, substringAfterLast, substringBefore, substringBeforeLast, …
Subjectless Functionsread 2026-09-278 functions: ip, hostname, UUID, nextInt, literal, …
UpdateAttributeread 2026-09-27Set FlowFile attributes with Expression Language, or delete attributes matching a regex
UpdateRecordread 2026-09-27Update the record fields selected by RecordPath with user-defined values
Apache SeaTunnel (3)
Copyread 2026-09-27Copy a field to one or more new fields
Metadataread 2026-09-27Expose row metadata (database, table, row kind, event time, delay, partition) as fields
RowKindExtractorread 2026-09-27Turn a change stream into append-only rows and keep the original row kind in a new field
AWS Glue (2)
Add Current Timestampread 2026-09-27Mark each row with the time at which the data was processed
Derived Columnread 2026-09-27Define a column by a math formula or SQL expression over other columns and constants
Azure Data Factory (3)
Adding and Transforming Columnsread 2026-09-27Table.AddColumn, Table.TransformColumns, Table.ReplaceValue, Table.DuplicateColumn
Derived columnread 2026-09-27Create columns or modify existing ones with the data flow expression language
Expression functionsread 2026-09-27117 functions: abs, acos, add, and, asin, …
Bruin (1)
Dimensionsread 2026-09-27Named fields or expressions, with time granularities, to select, group, filter or sort by
dbt-utils (1)
Comparison functionsread 2026-09-271 macro: equals
DuckDB (1)
Lambda Functions (family)read 2026-09-27The functions documented on the Lambda Functions page
Duckle (9)
Add Columnread 2026-09-25add a column from a SQL expression
Audit Stampread 2026-09-25append loaded-at, source and batch id columns
Compare Columnsread 2026-09-25boolean column from comparing two columns
Format Stringread 2026-09-25format a string from a template
Lengthread 2026-09-25string length
Repeatread 2026-09-25repeat a string N times
Reverseread 2026-09-25reverse the characters of a string
Substringread 2026-09-25substring by position
Text Matchread 2026-09-25boolean column: contains, starts with or ends with a substring
EasyMorph (2)
Calculate new column(s)read 2026-09-27Add columns computed by expressions over existing columns
Modify column(s)read 2026-09-27Overwrite existing columns with values computed by expressions
Ibis (1)
Literalread 2026-09-27A typed constant placed in an expression
KNIME Analytics Platform (7)
Column Aggregatorread 2026-09-27Aggregate the values of several columns within each row into a new column
Constant Value Column Appenderread 2026-09-27Add a column holding the same constant value in every row
Expressionread 2026-09-27Evaluate a custom expression per row to add or replace columns
KNIME Column Expressions (legacy) (extension)read 2026-09-27Extension outside the base install: 2 current nodes: Column Expressions (legacy); Variable Expressions (legacy)
Renderer to Imageread 2026-09-27Append a column of SVG or PNG images rendering the content of another column
String Manipulationread 2026-09-27Evaluate a string-function expression per row into a new or replaced column
String Manipulation (Multi Column)read 2026-09-27Apply one string-function expression to each of several columns
OpenRefine (6)
Add column based on this column…read 2026-09-27Add a column computed by an expression over this column or any other cells of the row
Add column with URLs of matched entitiesread 2026-09-27Add a column holding the URL of the matched entity for each cell
Add entity identifiers columnread 2026-09-27Add a column holding the matched entity's identifier for each cell; unmatched cells give null
Other functionsread 2026-09-275 functions: type, facetCount, hasField, coalesce, cross
String functionsread 2026-09-273 functions: length, levenshteinDistance, toString
Transform…read 2026-09-27Rewrite every cell of a column with a GREL, Jython or Clojure expression, with a preview
Pentaho Data Integration (6)
Add constantsread 2026-09-27Add one or more constant-valued columns to every row
Calculatorread 2026-09-27New fields from simple predefined calculations
Formularead 2026-09-27New fields from formulas evaluated by Pentaho libformula
Set Field Valueread 2026-09-27Overwrite a field with the value of another field
Set Field Value to a Constantread 2026-09-27Overwrite a field with a constant
User Defined Java Expressionread 2026-09-27New fields from Java expressions compiled by Janino
Polars (9)
DataFrame.foldread 2026-09-27Reduce across the columns row by row with a user function that combines two Series
DataFrame.insert_columnread 2026-09-27Insert a Series or expression as a column at a given position
DataFrame.replace_columnread 2026-09-27Swap the column at a given position for a new Series
DataFrame.with_columnsread 2026-09-27Add columns from expressions, replacing any that share a name
DataFrame.with_columns_seqread 2026-09-27As with_columns, but evaluating the expressions one after another rather than in parallel
Expr computation: position lookups (group)read 2026-09-275 expressions: arg_unique, index_of, search_sorted, peak_max, peak_min; find positions of values and local peaks
foldread 2026-09-27Left fold across columns row by row with a user function and a start value
litread 2026-09-27A literal value as an expression
reduceread 2026-09-27Left fold across columns row by row with a user function, no start value
Power Query M (5)
Table.AddColumnread 2026-09-27Add a column computed by a function applied to each row
Table.DuplicateColumnread 2026-09-27Add a copy of a column under a new name, keeping values and type
Table.TransformColumnsread 2026-09-27Apply a function to the values of named columns in place
Table.TransformRowsread 2026-09-27Apply a function to each row and return the list of results
Value functionsread 2026-09-2736 functions: Value.Type, Value.Compare, Value.ReplaceType, Value.Metadata, Value.NativeQuery
RapidMiner Studio (12)
Aggregate Token Lengthread 2026-09-27Add an aggregate of a document's token lengths as metadata
Extract Lengthread 2026-09-27Add a document's character length as metadata
Extract Token Numberread 2026-09-27Add a document's token count as metadata
Generate Aggregationread 2026-09-27Add a column aggregating several columns within each row (sum, average, min, max)
Generate Aggregation (Advanced)read 2026-09-27Add a column aggregating selected columns within each row, with more functions
Generate Attributesread 2026-09-27Add columns computed from user-written expressions
Generate Attributes (In Database)read 2026-09-27Add or override columns using database-specific SQL expressions
Generate Copyread 2026-09-27Add a copy of an existing column under a new name
Generate Empty Attributeread 2026-09-27Add a new empty column of a given name and type
Generate Function Setread 2026-09-27Generate new columns by applying a chosen set of functions to all numeric columns
Generate Levenshtein Distanceread 2026-09-27Add the Levenshtein edit distance between two text columns
Generate Promptsread 2026-09-27Add a prompt column by filling a text template with each row's column values
Tableau Prep (4)
Clean Stepread 2026-09-27Hold cleaning operations: filter, rename, split, group, calculate, remove fields
Create Calculated Fieldread 2026-09-27New field from a calculation written by hand or built in the visual editor
Custom Calculationread 2026-09-27New field from an expression typed in the calculation editor
Duplicate Fieldread 2026-09-27Create a copy of a field and its values
Talend (1)
tMapread 2026-09-27Map inputs to outputs with expressions, joining lookup flows and filtering and routing rows
Trifacta (6)
Derive Transformread 2026-09-27Create a column from a value expression, optionally computed per group
Edit with formularead 2026-09-27Set the values of one or more columns to the result of a formula
New formularead 2026-09-27Create a column from the result of a formula
Other Functions (group)read 2026-09-2715 functions: COALESCE, RAND, IF, IPTOINT, URLPARAMS; conditionals, random, IP and URL parts, ranges
Set Transformread 2026-09-27Overwrite a column with a literal or expression, optionally only on rows meeting a test
filepathread 2026-09-27New column holding the path of the source file each row came from
VisiData (9)
addcol-audiometadataread 2026-09-23Add metadata columns for audio files on a Directory Sheet
addcol-bulkread 2026-09-23Add N empty editable columns
addcol-exprread 2026-09-23Add column computed from a Python expression with column names as variables
addcol-iterread 2026-09-23Add column filled from a Python sequence expression, repeated to fit
addcol-newread 2026-09-23Add an empty editable column
addcol-sourceread 2026-09-23Add a copy of current column to the source sheet
setcell-exprread 2026-09-23Set current cell to the result of a Python expression on its row
setcol-exprread 2026-09-23Set current column for selected rows to the result of a Python expression
setcol-iterread 2026-09-23Set current column for selected rows from items of a Python sequence expression
Background
Adding a calculated column gives every row a new value worked out from that row's columns, such as a unit price multiplied by a quantity.[1] Database theory calls the operation extended projection: a projection whose list computes new values as well as picking columns.[1][2]
When to use it
In DuckDB, / between two integers performs floating-point division, so 5 / 2 is 2.5, while // performs integer division.[3] Check what each operator does with integers and with zero when a formula moves from one engine to another. (Meridian's view)
The method
Basic relational algebra has no operation that computes on the data, such as multiplying a unit price by a quantity to obtain a total price.[1] A projection may modify attribute values as well as choose attributes: projecting a, b × 0.5 and c returns the relation with every b value halved.[2]
In DuckDB, the expressions of the SELECT clause are logically executed only at the end of the query, although the clause is written first.[4] DuckDB lets a later expression in a SELECT list reuse an earlier one's alias, as in SELECT i + 1 AS j, j + 2 AS k, a feature also known as lateral column aliases.[5] DuckDB also accepts prefix aliases, so res: col1 + col2 names a column just as col1 + col2 AS res does.[4] Lateral aliases keep a chain of formulas readable; where a query must also run on other engines, check that those engines accept them. (Meridian's view)
Compared with the alternatives
A DuckDB generated column declares a calculated column in the table definition itself, with GENERATED ALWAYS AS (expr) or simply AS (expr).[6] DuckDB computes a VIRTUAL generated column from its expression every time the column is referenced, and VIRTUAL is currently the only kind it supports.[6] A calculated column in a query suits one step of a pipeline; a generated column suits a formula that every reader of a table should get in the same way. (Meridian's view)
Sources
- [1]Relational algebra - Wikipediasecondary source
- [2]Projection (relational algebra) - Wikipediasecondary source
- [3]Numeric Functions – DuckDBdocumentation
- [4]SELECT Clause – DuckDBdocumentation
- [5]Friendly SQL – DuckDBdocumentation
- [6]CREATE TABLE Statement – DuckDBdocumentation
Used in
10 Protocols use this operation:
- NAICS — Industry Classification, step
package - Epoch AI Notable AI Models dataset, step
models - GLEIF — Legal Entity Identifiers, step
package - California Housing dataset, step
load - EDGAR ↔ GLEIF — Company-to-LEI Crosswalk, step
package - Online Retail II dataset, steps
retail_lines,retail_orders - ScienceQA dataset, step
load - NYC Yellow Taxi Trips dataset, step
trips - SEC EDGAR — Company Tickers, step
package - USGS Earthquakes 2025 dataset, step
earthquakes