2. Relational DB
This example has one to one
mapping.
Foreign key reference.
Normalized Structure, no
redundancy.
Unique identifier necessary for
primary key as well as foreign key.
Article ID Article Name Article Content Article Date Author ID
ar1 Some Article Some Content 20-Feb-2010 au1
ar2 Other Article Other Content 10-Nov-2019 au2
ar3 Another Article Another Content 15-Sep-2011 au2
Author ID Author Name Author DOB
au1 Classy Betty 03-Jan-1970
au2 Casual Sam 04-Mar-1960
3. Document DB (no-SQL)
The same example from previous
slide is designed with one level
nesting in this structure.
Author structures nested in Article
structures.
Redundancy in author information,
but that is normal in view of faster
access.
Unlike relational DB, unique
identifier not needed.
Usually represented as JSON
structure (illustrated to the right) or
key-value store (illustrated in a later
slide).
[
{
"Article Name": "Some Article",
"Article Content": "Some Content",
"Article Date": "20-Feb-2010",
"Author": {
"Author Name": "Classy Betty",
"Author DOB": "03-Jan-1970"
}
},
{
"Article Name": "Other Article",
"Article Content": "Other Content",
"Article Date": "10-Nov-2019",
"Author": {
"Author Name": "Casual Sam",
"Author DOB": "04-Mar-1960"
}
},
{
"Article Name": "Another Article",
"Article Content": "Another Content",
"Article Date": "15-Sep-2011",
"Author": {
"Author Name": "Casual Sam",
"Author DOB": "04-Mar-1960"
}
}
]
4. Graph DB
This example has one to one
mapping, explained as relations.
Normalized Structure, no
redundancy.
Graph consists of nodes and
relationship.
Both nodes and relationship can
have additional properties.
Type Command
Articles
(Node)
CREATE
(ar1:Article {name:'Some Article',content:"Some Content",date:"20-Feb-2010"})
CREATE
(ar2:Article {name:'Other Article',content:"Other Content",date:"10-Nov-2019"})
CREATE
(ar3:Article {name:'Another Article',content:"Another Content",date:"15-Sep-2011"})
Authors
(Node)
CREATE (au1:Author {name:'Classy Betty',dob:'03-Jan-1970'})
CREATE (au2:Author {name:'Casual Sam',dob:'04-Mar-1960'})
Authored By
(Relationship)
CREATE (ar1)-[:AUTHORED_BY]->(au1)
CREATE (ar2)-[:AUTHORED_BY]->(au2)
CREATE (ar3)-[:AUTHORED_BY]->(au2)
5. Relational DB
This example has many to many
relationship.
Foreign key reference in a separate
mapping table.
Normalized Structure, no
redundancy.
Unique identifier necessary for
primary key as well as foreign key.
Article ID Article Name Article Content Article Date
ar1 Some Article Some Content 20-Feb-2010
ar2 Other Article Other Content 10-Nov-2019
ar3 Another Article Another Content 15-Sep-2011
Author ID Author Name Author DOB
au1 Classy Betty 03-Jan-1970
au2 Casual Sam 04-Mar-1960
Author ID Article ID
au1 ar1
au2 ar1
au2 ar2
au1 ar3
au2 ar3
6. Document DB (no-SQL)
The same example from previous
slide is designed with one level
nesting in this structure.
The structure shows Author
structures nested in Article
structures.
Redundancy in author information,
but that is normal in view of faster
access.
The nested modelling is predefined
in view of the consumer application.
Unlike relational DB, unique
identifier not needed.
Articles Collection (Authors nested within documents)
0 Article Name Some Article
Article Content Some Content
Article Date 20-Feb-2010
Authors 0 Author Name Classy Betty
Author DOB 03-Jan-1970
1 Author Name Casual Sam
Author DOB 04-Mar-1960
1 Article Name Other Article
Article Content Other Content
Article Date 10-Nov-2019
Authors 0 Author Name Casual Sam
Author DOB 04-Mar-1960
2 Article Name Another Article
Article Content Another Content
Article Date 15-Sep-2011
Authors 0 Author Name Classy Betty
Author DOB 03-Jan-1970
1 Author Name Casual Sam
Author DOB 04-Mar-1960
7. Document DB (no-SQL)
The same example from previous
slide is designed with one level
nesting in this structure.
The structure shows Article
structures nested in Author
structures.
Redundancy in article information,
but that is normal in view of faster
access.
The nested modelling is predefined
in view of the consumer application.
Unlike relational DB, unique
identifier not needed.
Authors Collection (Articles nested within documents)
0 Author Name Classy Betty
Author DOB 03-Jan-1970
Articles 0 Article Name Some Article
Article Content Some Content
Article Date 20-Feb-2010
1 Article Name Another Article
Article Content Another Content
Article Date 15-Sep-2011
1 Author Name Casual Sam
Author DOB 04-Mar-1960
Articles 0 Article Name Some Article
Article Content Some Content
Article Date 20-Feb-2010
1 Article Name Other Article
Article Content Other Content
Article Date 10-Nov-2019
2 Article Name Another Article
Article Content Another Content
Article Date 15-Sep-2011
9. Graph DB
This example has many to many
mapping, explained as relations.
Normalized Structure, no
redundancy.
Graph consists of nodes and
relationship.
Both nodes and relationship can
have additional properties.
Type Command
Articles
(Node)
CREATE
(ar1:Article {name:'Some Article',content:"Some Content",date:"20-Feb-2010"})
CREATE
(ar2:Article {name:'Other Article',content:"Other Content",date:"10-Nov-2019"})
CREATE
(ar3:Article {name:'Another Article',content:"Another Content",date:"15-Sep-2011"})
Authors
(Node)
CREATE (au1:Author {name:'Classy Betty',dob:'03-Jan-1970'})
CREATE (au2:Author {name:'Casual Sam',dob:'04-Mar-1960'})
Authored By
(Relationship)
CREATE (ar1)-[:AUTHORED_BY]->(au1)
CREATE (ar1)-[:AUTHORED_BY]->(au2)
CREATE (ar2)-[:AUTHORED_BY]->(au2)
CREATE (ar3)-[:AUTHORED_BY]->(au1)
CREATE (ar3)-[:AUTHORED_BY]->(au2)