Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What does NoSQL stand for and why is it used?
NoSQL means "Not Only SQL." It is used to store and manage data that doesn't fit well into traditional tables, like big or flexible data.
Click to reveal answer
beginner
Name four common types of NoSQL databases.
The four common types are: Document stores (like MongoDB), Key-Value stores (like Redis), Column stores (like Cassandra), and Graph databases (like Neo4j).
Click to reveal answer
beginner
How does a document store database organize data?
It stores data as documents, usually in JSON-like format, where each document can have different fields and structures, making it flexible.
Click to reveal answer
beginner
What is a key-value store and when is it useful?
A key-value store saves data as pairs: a unique key and its value. It's useful for fast lookups when you know the key, like caching user sessions.
Click to reveal answer
intermediate
Why might someone choose a graph database?
Graph databases are great for data with many relationships, like social networks or recommendation systems, because they store data as nodes and edges.
Click to reveal answer
Which NoSQL database type stores data as JSON-like documents?
AGraph database
BKey-value store
CColumn store
DDocument store
✗ Incorrect
Document stores organize data as flexible documents, often in JSON format.
What is a key feature of column store databases?
AStore data in rows like tables
BStore data as key-value pairs
CStore data in columns for fast aggregation
DStore data as nodes and edges
✗ Incorrect
Column stores save data by columns, which helps speed up queries that aggregate data.
Which NoSQL model is best for representing social networks?
AGraph database
BDocument store
CKey-value store
DColumn store
✗ Incorrect
Graph databases are designed to handle complex relationships like social connections.
Why might NoSQL databases be preferred over traditional SQL databases?
AThey handle flexible or large-scale data better
BThey require fixed schemas
CThey always use SQL queries
DThey cannot scale horizontally
✗ Incorrect
NoSQL databases are good for flexible data and can scale easily across many servers.
Which NoSQL type is best for fast access when you know the exact key?
ADocument store
BKey-value store
CGraph database
DColumn store
✗ Incorrect
Key-value stores provide very fast lookups by key.
Explain the main differences between SQL and NoSQL databases.
Think about how data is organized and how flexible the structure is.
You got /4 concepts.
Describe a real-life example where a graph database would be more useful than a document store.
Consider how friends connect on social media.
You got /4 concepts.
Practice
(1/5)
1. Which of the following best describes a key-value NoSQL database?
easy
A. Stores data as pairs of keys and their associated values
B. Organizes data strictly in rows and columns like a spreadsheet
C. Uses SQL queries to retrieve data from tables
D. Represents data as nodes and edges in a network
Solution
Step 1: Understand key-value database structure
Key-value databases store data as unique keys linked to values, like a dictionary.
Step 2: Compare with other database types
Relational databases use tables; graph databases use nodes and edges; key-value is simpler with pairs.
Final Answer:
Stores data as pairs of keys and their associated values -> Option A
Quick Check:
Key-value = key-value pairs [OK]
Hint: Key-value means simple pairs: key and its value [OK]
Common Mistakes:
Confusing key-value with relational tables
Thinking key-value uses SQL queries
Mixing key-value with graph database concepts
2. Which of the following is the correct way to represent a document in a document-based NoSQL database?
easy
A. {"name": "Alice", "age": 30}
B. ("name", "Alice", "age", 30)
C. ["name", "Alice", "age", 30]
D. name: Alice; age: 30;
Solution
Step 1: Identify document format in NoSQL
Document databases use JSON-like objects with key-value pairs inside braces {}.
Step 2: Check each option's format
{"name": "Alice", "age": 30} uses JSON object syntax; others use tuples, lists, or invalid syntax.
Final Answer:
{"name": "Alice", "age": 30} -> Option A
Quick Check:
Document = JSON object format [OK]
Hint: Documents look like JSON objects with braces {} [OK]
Common Mistakes:
Using parentheses instead of braces
Confusing lists with documents
Writing invalid key-value syntax
3. Given a graph database storing people and their friendships, which query result would you expect from: MATCH (p:Person)-[:FRIEND]->(f:Person) RETURN p.name, f.name?
medium
A. Only persons who have no friends
B. All person names without any relationships
C. A count of all persons in the database
D. Pairs of person names where the first is friends with the second
Solution
Step 1: Understand the MATCH pattern
The query finds nodes labeled Person connected by FRIEND relationships from p to f.
Step 2: Interpret the RETURN clause
It returns the names of p and f, showing pairs where p is friends with f.
Final Answer:
Pairs of person names where the first is friends with the second -> Option D
Quick Check:
Graph query returns connected pairs [OK]
Hint: MATCH with relationship returns connected node pairs [OK]
Common Mistakes:
Thinking it returns all persons regardless of friendship
Expecting counts instead of pairs
Confusing direction of FRIEND relationship
4. You wrote this query for a column-family NoSQL database: SELECT name, age FROM users WHERE age > 25. It returns an error. What is the likely problem?
medium
A. The age column cannot be filtered
B. The WHERE clause is missing a semicolon
C. Column-family databases do not use SQL syntax like SELECT
D. The table name 'users' is misspelled
Solution
Step 1: Recall column-family query style
Column-family NoSQL databases like Cassandra use CQL, similar but not always supporting full SQL syntax.
Step 2: Identify syntax mismatch
Some column-family databases require specific query formats; plain SQL SELECT with WHERE may cause errors.
Final Answer:
Column-family databases do not use SQL syntax like SELECT -> Option C
Quick Check:
Column-family ≠ standard SQL [OK]
Hint: Column-family queries differ from standard SQL [OK]
Common Mistakes:
Assuming all NoSQL use SQL syntax
Ignoring database-specific query language
Blaming typos without checking syntax
5. You want to model a social network with users and their followers using a NoSQL database. Which model is best suited to efficiently represent and query these relationships?
hard
A. Key-value store, because it stores user IDs and follower counts
B. Graph database, because it stores nodes and edges representing users and follower links
C. Document database, because it stores user profiles as JSON documents
D. Column-family database, because it stores data in wide tables
Solution
Step 1: Understand social network data needs
Social networks have complex, connected data with users linked by follower relationships.
Step 2: Match data needs to NoSQL model
Graph databases excel at storing and querying connected nodes and edges efficiently.
Step 3: Compare other models
Key-value and document stores handle data but less efficient for complex relationships; column-family is for wide tables.
Final Answer:
Graph database, because it stores nodes and edges representing users and follower links -> Option B
Quick Check:
Connected data = Graph database [OK]
Hint: Use graph DB for connected user relationships [OK]