Document + Graph Databases Flashcards

(14 cards)

1
Q

How do document databases work?

A
  • like a python dictionary with key-value pairs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why are document db used?

A
  • they’re just texted so it can be parsed easily, human-readable
  • sql adds overheard which you might not need (think about what a blog needs)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What do vertices and edges represent in graph databases?

A

vertices:
- objects, things w/ attributes/properties (entities in ER model)

edges:
- relationships b/w
- directed, but searching can ignore direction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In Neo4J, what’s the syntas to create something with 2 attributes?

A

CREATE (Name:Label {key:value, key2:value2})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In Neo4J, create a Person Keanu reeves, with the name being just his first name and he’s born in 1964

A

CREATE (Keanu: Person {name:’Keanu Reeves’, born: 1964})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In Neo4J, create the relationship ACTED_IN between Keanu and the matrix. the property should include their role

A

CREATE (Keanu)-:[:ACTED_IN {roles:[‘Neo’]}]->(TheMatrix)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Describe how to represent a node and edge in Neo4J

A

() = node
[] = edge
- edges are always directional

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does MATCH and RETURN do here:
MATCH (a)-[]-(b) RETURN a,b

A

MATCH - searches for relationships satisfying the pattern
RETURN - specifies what is the result set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to show everything about a movie?

A

MATCH (m:movie) RETURN m

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to search for a person named tom Hanks?

A

MATCH (tom:Person {name:”Tom Hanks”}) return tom

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to make a director and movie?

A

MATCH (p:Person)-[d:DIRECTED]->(m:Movie) RETURN p,d,m

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Show the query to find person, director, and movie that was released after 2010

A

MATCH (p:Person)-[d:Directed]-(m:Movie) WHERE m.released>2010 RETURN p,d,m

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly