0Pricing
Neo4j Graph Database Fundamentals · Ders

Sonuçları Filtreleme ve Sıralama

Sorgu sonuçlarınızı daraltmak ve tam olarak ihtiyacınız olan verileri almak için WHERE ve ORDER BY yan tümcelerinden yararlanın.

Sonuçları Filtreleme ve Sıralama, CoddyKit'te ücretsiz bir Neo4j Graph Database Fundamentals dersidir. Bu, 4 dersinin 1. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Neo4j Graph Database Fundamentals öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Neo4j Graph Database Fundamentals kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Refine Your Graph Queries

When working with large graphs, you often need to find very specific information or present it in a particular order.

  • Filtering helps you narrow down results to only what's relevant.
  • Ordering helps you sort your results for better readability or analysis.

In this lesson, we'll master the WHERE and ORDER BY clauses in Cypher.

Filter Results with WHERE

The WHERE clause is used to filter patterns or properties based on specific conditions. It typically comes after a MATCH clause.

Think of it like saying: "Find me all people, WHERE their birth year is 1970."

MATCH (p:Person)
WHERE p.born = 1970
RETURN p.name AS Name, p.born AS BornYear

Comparison Operators

You can use various comparison operators in your WHERE clause:

  • = (equal to)
  • <> (not equal to)
  • > (greater than)
  • < (less than)
  • >= (greater than or equal to)
  • <= (less than or equal to)

Let's find movies released after the year 2000.

MATCH (m:Movie)
WHERE m.released > 2000
RETURN m.title AS MovieTitle, m.released AS ReleaseYear

Logical Operators (AND, OR)

Combine multiple conditions using logical operators:

  • AND: Both conditions must be true.
  • OR: At least one condition must be true.
  • XOR: Exactly one condition must be true.
  • NOT: Negates a condition.

Find people born between 1970 and 1980 (inclusive).

MATCH (p:Person)
WHERE p.born >= 1970 AND p.born <= 1980
RETURN p.name AS Name, p.born AS BornYear

String and List Operators

Cypher offers powerful operators for string matching and list containment:

  • CONTAINS, STARTS WITH, ENDS WITH for partial string matches.
  • IN to check if a property value is within a list of values.

Let's find specific actors by name using IN.

MATCH (p:Person)
WHERE p.name IN ['Tom Hanks', 'Keanu Reeves', 'Carrie-Anne Moss']
RETURN p.name AS ActorName

Sort Your Results with ORDER BY

The ORDER BY clause sorts your query results. It comes after RETURN (or WITH).

By default, results are sorted in ascending order (smallest to largest, A-Z).

MATCH (p:Person)
RETURN p.name AS ActorName
ORDER BY ActorName

Ascending & Descending Order

You can explicitly specify the sort direction:

  • ASC: Ascending (A-Z, 0-9). This is the default.
  • DESC: Descending (Z-A, 9-0).

Let's sort movies by their release year, from newest to oldest.

MATCH (m:Movie)
RETURN m.title AS MovieTitle, m.released AS ReleaseYear
ORDER BY ReleaseYear DESC

Multi-Level Sorting

You can sort by multiple properties. The order in which you list them in ORDER BY matters.

Cypher will first sort by the first property, then by the second for any ties in the first, and so on.

Sort people by birth year (ascending), and then by name (ascending) for those born in the same year.

MATCH (p:Person)
RETURN p.born AS BornYear, p.name AS ActorName
ORDER BY BornYear ASC, ActorName ASC

Putting it All Together

A typical Cypher query flow often involves:

  1. MATCH: Find the graph pattern.
  2. WHERE: Filter the matched patterns.
  3. RETURN: Select the data you want.
  4. ORDER BY: Sort the returned data.

Find actors born before 1970, order them by name (descending), then by the movie title they acted in (ascending).

MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE p.born < 1970
RETURN p.name AS Actor, m.title AS Movie, p.born AS BornYear
ORDER BY Actor DESC, Movie ASC

Filter & Order Challenge

Which Cypher query correctly finds movies released after 1999 and orders them by title in descending order?

Recap: Refined Queries

Great job! You've learned how to precisely control your Cypher query results:

  • The WHERE clause filters data based on conditions.
  • The ORDER BY clause sorts your results in ascending or descending order.
  • You can combine these with comparison, logical, and string/list operators for powerful filtering.

Next, we'll explore how to summarize and reshape your data with Aggregation and Projections!

Sıkça Sorulan Sorular

“Sonuçları Filtreleme ve Sıralama” dersi ücretsiz mi?

Evet — “Sonuçları Filtreleme ve Sıralama” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Neo4j Graph Database Fundamentals kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Neo4j Graph Database Fundamentals kursu toplamda 4 dersten oluşur.

“Sonuçları Filtreleme ve Sıralama” dersinde ne öğreneceğim?

Sorgu sonuçlarınızı daraltmak ve tam olarak ihtiyacınız olan verileri almak için WHERE ve ORDER BY yan tümcelerinden yararlanın. Neo4j Graph Database Fundamentals ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Neo4j Graph Database Fundamentals öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Neo4j Graph Database Fundamentals, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 1. dersidir.

“Sonuçları Filtreleme ve Sıralama” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Neo4j Graph Database Fundamentals dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Neo4j Graph Database Fundamentals dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Sonuçları Filtreleme ve Sıralama
  2. Toplama ve Projeksiyonlar
  3. Graf Verilerini Güncelleme ve Silme
  4. WITH ve UNION ile Sorguları Birleştirme
← Neo4j Graph Database Fundamentals Sayfasına Dön