0
0
DBMS Theoryknowledge~10 mins

NoSQL database types (document, key-value, column, graph) in DBMS Theory - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - NoSQL database types (document, key-value, column, graph)
Start: Choose NoSQL type
Use case decides best fit
You pick a NoSQL type based on data structure: documents, key-value pairs, columns, or graphs.
Execution Sample
DBMS Theory
INSERT INTO DocumentDB {"name": "Alice", "age": 30}
PUT KeyValueDB "user123" "Alice"
INSERT INTO ColumnDB (user_id, name) VALUES (123, "Alice")
CREATE NODE GraphDB (id:1, name:"Alice")
CREATE EDGE GraphDB (from:1, to:2, relation:"friend")
Shows how data is stored differently in each NoSQL type.
Analysis Table
StepDatabase TypeOperationData StoredInternal StructureResult
1DocumentInsert{"name": "Alice", "age": 30}JSON-like documentDocument stored with fields name and age
2Key-ValuePutKey: "user123", Value: "Alice"Simple key-value pairKey-value pair stored
3ColumnInsertuser_id=123, name="Alice"Columns grouped in familiesRow inserted with columns
4GraphCreate NodeNode id=1, name="Alice"Node with propertiesNode created
5GraphCreate EdgeEdge from node 1 to 2, relation="friend"Edge connecting nodesEdge created linking nodes
6----Execution ends after all inserts
💡 All data inserted into respective NoSQL database types
State Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5Final
DocumentDBempty{"name": "Alice", "age": 30}{"name": "Alice", "age": 30}{"name": "Alice", "age": 30}{"name": "Alice", "age": 30}{"name": "Alice", "age": 30}{"name": "Alice", "age": 30}
KeyValueDBemptyempty{"user123": "Alice"}{"user123": "Alice"}{"user123": "Alice"}{"user123": "Alice"}{"user123": "Alice"}
ColumnDBemptyemptyemptyRow with user_id=123, name="Alice"Row with user_id=123, name="Alice"Row with user_id=123, name="Alice"Row with user_id=123, name="Alice"
GraphDB NodesemptyemptyemptyNode 1: {name: "Alice"}Node 1: {name: "Alice"}Node 1: {name: "Alice"}Node 1: {name: "Alice"}
GraphDB EdgesemptyemptyemptyemptyemptyEdge from 1 to 2: {relation: "friend"}Edge from 1 to 2: {relation: "friend"}
Key Insights - 3 Insights
Why does the Document database store data as JSON-like documents instead of simple key-value pairs?
Because Document databases store complex, nested data with multiple fields in one document, unlike Key-Value databases which store only simple pairs. See execution_table rows 1 and 2.
How is data organized differently in Column databases compared to Document databases?
Column databases group data by columns in families for fast queries on specific columns, while Document databases store whole documents. See execution_table rows 1 and 3.
Why do Graph databases have nodes and edges instead of just storing data like other NoSQL types?
Graph databases model relationships explicitly with edges connecting nodes, which helps with connected data queries. See execution_table rows 4 and 5.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 2. What kind of data is stored in the Key-Value database?
AA simple key and its associated value
BA JSON document with multiple fields
CColumns grouped in families
DNodes and edges representing relationships
💡 Hint
Check the 'Data Stored' column at step 2 in execution_table
At which step does the Graph database create a connection between two nodes?
AStep 3
BStep 5
CStep 4
DStep 1
💡 Hint
Look for 'Create Edge' operation in execution_table
If you want to store user profiles with many fields and nested data, which NoSQL type from the table is best?
AKey-Value database
BColumn database
CDocument database
DGraph database
💡 Hint
See execution_table row 1 for storing complex data
Concept Snapshot
NoSQL databases store data differently:
- Document: JSON-like documents with fields
- Key-Value: simple key and value pairs
- Column: data in columns grouped by families
- Graph: nodes connected by edges
Choose type based on data shape and query needs.
Full Transcript
NoSQL databases come in four main types: document, key-value, column, and graph. Document databases store data as JSON-like documents with multiple fields, good for complex data. Key-value databases store simple pairs of keys and values, ideal for fast lookups. Column databases organize data by columns grouped in families, useful for queries on specific columns. Graph databases store nodes and edges to represent connected data and relationships. Each type suits different use cases depending on data structure and query patterns.