Shape / columns · All operations
Reorder columns
A variant of Choose and rename columns
Change the order of the columns without changing which columns there are.
Status
- In arcform
Runs as a SQL step
arcform carries it as a
sql:step today.
The DuckDB step
Reorder columns without changing which there are
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, customer, * EXCLUDE (amount, customer) FROM orders;
SELECT * FROM result LIMIT 3;
SELECT CASE WHEN ((SELECT list(column_name) FROM (DESCRIBE result)) = ['amount', 'customer', 'order_id', 'region', 'order_date', 'product', 'tags', 'meta'] AND (SELECT count(*) FROM result) = 10) THEN 'as expected' ELSE error('amount and customer were not moved to the front of the same eight 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 and customer were not moved to the front of the same eight 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).
Duckle (1)
Reorder Columnsread 2026-09-25reorder columns
EasyMorph (1)
Reorder columnsread 2026-09-27Change the order of columns
KNIME Analytics Platform (1)
Column Resorterread 2026-09-27Reorder columns by hand or by name
OpenRefine (4)
Move column leftread 2026-09-27Move the column one position to the left
Move column rightread 2026-09-27Move the column one position to the right
Move column to beginningread 2026-09-27Move the column to the first position
Move column to endread 2026-09-27Move the column to the last position
Power Query M (1)
Table.ReorderColumnsread 2026-09-27Put columns in a given order
RapidMiner Studio (2)
Reorder Attributesread 2026-09-27Reorder columns alphabetically, by a given list or pattern, or to match a reference table
Reorder Attributes (In Database)read 2026-09-27Reorder columns, executed in the database
Tableau Prep (1)
Reorder fieldsread 2026-09-27Drag fields into a new order; the order persists to output
Trifacta (2)
Move Transformread 2026-09-27Move columns before or after another column
Move columnsread 2026-09-27Move columns before or after another column
VisiData (6)
slide-leftread 2026-09-23Move current column one position left
slide-left-nread 2026-09-23Move current column N positions left
slide-leftmostread 2026-09-23Move current column to the left end of its section
slide-rightread 2026-09-23Move current column one position right
slide-right-nread 2026-09-23Move current column N positions right
slide-rightmostread 2026-09-23Move current column to the right end of its section
Background
In EasyMorph, Reorder columns moves one or more columns to the leftmost position, to the rightmost position, or after a particular column.[1] In KNIME, the Column Resorter node changes the order of the input columns, and can also sort the columns by name.[2] Under Christopher J. Date's definition of first normal form, a table has no specific left-to-right ordering of its columns.[3]
When to use it
In EasyMorph, the use cases given for Reorder columns are grouping columns together and ensuring a particular order of columns before exporting to a file.[1] In DuckDB, traditional set operations such as UNION combine queries by column position, and the result uses the column names from the first query.[4] In DuckDB, UNION BY NAME combines columns by name instead of by position and does not require the inputs to have the same number of columns.[4] In DuckDB, loading a CSV file with COPY needs a table whose schema matches the order of the columns in the file.[5]
The method
In KNIME, the Column Resorter can shift columns one step left or right, or move them to the beginning or end of the table.[2] In KNIME, the Column Resorter inserts new and previously unknown columns at the position of a placeholder, Any unknown columns, which can be positioned like any column.[2] Decide where columns you have not seen yet should land: name the columns that must lead, and let the rest follow in their existing order. (Meridian's view)
Compared with the alternatives
Under Christopher J. Date's definition, a table in first normal form also has no specific top-to-bottom ordering of its rows.[3] Reordering columns is the column-wise counterpart of sorting rows: neither changes what the table holds, only how it is read and how positional tools see it. (Meridian's view)
Sources
- [1]REORDER COLUMNS [EasyMorph Help]documentation
- [2]Column Resorterdocumentation
- [3]First normal form - Wikipediasecondary source
- [4]Set Operations – DuckDBdocumentation
- [5]CSV Import – DuckDBdocumentation