---
type: archive
area: archive
status: archived
date: 2026-05-03
created: 2026-05-03
updated: 1980-01-01
tags:
  - archive
---
Neo4j is fully ACID compliant. This means that:

- Atomicity - If a part of a transaction fails, the database state is left unchanged.
    
- Consistency — Every transaction leaves the database in a consistent state.
    
- Isolation — During a transaction, modified data cannot be accessed by other operations.
    
- Durability — The DBMS can always recover the results of a committed transaction.


3-4
MATCH (u1:User) WHERE u1.occupation IN ["artist", "writer"] RETURN u1;

MATCH (u1:User) WHERE u1.occupation = 'student' RETURN Avg(u1.age);

MATCH (u1:User) RETURN u1.occupation, Avg(u1.age);
// group by est fait implicitement

MATCH (u1:User) RETURN u1.occupation, count(u1);

MATCH (u1:User) RETURN u1.occupation as Occupation, count(u1) as NbrPersonne Order by NbrPersonne DESC Limit 5;

MATCH (u1:User) RETURN count(Distinct u1.occupation);

###########

MATCH (u1:User)

WITH u1.occupation AS occupation, AVG(u1.age) AS AVG_Age

WHERE AVG_Age >= 30

RETURN occupation, AVG_Age;

#############
// with add a new stage of aggregation bfore where and after that returning

### Part 2
	MATCH ()-[r:RATED]->()RETURN TYPE(r) AS rel_type, count(*) AS rel_cardinality

	MATCH (:Movie {title: "Braveheart (1995)"})<-[r:RATED]-(:User)
	RETURN COUNT(DISTINCT r) AS numberOfUsers;
	
	MATCH (G:Genre)<-[r:CATEGORIZED_AS]-(:Movie) RETURN G.name as label ,count(r) as nbrFilms;

	MATCH (m:Movie)<-[r:RATED]-(:User) RETURN m.title as Film ,count(r) as nbrNote order by nbrNote DESC;
	

	MATCH (m:Movie)<-[r:RATED]-(:User) where r.note = 1 RETURN count(Distinct m) as nbrFilm;

	MATCH (p:Movie)<-[r:RATED]-(:User)
	WITH p,AVG(r.note) as noteMoyenne
	WHERE noteMoyenne > 4
	RETURN COUNT(DISTINCT p) AS numberOfMovies;

	MATCH (p:Movie)<-[r:RATED]-(:User)
	WITH p,AVG(r.note) as noteMoyenne
	WHERE noteMoyenne = 5
	RETURN p.title
## Part3
	MATCH (u:User {id: 1})-[:FRIEND_OF]->(m)<-[:FRIEND_OF]-(friends)
	WHERE friends <> u
	RETURN DISTINCT friends;
