Ordering Multiple Values

Youngest actor

Youngest actor in highest rated movie

Modify the query you just executed to:

  1. Match the people that acted in the movies.

  2. Return the names of people sorted by the born property

cypher
MATCH (m:Movie)
WHERE m.imdbRating IS NOT NULL
RETURN m.title, m.imdbRating
ORDER BY m.imdbRating DESC

The question you want to answer is:

What is the youngest actor that acted in the most highly-rated movie?

Enter the name (case-sensitive!):

  • ✓ Scott Grimes

Hint

Use the MATCH pattern (m:Movie)←[ACTED_IN]-(p:Person). You will add another property to order the results by.

Once you have entered the name, which is case-sensitive, click the Try Again button below to continue.

Solution

You can run the following query to find the answer:

cypher
MATCH (m:Movie)<-[ACTED_IN]-(p:Person)
WHERE m.imdbRating IS NOT NULL
RETURN m.title, m.imdbRating, p.name, p.born
ORDER BY m.imdbRating DESC, p.born DESC

What is the name of the youngest actor?

Once you have entered the name, which is case-sensitive, click the Try Again button below to continue.

Summary

In this challenge, you wrote a query to return results sorted by multiple values.

In the next lesson, you will learn limiting how much data is returned.