Putting it all together
match (n) detach delete n;
create (n:Student{id:101,firstname:"Rachel",lastname:"Green",gender:"F",dob:"2000-01-01"});
create (n:Student{id:102,firstname:"Monica",lastname:"Geller",gender:"F",dob:"2000-02-01"});
create (n:Student{id:103,firstname:"Ross",lastname:"Geller",gender:"M",dob:"1999-01-05"});
create (n:Student{id:104,firstname:"Chandler",lastname:"Bing",gender:"M",dob:"1999-02-07"});
create (n:Student{id:105,firstname:"Phoebe",lastname:"Buffay",gender:"F",dob:"1998-03-07"});
create (n:Student{id:106,firstname:"Joey",lastname:"Tribianni",gender:"M",dob:"1999-07-08"});
create (n:Student{id:107,firstname:"Janice",gender:"F",dob:"2000-07-08"});
CREATE CONSTRAINT cons_stuid_notnull IF NOT EXISTS FOR (n:Student) REQUIRE n.id IS NOT NULL;
CREATE CONSTRAINT cons_stuid_unique IF NOT EXISTS FOR (n:Student) REQUIRE n.id IS UNIQUE;
create (n:Student{id:108,firstname:"Gunther",gender:"M",dob:"1995-07-08"});
create (t:Course{id:"C001",name:"Applied DB"});
create (t:Course{id:"C002",name:"Big Data"});
create (t:Course{id:"C003",name:"Data Warehousing"});
create (t:Course{id:"C004",name:"Web Programming"});
create (t:Course{id:"C005",name:"Rust Programming"});
create (z:Faculty{id:"F001",firstname:"Ganesh",lastname:"Chandra"});
create (z:Faculty{id:"F002",firstname:"Jack",lastname:"Myers"});
create (z:Faculty{id:"F003",firstname:"Tony",lastname:"Brietzman"});
Queries
Retrieve All Students
Find a Specific Student by ID
3. List All Courses
4. Find Students Taking a Specific Course
5. List Courses Taught by a Specific Faculty
6. Find Students and Their Grades for a Specific Course
7. Find Average Grade for Each Course
8. Identify Students Taking Courses with a Specific Faculty
9. Create a Friendship Relationship Between Students
Creates a "FRIENDS_WITH" relationship between two students.
10. Find Students and the Number of Courses They Are Taking
Counts how many courses each student is taking.
11. Find the Most Popular Course
12. Students and Their Friends Taking the Same Course
Search by Semester & Grade
Show all connected nodes for a given node (upto 4 levels)
Show all connected nodes
Last updated