Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning Cypher
  • Table Of Contents Toc
  • Feedback & Rating feedback
Learning Cypher

Learning Cypher

By : Onofrio Panzarino
3.7 (12)
close
close
Learning Cypher

Learning Cypher

3.7 (12)
By: Onofrio Panzarino

Overview of this book

Table of Contents (13 chapters)
close
close

Sorting


If you have experience with SQL, then sorting with Cypher is exactly the same as sorting with SQL. We can use the ORDER BY clause to specify the columns to be used for sorting, as shown in the following query:

MATCH (b:Book)
WHERE ANY ( tag IN b.tags WHERE tag IN ['drama'] )
RETURN b.title
ORDER BY b.title
LIMIT 5

The preceding query looks for books tagged drama in the database, then sorts them by title, and returns the first five book entries found. We can note the following:

  • The ORDER BY clause follows the RETURN clause

  • This clause is above the LIMIT or SKIP clause so that we can sort the data before limiting our page

The result set is as follows:

+-----------------------------+
| b.title                     |
+-----------------------------+
| "A Lover's Complaint"       |
| "A Midsummer Night's Dream" |
| "All's Well That Ends Well" |
| "Anthony and Cleopatra"     |
| "As You Like It"            |
+-----------------------------+

A descending sort

To sort inversely, just postpone the DESC...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning Cypher
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon