Fireship · @fireship
Neo4j in 100 Seconds
Uploaded January 24, 2023 · Length 2:37
Summary
neo4j graph database basics and querying with Cipher in 100 seconds
- neo4j
- graph database
- cypher
- property graph model
- acid compliance
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
neo4j an acid compliant graph database
- 0:03
that can handle the extremely complex
- 0:04
relational data of the modern world it
- 0:07
was created in 2007 by Emil ifram is
- 0:09
written in Java and pioneered the
- 0:11
property graph model traditional
- 0:13
relational databases use a tabular model
- 0:15
but joining normalized tables together
- 0:17
is not how real humans think about
- 0:19
relationships naturally we think about
- 0:20
connections between entities like Bob
- 0:23
asked a question on stack Overflow then
- 0:25
Alice and Chad downvoted it so Bob gave
- 0:27
up on his dream of programming a graph
- 0:29
can model this data the same way you
- 0:30
might visualize it on a whiteboard nodes
- 0:32
represent entities edges represent
- 0:34
relationships between entities and
- 0:36
properties are key value pairs that
- 0:37
store data on these objects under the
- 0:39
hood neo4j is a true native graph
- 0:41
database that applies this model all the
- 0:43
way down to the storage level queries
- 0:45
are written in a declarative language
- 0:46
called Cipher that resembles SQL except
- 0:49
nodes are surrounded by parentheses then
- 0:51
connect to other nodes with arrows via
- 0:53
relationships and brackets today neo4j
- 0:56
is used in applications like
- 0:57
recommendation engines social media
- 0:59
platforms and knowledge graphs for
- 1:01
artificial intelligence and just to name
- 1:03
a few to get started it can be
- 1:04
self-hosted with Docker but the easiest
- 1:06
approach is to sign up for Aura which
- 1:08
provides a free fully managed database
- 1:10
in the cloud from there we can build the
- 1:12
next Twitter by making queries with
- 1:13
Cipher use create followed by
- 1:15
parentheses to create a new entity or
- 1:17
node this node has a label of user that
- 1:19
can be used to group similar nodes
- 1:21
together inside the braces we can add
- 1:23
key value pairs to represent the data on
- 1:25
that node now a user might want to
- 1:27
follow another user which can be
- 1:28
represented with a relationship inside
- 1:30
of brackets then notice how the arrow
- 1:32
points to another node with a label of
- 1:34
user and that's all it takes to create
- 1:36
relational data no foreign keys or join
- 1:38
tables required although we can add
- 1:40
constraints to the schema such as the
- 1:42
one here that will ensure every username
- 1:44
is unique in addition we can define
- 1:45
local variables in this query then
- 1:47
return them from the statement to get
- 1:49
the data back as the result and what's
- 1:50
especially awesome is that we can
- 1:52
visualize it as an interactive graph or
- 1:54
even as a table now to continue building
- 1:56
Twitter we can connect multiple tweet
- 1:57
nodes to a user we also need a query
- 1:59
that will return all the tweets from all


