Data & Analytics
Explaining a graph query with one worked example
A graph database becomes easier to sell when buyers can see a question answered in plain steps. This guide uses a customer-referral example to show how to present a first query clearly.
01
Step one: model the question as connections
Begin with a business question that depends on relationships, such as: which customers were referred by people who also referred a high-value account? Name the node types first: Customer and Account. Then name the connection: REFERRED. Draw this as two circles joined by an arrow before showing any code. In a worked example, this keeps attention on the shape of the problem. A reader should understand that the data is a network, not a table, and that the query will follow arrows outward from a chosen starting person.
02
Step two: write the query in readable pieces
Show a pattern query in a Cypher-style form: match a customer who referred another customer, who then holds an account tagged high value; return the first customer's name and the count of such referrals. Explain each clause in one sentence: match describes the path, where narrows it, return chooses the output. Avoid adding extra filters at this stage. A first example works best when someone can read it aloud and predict the result. Include the sample records beside it, perhaps six people and eight referrals, so the logic can be checked by hand.
03
Step three: compare the answer with a table approach
Finish by showing the result as a short list, then describe how the same question would require repeated joins in a relational layout. Do not claim speed gains without testing; focus on clarity. Ask the reader to extend the example by one more hop, such as referrals of referrals, and notice how little the query changes. That final decision shows when a graph model earns its place: when questions grow longer paths, not just more rows. Close with a checklist covering sample data, expected output, query explanation and the next question to try.