IT (h3tU4ppf38mKMuC1_K72l)

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.

Screen Shot 2022-11-21 at 11.49.12 AM.png

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

graph model neo4j.pdf.jpg

Thank you for replying. I have added graph model as per what in Neo4j it looks like.Actually I do have CSV files imported from sqlite.Graph model.png

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.

https://graphacademy.neo4j.com

Hi please help if you’re available.I have a project due today and stucked with these queries.Thanks again

Query 1:

MATCH (o:orders)
WHERE o.Status = "Delivered" and 900 <= o.order_value <= 1300
MATCH (o)-[:PROCESSES_TO]->(c:customer) 
RETURN c, o

Query 2:

MATCH (o:orders)-[:PROCESSES_TO]->(c:customer) 
WITH c, count(o) as orderCount
WHERE orderCount > 5
RETURN c.Cust_id, c.Cust_name, orderCount

Let me know how they work.

Thank you so much for your help…for now it worked for me.I will go through the course for better understanding.Thanks again!