Shape / rows · All operations
Filter rows
Keep or drop rows by a condition.
Status
- In arcform
Runs as a SQL step
arcform carries it as a
sql:step today.- Shape of the result
- fewer rows, same columns
- Level
- one clause of SQL
The DuckDB step
Keep rows by a condition
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 * FROM orders WHERE amount > 100 AND region <> 'west';
SELECT * FROM result;
SELECT CASE WHEN ((SELECT list(order_id ORDER BY order_id) = [1, 3, 10] FROM result)) THEN 'as expected' ELSE error('the filter did not keep orders 1, 3 and 10') END AS verdict;- It needs nothing installed beyond DuckDB itself.
- The statement checks its own result and raises an error when it is wrong: “the filter did not keep orders 1, 3 and 10”.
- It passed on DuckDB
v2.0.0 (Cyanoptera) d54cbbe3df.
Variants
- Keep rows with chosen values
Keep or exclude the rows whose value is one of a picked list of values.
- Keep rows that contain text
Keep or drop the rows whose cells contain a string or match a pattern, in one column or any.
- Drop rows with missing or error values
Drop, or keep only, the rows that hold nulls, empty cells, NaNs or error values.
- Keep groups after aggregating
Keep the groups whose aggregate values meet a condition.
- Filter on a window function
Keep the rows whose window-function value meets a condition, such as the top row per partition.
Keep rows that match a condition
Keep, or drop, the rows for which a condition on their values is true.
Reuse a named filter
Define a filter condition once, by name or macro, and apply it in several queries.
Find the positions of matching rows
Return the row numbers at which a condition is true rather than the rows themselves.
Keep the selected rows
Keep or remove the rows a person has selected, highlighted or flagged in an interactive view.
Split rows into separate outputs
Send each row to one of two or more outputs by the condition it meets, so no row is discarded.
Keep rows past a watermark
Pass only the rows newer than the last successful run.
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 (2)
Filterread 2026-09-27Route rows to a True or a False output by a condition
Filter In-DBread 2026-09-27Filter records inside the database with a basic filter or a native SQL expression
Apache DataFusion (5)
Filter (WHERE)read 2026-09-27Keep rows matching a predicate before grouping
Filter post-aggregate (HAVING)read 2026-09-27Keep groups matching a predicate after aggregation
QUALIFY clauseread 2026-09-27Filter rows after window functions are evaluated
WHEREread 2026-09-27Pipe: filter rows, BigQuery-style |> syntax
filterread 2026-09-27DataFrame method: Keep rows for which a predicate is true
Apache Hop (3)
Filter Rowsread 2026-09-27Route rows to a true or false target by a condition tree
Java Filterread 2026-09-27Route rows to a true or false target by a Java boolean expression
Switch / Caseread 2026-09-27Route each row to a target chosen by the value of a field, with a default target
Apache NiFi (3)
Filter Functionsread 2026-09-278 functions: contains, containsRegex, matchesRegex, startsWith, endsWith, …
RouteTextread 2026-09-27Route each line of text by user-defined rules, one relationship per rule
ScriptedFilterRecordread 2026-09-27Keep records for which a user script returns true
Apache SeaTunnel (1)
FilterRowKindread 2026-09-27Keep or drop rows by change kind: insert, update-before, update-after, delete
AWS Glue (5)
Conditional Routerread 2026-09-27Evaluate each row against several group filter conditions and send it to its group's output
Filterread 2026-09-27Keep records that satisfy a predicate function
Filterread 2026-09-27Split a dataset in two by a filter condition
Remove null rowsread 2026-09-27Remove rows in which every column is null or empty
SplitRowsread 2026-09-27Split a frame into two by row: the rows that match a comparison and the remaining rows
Azure Data Factory (4)
Conditional splitread 2026-09-27Route rows to different output streams by matching conditions
Filterread 2026-09-27Apply a filter expression to an input array inside the pipeline
Filterread 2026-09-27Keep rows that meet a condition
Row Filteringread 2026-09-27Table.SelectRows with equality, comparison, text containment and date range conditions
Bruin (2)
DuckDB (3)
HAVING (clause)read 2026-09-27Keep groups matching a condition on an aggregate
QUALIFY (clause)read 2026-09-27Keep rows matching a condition on a window function
WHERE (clause)read 2026-09-27Keep rows matching a condition
Duckle (2)
Filter Rowsread 2026-09-25keep rows where a predicate holds; optional reject port
Incremental Loadread 2026-09-25pass rows past the last successful run's watermark; mark kept in workspace state
EasyMorph (5)
Filterread 2026-09-27Keep or remove rows by ticking the values of a column
Filter by conditionread 2026-09-27Keep rows for which an expression evaluates to true
Filter by searchread 2026-09-27Keep or remove rows that contain a search string
Filter by typeread 2026-09-27Keep or remove rows by the data type of their values, such as errors
Remove empty rowsread 2026-09-27Drop rows whose cells are all empty or whitespace
Ibis (2)
KNIME Analytics Platform (18)
DB Row Filterread 2026-09-27In-database: keep rows matching conditions by adding a WHERE clause
Expression Row Filterread 2026-09-27Keep rows for which a custom expression evaluates to true
Filter Applyread 2026-09-27Filter rows by filter definitions attached to the table or supplied as a model
Filter Apply Row Splitterread 2026-09-27Split rows into matching and non-matching tables by attached filter definitions
Filter Definition Mergerread 2026-09-27Merge up to three interactive filter definitions into one
HiLite Row Splitterread 2026-09-27Split rows by whether they are highlighted in a view at execution time
Java Snippet Row Filterread 2026-09-27Keep rows for which a user-written Java expression returns true
Java Snippet Row Splitterread 2026-09-27Split rows into two tables by a user-written Java expression
Nominal Value Row Filterread 2026-09-27Keep rows whose nominal column value is in a selected set
Nominal Value Row Splitterread 2026-09-27Split rows by whether a nominal column value is in a selected set
Row Filterread 2026-09-27Keep or drop rows by conditions on cell values, row number or RowID
Row Filter (Labs)read 2026-09-27Keep rows matching a query of nested conditions over several columns
Row Splitterread 2026-09-27Split rows into two tables by conditions on cell values, row number or RowID
Row Splitter (Labs)read 2026-09-27Split rows into matching and non-matching tables by a nested multi-column query
Rule-based Row Filterread 2026-09-27Keep or drop rows by user-written business rules
Rule-based Row Filter (Dictionary)read 2026-09-27Keep or drop rows by business rules supplied in a second table
Rule-based Row Splitterread 2026-09-27Split rows into two tables by user-written business rules
Rule-based Row Splitter (Dictionary)read 2026-09-27Split rows into two tables by business rules supplied in a second table
OpenRefine (5)
Facet by flagread 2026-09-27Split rows true or false by whether the row is flagged
Facet by starread 2026-09-27Split rows true or false by whether the row is starred
Keep only matching rowsread 2026-09-27Delete every row outside the current facet selection
Remove matching rowsread 2026-09-27Delete the rows in the current facet selection
Text filterread 2026-09-27Keep rows whose cell contains a typed string or matches a regular expression; can be inverted
Pentaho Data Integration (3)
Filter Rowsread 2026-09-27Filter rows with simple comparison conditions
Java Filterread 2026-09-27Filter rows with a Java expression
Switch / Caseread 2026-09-27Route each row to a target step chosen by the value of a field
Polars (7)
DataFrame.drop_nansread 2026-09-27Drop the rows that hold a NaN in any of the chosen columns
DataFrame.drop_nullsread 2026-09-27Drop the rows that hold a null in any of the chosen columns
DataFrame.filterread 2026-09-27Keep the rows for which every predicate expression is true
DataFrame.removeread 2026-09-27Drop the rows for which the predicate expressions are true
Expr manipulation/selection: filtering (group)read 2026-09-274 expressions: filter, where, drop_nulls, drop_nans; keep the values of a column that pass a test
GroupBy.havingread 2026-09-27Keep the groups that satisfy predicates evaluated over each group
arg_whereread 2026-09-27Row indices at which a condition is true
Power Query M (4)
Table.FindTextread 2026-09-27Keep rows where any cell contains the given text
Table.RemoveRowsWithErrorsread 2026-09-27Drop rows that hold an error value in any cell, or in named columns
Table.SelectRowsread 2026-09-27Keep rows for which a condition function returns true
Table.SelectRowsWithErrorsread 2026-09-27Keep only rows that hold an error value in any cell, or in named columns
RapidMiner Studio (4)
Filter Documents (by Content)read 2026-09-27Keep or drop documents of a collection by whether their content matches a condition
Filter Examplesread 2026-09-27Keep the rows matching a condition; non-matching rows go to a second output
Filter Examples (In Database)read 2026-09-27Keep rows matching a condition, executed in the database
Filter Examples with Missing Valuesread 2026-09-27Drop rows whose count of missing values exceeds a threshold
SQLMesh (4)
Tableau Prep (10)
Calculationread 2026-09-27Filter rows by a boolean calculation; the one filter type offered in the Input step
Excluderead 2026-09-27One-click filter dropping the rows with the selected values
Filterread 2026-09-27Keep or exclude rows by a filter on a field
Keep Onlyread 2026-09-27One-click filter keeping the rows with the selected values
Null Valuesread 2026-09-27Show the null values of a field or exclude them
Range of Datesread 2026-09-27Filter a date field by a range, a minimum or a maximum date
Range of Valuesread 2026-09-27Filter a number field by a range, a minimum or a maximum
Relative Dateread 2026-09-27Filter a date field to a span of years, quarters, months, weeks or days relative to an anchor
Selected Valuesread 2026-09-27Keep or exclude a picked list of values, including values absent from the sample
Wildcard Matchread 2026-09-27Keep or exclude string values matching a pattern
Talend (3)
tCombinedSQLFilterread 2026-09-27Filter rows and remap columns of a source table inside the DBMS
tFilterRowread 2026-09-27Keep rows meeting one or more conditions on chosen columns
tSQLTemplateFilterRowsread 2026-09-27Filter the rows of a table with a WHERE clause, run in the DBMS
Trifacta (14)
Delete Transformread 2026-09-27Delete the rows for which a condition is true
Filter Transformread 2026-09-27Keep or delete rows by a defined type of filter
Filter containsread 2026-09-27Keep or delete rows whose value contains a literal or pattern
Filter custom formularead 2026-09-27Keep or delete rows by an arbitrary formula
Filter ends withread 2026-09-27Keep or delete rows whose value ends with a literal or pattern
Filter exactread 2026-09-27Keep or delete rows whose value equals a given value
Filter greater thanread 2026-09-27Keep or delete rows with values greater than, or equal to, a given value
Filter inread 2026-09-27Keep or delete rows whose value is one of a list of values
Filter less thanread 2026-09-27Keep or delete rows with values less than, or equal to, a given value
Filter mismatchedread 2026-09-27Keep or delete rows whose values mismatch the column's data type
Filter missingread 2026-09-27Keep or delete rows with missing values
Filter not equalsread 2026-09-27Keep or delete rows whose value does not equal a given value
Filter starts withread 2026-09-27Keep or delete rows whose value starts with a literal or pattern
Keep Transformread 2026-09-27Keep the rows for which a condition is true and remove the rest
VisiData (13)
delete-cursorread 2026-09-23Delete source rows inside the canvas cursor box
delete-selectedread 2026-09-23Delete all selected rows
delete-visibleread 2026-09-23Delete source rows visible on the canvas
dive-cursorread 2026-09-23Open copy of source sheet holding the rows inside the canvas cursor box
dive-exceptread 2026-09-23Open copy of source sheet excluding the rows in current bin
dive-except-selectedread 2026-09-23Open copy of source sheet excluding the rows in selected bins
dive-selectedread 2026-09-23Open the selected rows; on a frequency table, one sheet of the selected bins' source rows
dive-visibleread 2026-09-23Open copy of source sheet holding the rows visible on the canvas
dup-searchread 2026-09-23(experimental) Open duplicate sheet filtered live to rows matching a regex in current column
dup-search-colsread 2026-09-23(experimental) Open duplicate sheet filtered live to rows matching a regex in any column
dup-selectedread 2026-09-23Open duplicate sheet holding references to the selected rows
dup-selected-deepread 2026-09-23Open duplicate sheet holding deep copies of the selected rows
open-selectedread 2026-09-23(vdsql) Open the rows of the selected frequency bins
Background
In SQL, the WHERE clause filters rows: it eliminates every row of the result for which its predicate does not evaluate to true.[1] The WHERE clause is approximately the relational algebra selection operation, a unary operation that denotes a subset of a relation.[1][2] A WHERE filter is also known as a horizontal partition, restricting the rows a query outputs to those meeting specified conditions.[1]
When to use it
In PostgreSQL, each row is checked against the WHERE condition and kept only if the result is true; a false or null result discards the row.[3] In SQL, a comparison with a null can never result in either true or false, but always in a third logical result, Unknown.[4] In SQL, rows for which the WHERE predicate evaluates to either False or Unknown are discarded by SELECT queries.[4] Interpreting Unknown and False as the same logical result is a common error when dealing with nulls in SQL.[4]
In SQL's three-valued logic, p OR NOT p is unknown whenever p is unknown, so WHERE (x = 10) OR NOT (x = 10) does not return the rows in which x is null.[4] On a column that can be empty, decide whether the empty rows should be kept or dropped, and write IS NULL or IS NOT NULL into the condition to say so. (Meridian's view) Filter as early as the question allows, so that later joins and aggregates work on fewer rows. (Meridian's view)
The method
Relational algebra was introduced by Edgar F. Codd as part of his relational model of data in 1970.[2] In relational algebra, a selection is sometimes called a restriction, in reference to E.F. Codd's 1970 paper, which predates the existence of SQL.[2] A selection is written σ with its condition and the relation, as in σ Age ≥ 34 (Person), and denotes all tuples in the relation for which the condition holds.[2] Selection is idempotent, so applying the same selection twice has no further effect, and commutative, so the order selections are applied in does not change the result.[2]
In PostgreSQL, the WHERE search condition is any value expression that returns a value of type boolean, and it typically references at least one column of the table generated in the FROM clause.[3]
In query optimisation, moving selections towards the leaves of an expression tree is likely to shrink the intermediate relations, because selection very effectively decreases the number of rows in its operand.[2] Selection is distributive over set difference, intersection and union, and rules based on that property are used to push a selection below set operations in an expression tree.[2]
Compared with the alternatives
In SQL, the SELECT list is approximately the relational algebra projection operation, which restricts output to specified columns, while WHERE performs a selection, which restricts rows.[1] In PostgreSQL, the join condition of an inner join can be written either in the WHERE clause or in the JOIN clause, and the two forms are equivalent.[3] In PostgreSQL, the ON or USING clause of an outer join is not equivalent to a WHERE condition, because it results in the addition of rows for unmatched input rows as well as the removal of rows.[3] With an outer join, decide whether a condition on the optional table should limit what is matched or which rows survive, and place it in ON or in WHERE accordingly. (Meridian's view) In SQL, rows for which a WHERE predicate evaluates to False or Unknown are not acted on by INSERT, UPDATE or DELETE statements.[4]
Sources
- [1]Select (SQL) - Wikipediasecondary source
- [2]Relational algebra - Wikipediasecondary source
- [3]PostgreSQL: Documentation: 18: 7.2. Table Expressionsdocumentation
- [4]Null (SQL) - Wikipediasecondary source
Used in
8 Protocols use this operation:
- California Housing dataset, step
load - EDGAR ↔ GLEIF — Company-to-LEI Crosswalk, steps
build_sec_entities,load,tier,package - MedMCQA dataset, step
load - Online Retail II dataset, steps
retail_lines,retail_orders - ScienceQA dataset, step
load - SuperGPQA dataset, steps
corpus,load - NYC Yellow Taxi Trips dataset, step
trips - USGS Earthquakes 2025 dataset, step
raw_earthquakes