0% found this document useful (0 votes)
10 views6 pages

Chaima Gherib Report1

The document is a practical report on Neo4j, a graph NoSQL database, focusing on its features, operations, and an employee management system exercise. It outlines key features such as flexible schema and efficient querying for connected data, along with operations like CREATE, MATCH, and DELETE using the Cypher query language. The report concludes with a comparison of NoSQL and SQL databases, highlighting their structural and operational differences.

Uploaded by

gheribchayma347
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views6 pages

Chaima Gherib Report1

The document is a practical report on Neo4j, a graph NoSQL database, focusing on its features, operations, and an employee management system exercise. It outlines key features such as flexible schema and efficient querying for connected data, along with operations like CREATE, MATCH, and DELETE using the Cypher query language. The report concludes with a comparison of NoSQL and SQL databases, highlighting their structural and operational differences.

Uploaded by

gheribchayma347
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

University of 08 mai 1945 Guelma

Computer Science Department


Web and Network

Student Name: Gherib Chaima


Instructor: Dr.ziaya

Subject: NoSQL Databases – Practical Report


Topic: Neo4j (Graph NoSQL) – Employee Management System

Date: May 2025

Contents
1. What is Neo4j?...................................................................................................................................3
2. Neo4j Features and Operations...........................................................................................................3
Key features:......................................................................................................................................3
operations used:..................................................................................................................................3
3. Step by Step Exercise Solution...........................................................................................................4
Conclusion: NoSQL vs. SQL Databases....................................................................................................5
1. What is Neo4j?
Neo4j is a popular NoSQL graph database that allows you to represent your data as nodes,
relationships, and properties. Instead of storing your data in tables and rows, Neo4j has
positioned itself as a graph database, making it super efficient to query for connected data.

Neo4j stores data as:

Nodes (entities) e.g. people, places, things

Relationships (connections) between nodes e.g. "FRIEND_OF", "HAS_VISITED"

Properties (key-value-pairs) on both nodes and relationships

These types of connections can be leveraged for applications involving social networks,
recommendations, fraud detection, network and IT operations, and identity and access
management.

2. Neo4j Features and Operations


Key features:

Queries perform well for deep joins and complex data models.

No fixed schema, so you can start with a data model of your use-case.

A graph model is not a bunch of tables. It is far easier to understand because it matches the
way we think naturally and is close to how you would draw it on paper.

operations used:

CREATE: to add nodes and relationships to the graph.

MATCH: to get or find nodes or patterns from the graph.

WHERE: to filter data by expressing conditions.

SET: to update properties on a node.

DETACH DELETE: to delete a node and its relationships in one action.

RETURN: to display the result of a query.

ORDER BY, AVG(), COUNT(), and more: to aggregate and analyze results.

CREATE INDEX: to search data (as fast as a lookup table) and avoid checking every single
node on an equality condition.
The statements use a pattern query language called Cypher, which is designed for expressing
graph patterns.

3. Step by Step Exercise Solution


 Creating Employee Nodes

Three employee nodes were created using the CREATE clause, each with properties such as
name, position, age, salary, and skill.

 Relationships

such as MENTORS and WORK_IN_SAME_TEAM were added between employees using


MATCH and CREAT

Step 2: Running Cypher Queries

For this step, I had to run some Cypher Queries including:

Match all the employees

Match an employee by their name

Filter on the skills and the salary

Update and delete nodes

Calculate the total nodes and the average age of nodes

Match the employees and sort by ile

Create an index on name field

So let’s do it

 Running Cypher Queries


 For this step, I had to run some Cypher Queries including:
 Match all the employees
 Match an employee by their name
 Filter on the skills and the salary
 Update and delete nodes
 Calculate the total nodes and the average age of nodes
 Match the employees and sort by ile
 Create an index on name field

Question Question Cypher Query


Q2 Create employee CREATE (:Employee {name: "Alice Johnson", position: "Software Engineer",
nodes (Alice, age: 30, salary: 75000, skills: ["Java", "MongoDB", "React"]});CREATE
(:Employee {name: "Bob Smith", position: "Project Manager", age: 40, salary:
Bob, Charlie) 90000, skills: ["Agile", "Scrum", "Leadership"]});CREATE (:Employee
Question Question Cypher Query
{name: "Charlie Brown", position: "Data Analyst", age: 35, salary: 65000,
skills: ["Python", "SQL", "MongoDB"]});
MATCH (a:Employee {name: "Alice Johnson"}), (b:Employee {name: "Bob
Create Smith"}) CREATE (a)-[:MENTORS]->(b);MATCH (b:Employee {name:
relationships "Bob Smith"}), (c:Employee {name: "Charlie Brown"}) CREATE (b)-
Q3 [:MENTORS]->(c);MATCH (a:Employee {name: "Alice Johnson"}),
between
employees (c:Employee {name: "Charlie Brown"}) CREATE (a)-
[:WORK_IN_SAME_TEAM]->(c);
Retrieve all
Q4 MATCH (e:Employee) RETURN e;
employees
Find employee
Q5 named "Alice MATCH (e:Employee {name: "Alice Johnson"}) RETURN e;
Johnson"
Find employees
with
Q6 MATCH (e:Employee) WHERE "MongoDB" IN e.skills RETURN e;
"MongoDB" in
skills
Find employees
Q7 with salary > MATCH (e:Employee) WHERE e.salary > 70000 RETURN e;
70,000
Update Alice
Q8 Johnson’s salary MATCH (e:Employee {name: "Alice Johnson"}) SET e.salary = 80000;
to 80,000
Add "Node.js" to
MATCH (e:Employee {name: "Charlie Brown"}) SET e.skills = e.skills +
Q9 Charlie Brown’s "Node.js";
skills
Delete Bob
Q10 MATCH (e:Employee {name: "Bob Smith"}) DETACH DELETE e;
Smith
Calculate
Q11 MATCH (e:Employee) RETURN avg(e.salary) AS AverageSalary;
average salary
Count number of
Q12 MATCH (e:Employee) RETURN count(e) AS TotalEmployees;
employees
Create index on CREATE INDEX employee_name_index IF NOT EXISTS FOR (e:Employee)
Q13 ON (e.name);
name
List employees
Q14 MATCH (e:Employee) RETURN e.name, e.age ORDER BY e.age ASC;
sorted

Conclusion: NoSQL vs. SQL Databases


Feature SQL (Relational DB) NoSQL (Graph - Neo4j)
Structure Tables with rows and columns Nodes and relationships
Schema Fixed and strict Flexible and dynamic
Data modeling Relies on joins Uses direct relationships
Best for Structured data Connected/graph-based data
Query language SQL Cypher

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy