Cypher DISTINCT: Removing Duplicates from Results [Byte-Sized Cypher Series]
Another week, another lesson: Let’s learn some Cypher!
Byte-Sized Cypher is a beginner-friendly video series that teaches you the Cypher query language through short, practical examples and memorable snack-based metaphors. 🍠
In this series, DevRel legend and snack enthusiast Jason Koo breaks down the most important openCypher clauses into small, digestible episodes. openCypher is the open source version of the Cypher query language originally created by Neo4j, and is designed specifically for working with graph databases and highly connected data.
Just to clarify: Jason doesn’t work for gdotv, but we’re big fans of this video series, and with his permission, we’re sharing these videos with our blog readers. We hope this series helps you master the Cypher query language – or even just get comfortable with using it for the very first time!
In previous weeks, we covered the Cypher CREATE clause for adding data to your graph, took a closer look at using labels in Cypher, learned how to use the MATCH clause to find specific nodes and relationships, and dove into the RETURN clause to manage query results. This week, we’ll explore how the DISTINCT clause removes duplicates from your Cypher query results.
The Cypher DISTINCT Clause: Removing Duplicates from Results
Getting duplicate results in your Cypher queries? In this week’s episode, Jason teaches you how to use RETURN DISTINCT in Cypher to filter out duplicate values from your graph database results.
Follow along with the episode examples using this sample dataset of Japanese snacks in FalkorDB. 🧑🏽💻
In this video, you’ll learn about:
- Single-property and multi-property DISTINCT filtering
- Using DISTINCT with path traversals
- How NULL values behave with DISTINCT
- Query restructuring alternatives for better performance
- Using DISTINCT with relationships and TYPE()
- Using DISTINCT inside aggregate functions like COUNT()
Whether you’re new to Cypher or looking to write cleaner, more efficient graph queries, this video has you covered!
Special note: In this video, Jason makes great use of the gdotv graph database IDE to help demonstrate Cypher queries and visualize the resulting graph data. No matter if you’re new to graphs or a seasoned vet, gdotv helps you do your best work with graph technology – but don’t just take our word for it. Try it out for yourself!
Looking to Dive Deeper into Cypher?
For a full technical specification of the Cypher query language, here’s the most current openCypher spec (version 9). Or for a hands-on introduction with full documentation, check out the Cypher documentation written by the Neo4j team.
Also for handy reference, here are just a few of the most popular graph databases and graph query engines that use Cypher or an openCypher variant:
- Neo4j (including AuraDB)
- Memgraph
- FalkorDB
- Amazon Neptune & Neptune Analytics
- ArcadeDB
- Kuzu
- LadybugDB
- HugeGraph
- PuppyGraph
- And others
Psst! All of the above graph tech tools are compatible with gdotv to use for Cypher query writing, editing, profiling, and more.
See You at the Next Episode of Byte-Sized Cypher!
Hungry for more Cypher? Check out the full series playlist here as Jason is always adding more videos. If you enjoyed this video, subscribe to Jason Koo’s YouTube channel for more videos on graph technology and other great developer tools, platforms, and languages.
Need a break between snacks? Catch the next episode of Byte-Sized Cypher here on the gdotv blog every Monday. See you then!
Upgrade your graph experience: Download gdotv and do your best work with graph databases from querying and editing to exploring and visualization.
