Home > Enterprise >  How can I create a table using a query on a graph database such that the node properties become the
How can I create a table using a query on a graph database such that the node properties become the

Time:01-31

I am using AGE and I want to create a table from the data stored in the nodes. The nodes in my graph database have properties that store data about the node. I need to write a query that returns the node data in a tabular format, with each property becoming a field in the table.

For example, if I have a node with properties name, age, and city, I want my query to return a table with three columns, name, age, and city, and one row for each node.

CodePudding user response:

The following query will return properties in a tabular format:

SELECT * 
FROM cypher('graph',
$$
    MATCH (n)
    RETURN n.name, n.age, n.city
$$
) as (name agtype, age agtype, city agtype);
  • Related