Generating Cypher Statements

Now for another challenge.

Your goal is to find out which movie has the highest IMDB rating in the movies database.

You can repeat the steps from the previous challenge, instead asking for the highest rated movie and its IMDB rating.

Ask Copilot the specific question:

text
Which movie has the highest IMDB rating, and what is its rating?

Copilot will use the read-neo4j-cypher tool to generate and execute a Cypher query to find the movie with the highest IMDB rating.

If you have followed the instructions correctly, you should now see a response from Copilot that answers the question.

Non-null properties

The imdbRating property does not exist for all movies in the database. This is treated by Neo4j as a null property, which are treated as the lowest possible value when ordered in descending order.

You may need to instruct Copilot to only return movies with a non-null imdbRating property.

Highest Rated Movie

After generating and executing a Cypher query, what is the rating of the highest rated movie?

  • ✓ 9.6

Hint

Use Copilot to ask about finding the highest rated movie. You can ask:

What movie has the highest IMDB rating in the database?

Or you can be more specific:

Generate a Cypher query to find the movie with the highest imdbRating property

Copilot should generate and execute a Cypher query that returns the movie with the highest IMDB rating.

Solution

The correct answer is 9.6.

According to the database, "Band of Brothers" has the highest IMDB rating with a score of 9.6.

The Cypher query to find this would be something like:

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

Summary

You used the read-neo4j-cypher tool to generate a Cypher query that finds the movie with the highest IMDB rating in the movies database.

In the next challenge, you will use VS Code to build a simple Python application.