Distinct keyword
A distinct operation eliminates duplicate values, elements, or rows from a result, retaining one occurrence of each unique item.
Clojure: The Essential Reference
distinct is a Clojure function or transducer that removes repeated items from a collection while preserving the first occurrence of each item.
- How it is used
- Removes repeated values across a collection while retaining their first occurrence.
- How deep it goes
- Defines input and output contracts, exceptions, laziness, and transducer use, then contrasts adjacent-only duplicate removal.
- Examples
- Shows numeric sequences, deduplicated votes grouped by user, and a composed transducer over generated ranges.
- What you can do after
- Apply it via Clojure’s distinct or its transducer form to retain the first occurrence of each value.
Read how Clojure: The Essential Reference explains distinct keyword →
Spring in Action, Sixth Edition
distinct is a Project Reactor operator that emits each distinct source element only once.
- How it is used
- Filters repeated values from a Flux so the resulting Flux publishes each value only once.
- How deep it goes
- Defines the operator through its output and a verified example, without explaining its internals.
- Examples
- Tests a Flux of animal names in which repeated "dog" and "bird" values appear only once in the expected output.
- What you can do after
- Apply it via Project Reactor’s distinct() and verify the resulting Flux with StepVerifier.
Read how Spring in Action, Sixth Edition explains distinct keyword →
Statistics Slam Dunk
The distinct() function from dplyr returns rows containing unique combinations of selected columns from a tabular object.
- How it is used
- Identifies unique player-season-position combinations while standardizing tabular NBA data.
- How deep it goes
- Demonstrates selected-column deduplication and record counting, then defers statistical aggregation to group_by() and summarize().
- Examples
- Uses dat1 and the Year, Player, Pos columns to count 12,239 unique combinations amid NBA multi-team records.
- What you can do after
- Apply it via dplyr to inspect unique combinations before deciding how to remove or aggregate duplicate records.
DuckDB in Action
The DISTINCT keyword removes duplicate rows from the result produced by a query projection.
- How it is used
- Filters duplicate projected rows before inserting a unique set from another relation.
- How deep it goes
- Defines uniqueness across all selected columns and demonstrates it in a remote CSV-to-table INSERT.
- Examples
- Uses duplicated systems.csv records and inserts DISTINCT system_id and system_public_name pairs into systems.
- What you can do after
- Apply DISTINCT in SQL to prevent duplicate projected rows from causing insertion failures.
Related concepts
- selectpart of · SELECT is a SQL query construct that specifies the rows, columns, or expressions retrieved from one or more queryable data sources.
- data groupingequivalent to · Data grouping is the organization of data into groups according to shared values, keys, or other criteria, supporting grouped processing, analysis, or retrieval.
- dedupecontrasts with · dedupe is a Clojure function that removes consecutive duplicate values while retaining separated repetitions.
- dplyruses · dplyr is an R package that provides a consistent grammar and functions for transforming, grouping, and summarizing tabular data.
- countuses · A count is a numerical tally or operation determining how many items, occurrences, records, or values satisfy specified criteria.
- data wranglinguses · Data wrangling is the process of cleaning, transforming, restructuring, organizing, and combining raw data into a form suitable for analysis or downstream processing.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



