Hi I am having syntax error while converting these into cypher queries.How can I work with this please
Query:
SELECT Manager_name,
Count(Order_id) AS number_of_orders
FROM Manager
INNER JOIN
sOrder ON Manager.Manager_id = sOrder.Manager_id
GROUP BY sOrder.Manager_id;
What is your domain model, so I can write an equivalent cypher for your sql query? I will assume the following model to give you an illustration of the equivalent cypher query.
The following query will give you a list of manager's with orders and their order count:
match(m:Manager)-[:HAS_ORDER]->(o:Order)
return m.name, count(o) as numOfOrders
Hi thank you so much .It works for me. Can you please help me with this last two queries. Highly appreciated.I have added the cypher query I tried at last.I am having syntax error.Please if you dont mind.I just started with Neo4j
Manager wants to know about details of all the customers and their orders whose order status is delivered and order value is between 900 USD and 1300 USD.
Query 1:
SELECT *
FROM sOrder
INNER JOIN
Customer ON sOrder.Cust_id = Customer.Cust_id
WHERE sOrder.status = 'Delivered' AND
Order_id IN (
SELECT Order_id
FROM sOrder
WHERE order_value BETWEEN 900 AND 1300
);
The manager wants to name of all the customer who have placed order of more than 5 items.
Query 2:
SELECT cust_name
FROM sOrder
INNER JOIN
Customer ON sOrder.Cust_id = Customer.Cust_id
WHERE Order_id IN (
SELECT Order_id
FROM sOrder
WHERE no_of_items > 5
);
Query I tried:
Query 1
cypher//query_5
MATCH (o:Order {o.status:"Delivered"} ) )<-[c:Customer] AND o:order_id IN (Match (i) where i.order_value range (900 , 1300) return i.order_id)
RETURN o;
Query 2:
MATCH (o:Order {o.status:"Delivered"} ) )<-[c:Customer] AND o:order_id IN (Match (i:Order) where i.no_of_items > 5 return i.order_id)
RETURN o.cust_namer;
Yes, I am happy to help. Are you already using neo4j? If so, do you have a data model you can share with me so I can help with the exact queries?
your queries do not use correct cypher syntax. You are mixing sql and some cypher. I will rewrite them tomorrow, but having your data model would be better than me making one up.
You should take free courses neo4j offers. The beginner level ones will really help you get started. I also read the cypher manual over and over until I really grasped the language.