WorksheetsNoSQL Databases Quiz
Total questions: 72
Worksheet time: 2hrs 16mins
Explore the commonalities in querying mechanisms between SQL and MongoDB, including filters, projections, and aggregation capabilities.
Learn techniques to retrieve data from HBase using filters, scans, and key-based lookups.
Understand how to perform efficient data retrieval in Redis using key-based access, pattern matching, and data structures like hashes, lists, and sets.
Examine how to transition between different document databases (e.g., MongoDB to CouchDB), covering data modeling, export/import, and compatibility issues.
Study how schema changes are managed in databases like HBase, including column family modifications and backward compatibility.
Learn the processes and tools (e.g., Apache Hadoop, HBase shell) for data import/export operations in HBase.
Understand how to handle changes in data structures in key-value databases like Redis, including versioning and migration strategies.
Define and implement a table with column families and qualifiers for real-world datasets.
Practice storing, retrieving, and updating key/value data in Redis.
Use commands such as SET, GET, DEL, and implement more complex operations involving data structures and transactions.
Explore the commonalities in querying mechanisms between SQL and MongoDB, including filters, projections, and aggregation capabilities.
SQL (Structured Query Language) and MongoDB (a NoSQL document-based database) follow different paradigms-relational vs. document-based-but they share many conceptual similarities in querying mechanisms. This makes it easier for developers with SQL knowledge to adapt to MongoDB.
While MongoDB uses JSON-style syntax and SQL uses declarative language, both provide powerful and similar querying capabilities. Understanding these parallels helps in transitioning between the two and designing data queries efficiently.
HBase is modeled after Google Bigtable and provides a distributed, scalable, big data store. It is part of the Hadoop ecosystem and is well-suited for read/write-intensive applications.
HBase, a prominent column-oriented NoSQL database, is widely used for handling large-scale data across distributed systems. Accessing data from HBase typically involves these steps: Understanding Table Structure: HBase tables are comprised of rows, columns (grouped into column families), and timestamps. Data is stored in key-value pairs, and rows are uniquely identified by row keys.
You can connect using APIs provided by HBase, such as Java, Python, or REST API.
Use APIs to write data into HBase by specifying row keys and column family.
Retrieve data using Get or Scan operations. A Get retrieves specific rows by row keys, while Scan allows fetching multiple rows in a range.
Modify or remove data using similar APIs.
Apply filters during Scan operations to narrow down the data fetched based on conditions like timestamps, column values, etc.
To enhance performance, use techniques like caching (Helps reduce disk I/O and improves read performance.), efficient row key design, and compression options.
HBase integrates seamlessly with Hadoop ecosystems and tools like Apache Phoenix for SQL-like querying.
Tables in HBase are made up of: Rows (identified by a unique row key), Column families (groups of related columns), Columns (key-value pairs under a family), Timestamps (for versioning). Data is stored sorted by row key.
Most Efficient Access Method: Directly fetches data associated with a given row key. Can be used to: Retrieve entire row data, Retrieve specific column families or columns.
Used when row key is not known. Retrieves multiple rows starting from a specific point. Useful for range queries or retrieving all data.
Filters help in reducing the data fetched during a scan.
Common HBase Filters: RowFilter, PrefixFilter, SingleColumnValueFilter, PageFilter, ColumnPrefixFilter.
Pagination with PageFilter to process data in chunks. Column Range Filters to select only a range of columns. Combining Filters using FilterList (AND/OR logic).
Use row key-based lookups wherever possible (very fast). Avoid full table scans on large tables. Always use filters when scanning large datasets. Design row keys smartly to support access patterns and avoid hotspots (e.g., reverse timestamps, region-based prefixes).
Use Case: IoT Sensor Data, Data Access Pattern: Scan data by time range.
Use Case: Student Database, Data Access Pattern: Get student details by ID.
Use Case: Order Tracking System, Data Access Pattern: PrefixFilter by order ID prefix.
Use Case: Social Media Posts, Data Access Pattern: Range scan by timestamp.
Technique: Get, When to Use: When row key is known, Example: get 'students', '1001'.
Technique: Scan, When to Use: When multiple rows are needed, Example: scan 'students'.
Technique: Filter, When to Use: When conditional selection is needed, Example: SingleColumnValueFilter etc.
Understand how to perform efficient data retrieval in Redis using key-based access, pattern matching, and built-in data structures like hashes, lists, and sets.
Redis (Remote Dictionary Server) is an in-memory, key-value NoSQL database known for high performance, low latency, and support for complex data structures.
All data in Redis is stored and accessed using unique keys.
Redis allows searching keys using wildcard patterns with the KEYS command.
What command is recommended for production use instead of KEYS?
KEYS
SCAN
What is the command to set a string value in Redis?
SET
GET
DEL
What command is used to retrieve all key-value pairs of a hash?
HGET
HGETALL
HSET
What command is used to add multiple keys in Redis?
SET
HSET
SADD
What is the command to check if a key exists in Redis?
EXISTS
DEL
GET
What command is used to add a product to a user's cart in Redis?
HSET
SET
LPUSH
What is the command to delete a key in Redis?
DEL
EXISTS
GET
What command is used to retrieve a specific field from a hash?
HGET
HSET
HGETALL
What command is used to add an item to a list in Redis?
LPUSH
RPUSH
LRANGE
What command is used to check the time to live of a key?
TTL
EXPIRE
GET
What is the command to add a score to a sorted set in Redis?
ZADD
ZRANGE
SADD
What command is used to retrieve all members of a set?
SMEMBERS
SADD
SISMEMBER
What command is used to retrieve a range of elements from a sorted set?
ZRANGE
ZADD
ZREVRANGE
What command is used to expire a key after a certain time?
EXPIRE
TTL
DEL
What is the command to check if an item exists in a set?
SISMEMBER
SMEMBERS
SADD
What command is used to retrieve all tasks in order from a list?
LRANGE
LPUSH
RPUSH
What command is used to add a score to a leaderboard in Redis?
ZADD
ZRANGE
SADD
What command is used to retrieve all tasks in a task queue?
LRANGE
LPUSH
RPUSH
What command is used to retrieve a specific field from a hash?
HGET
HSET
HGETALL
What command is used to add a product to a user's cart in Redis?
HSET
SET
LPUSH
What command is used to delete a key in Redis?
DEL
EXISTS
GET
What command is used to check if a key exists in Redis?
EXISTS
DEL
GET
What are the basic units for schema definition in HBase?
Column Families
Rows
Columns
Tables
What happens when you add a new column to a row in HBase?
It affects all existing data
Only affected rows are updated
It requires schema modification
It deletes old data
What is a key consideration for backward compatibility in HBase?
Adding new columns
Deleting column families
Renaming columns
Changing column family properties
What should you avoid doing with column families in HBase?
Adding new columns
Deleting column families
Modifying column properties
Renaming columns
What is the recommended practice for managing schema evolution?
Minimize column family changes
Delete old data immediately
Rename columns frequently
Avoid using version control
What is the first step in simulating HBase concepts using Pandas?
Create sample data with Column Families
Export data to CSV
Import data from CSV
Add new Column Family
What is the purpose of the HBase compaction process?
To delete old data
To clean up deleted or obsolete data
To add new columns
To modify column families
What does HBase use to store data versions?
Timestamps
Row keys
Column families
Schema definitions
What is the effect of changing column family properties in HBase?
It affects old data immediately
It only affects new data
It requires schema migration
It deletes old data
What is the recommended action before applying schema changes to production?
Test schema changes on a staging system
Apply changes directly
Delete old data
Modify column families
