Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

SLIP NO - 14 FURNITURE SHOWROOM INFORMATION

Node : Section
create(:Section{Name:"Sofa"})
create(:Section{Name:"Cupboard"})
create(:Section{Name:"Bed"})
create(:Section{Name:"Table"})

Node : Furniture
create(:Furniture{Name:"Sofa Cumbed"})
create(:Furniture{Name:"Bed with storage"})
create(:Furniture{Name:"Dinning table"})
create(:Furniture{Name:"Tea table"})
create(:Furniture{Name:"Seel Cupboard"})
create(:Furniture{Name:"L-shaped Sofa"})

Node : Staff
create(:Staff{Name:"Mr.Jay"})
create(:Staff{Name:"Mrs.Neha"})
create(:Staff{Name:"Mr.Satish"})

Node : Customer
create(:Customer{Name:"Riya"})
create(:Customer{Name:"Siya"})
create(:Customer{Name:"Abhi"})
create(:Customer{Name:"Gita"})
create(:Customer{Name:"Ram"})

Relation : belong to
match(ss:Section),(f:Furniture)
where ss.Name="Sofa" and f.Name="L-shaped Sofa"
create (f)-[:belong_to{ftype:"Moving"}]->(ss)
return f,ss

match(ss:Section),(f:Furniture)
where ss.Name="Sofa" and f.Name="Sofa Cumbed"
create (f)-[:belong_to{ftype:"Moving"}]->(ss)
return f,ss

match(ss:Section),(f:Furniture)
where ss.Name="Table" and f.Name="Tea table"
create (f)-[:belong_to{ftype:"Moving"}]->(ss)
return f,ss

match(ss:Section),(f:Furniture)
where ss.Name="Table" and f.Name="Dinning table"
create (f)-[:belong_to{ftype:"Moving"}]->(ss)
return f,ss

match(ss:Section),(f:Furniture)
where ss.Name="Cupboard" and f.Name="Seel Cupboard"
create (f)-[:belong_to{ftype:"Non Moving"}]->(ss)
return f,ss

match(ss:Section),(f:Furniture)
where ss.Name="Bed" and f.Name="Bed with storage"
create (f)-[:belong_to{ftype:"Non Moving"}]->(ss)
return f,ss
Relationship : handle by
match(ss:Section),(s:Staff)
where ss.Name="Table" and s.Name="Mr.Satish"
create (ss)-[:handle_by]->(s)
return ss,s

match(ss:Section),(s:Staff)
where ss.Name="Table" and s.Name="Mrs.Neha"
create (ss)-[:handle_by]->(s)
return ss,s

match(ss:Section),(s:Staff)
where ss.Name="Bed" and s.Name="Mr.Satish"
create (ss)-[:handle_by]->(s)
return ss,s

match(ss:Section),(s:Staff)
where ss.Name="Cupboard" and s.Name="Mr.Jay"
create (ss)-[:handle_by]->(s)
return ss,s

match(ss:Section),(s:Staff)
where ss.Name="Sofa" and s.Name="Mr.Jay"
create (ss)-[:handle_by]->(s)
return ss,s

Relationship : purchase by
match(ss:Section),(c:Customer)
where ss.Name="Sofa" and c.Name="Abhi"
create (ss)-[:purchase_by]->(c)
return ss,c

match(ss:Section),(c:Customer)
where ss.Name="Table" and c.Name="Gita"
create (ss)-[:purchase_by]->(c)
return ss,c

Relationship : enquire by
match(ss:Section),(c:Customer)
where ss.Name="Table" and c.Name="Siya"
create (ss)-[:enquire_by]->(c)
return ss,c

match(ss:Section),(c:Customer)
where ss.Name="Cupboard" and c.Name="Ram"
create (ss)-[:enquire_by]->(c)
return ss,c

match(ss:Section),(c:Customer)
where ss.Name="Bed" and c.Name="Riya"
create (ss)-[:enquire_by]->(c)
return ss,c

QUIRIES :

a)List the type of furniture available in the showroom.


Query:
match(ss:Section),(f:Furniture) where(f)-[:belong_to]->(ss) return ss.Name,f.Name
OUTPUT :
ss.Name f.Name
Sofa Sofa Cumbed
Sofa L-shaped Sofa
Cupboard Seel Cupboard
Bed Bed with storage
Table Dinning table
Table Tea table

Query took 24 ms and returned 6 rows.

OR

Query:
match(f:Furniture) return f.Name

f.Name
Sofa Cumbed
Bed with storage
Dinning table
Tea table
Seel Cupboard
L-shaped Sofa

Query took 9 ms and returned 6 rows.

b)List the sections handled by Mr.satish.


Query:
match(ss:Section),(s:Staff) where s.Name="Mr.Satish" and (ss)-[:handle_by]->(s)
return ss.Name
OUTPUT :
ss.Name
Bed
Table

Query took 8 ms and returned 2 rows.

c)List the names of customers who have done only enquiry but not made any purchase.
Query:
match(ss:Section),(c:Customer) where(ss)-[:enquire_by]->(c) and not(ss)-
[:purchase_by]->(c) return DISTINCT c.Name
OUTPUT :
c.Name
Ram
Riya
Siya

Query took 39 ms and returned 3 rows.

d)List the fast moving furniture types.


Query:
match(f:Furniture)-[bt:belong_to]->(ss:Section) where "Moving" in bt.ftype return
f.Name
OUTPUT :
f.Name
Sofa Cumbed
L-shaped Sofa
Dinning table
Tea table
Query took 12 ms and returned 4 rows.

You might also like