Shape / columns · All operations
Copy a column
A variant of Add a calculated column
Add a copy of an existing column under a new name.
Status
- In arcform
Runs as a SQL step
arcform carries it as a
sql:step today.
The DuckDB step
Add a copy of a column under a new name
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 *, amount AS amount_copy FROM orders;
SELECT order_id, amount, amount_copy FROM result;
SELECT CASE WHEN ((SELECT list(column_name) FROM (DESCRIBE result)) = (SELECT list(column_name) FROM (DESCRIBE orders)) || ['amount_copy'] AND (SELECT count(*) FILTER (WHERE amount_copy IS DISTINCT FROM amount) FROM result) = 0 AND (SELECT sum(amount_copy) FROM result) = 1900.74) THEN 'as expected' ELSE error('amount_copy was not a copy of amount beside the original columns') END AS verdict;- It needs nothing installed beyond DuckDB itself.
- The statement checks its own result and raises an error when it is wrong: “amount_copy was not a copy of amount beside the original columns”.
- It passed on DuckDB
v2.0.0 (Cyanoptera) d54cbbe3df.
What other tools call it
Meridian's classification; an independent blind rating agreed on 95.7% of 324 rows (variant, version 3).
Apache SeaTunnel (1)
Copyread 2026-09-27Copy a field to one or more new fields
Power Query M (1)
Table.DuplicateColumnread 2026-09-27Add a copy of a column under a new name, keeping values and type
RapidMiner Studio (1)
Generate Copyread 2026-09-27Add a copy of an existing column under a new name
Tableau Prep (1)
Duplicate Fieldread 2026-09-27Create a copy of a field and its values
VisiData (1)
addcol-sourceread 2026-09-23Add a copy of current column to the source sheet
Background
In RapidMiner, the Generate Copy operator adds a copy of a chosen attribute to a data table and leaves the original attribute unchanged.[1] Power Query's Table.DuplicateColumn adds a column under a new name whose values and type are copied from an existing column.[2]
When to use it
Tableau Prep lets an analyst copy a field to experiment with cleaning operations on it without changing the original data.[3] In Tableau Prep, the Duplicate Field option creates a new field with the same name and a modifier, such as "Ship Date -1".[3] Copy a column when a later step will reshape it but the raw values must survive, to check the change against or to join on. (Meridian's view) Give the copy a name that says which column is which, rather than keeping a default such as a numbered suffix. (Meridian's view)
In RapidMiner, the attribute names of a data table should be unique, and Generate Copy takes the copy's name from its new name parameter.[1] If neither the copy nor the original will ever change, the copy only repeats a column, and a rename may serve better. (Meridian's view)
The method
A copy is the simplest calculated column: its formula is nothing more than the name of the column it copies. (Meridian's view) Table.DuplicateColumn takes the table, the name of the column to copy, the new column's name and an optional column type.[2] In Power Query, duplicating column a of a two-row table as "copied column" gives each row a copied column holding that row's value of a.[2] Apache SeaTunnel's Copy transform takes a fields setting that maps each new field to the field it copies, so one transform can copy name into both name1 and name2.[4]
Compared with the alternatives
In relational algebra, a rename returns a relation identical to the original except that one attribute carries a new name.[5] Where a rename gives a column a new name in place of the old one, a copy keeps both names in the table, each holding the same values. (Meridian's view)
Sources
- [1]Generate Copy - Rapidminer Documentationdocumentation
- [2]Table.DuplicateColumn - PowerQuery M | Microsoft Learndocumentation
- [3]Copy steps, actions and fields - Tableaudocumentation
- [4]Copy | Apache SeaTunneldocumentation
- [5]Relational algebra - Wikipediasecondary source