Great deal
Wednesday, August 13, 2025
Thursday, April 3, 2025
NoSQL
NoSQL
│
├── 1. Introduction
│ ├── Definition: NoSQL (Not Only SQL) is a non-relational database designed for scalability and flexibility.
│ ├── Why NoSQL?
│ │ ├── Handles large-scale data
│ │ ├── Flexible schema (no fixed tables)
│ │ ├── Scales horizontally (distributed architecture)
│ │ ├── High performance and availability
│ ├── Example:
│ │ - SQL: Relational Table → Rows & Columns
│ │ - NoSQL: JSON Document, Key-Value, Column-Family, Graph
│ ├── **Questions:**
│ │ - Q1: What are the key differences between SQL and NoSQL?
│ │ - Q2: Why is NoSQL preferred for big data applications?
│
├── 2. Types of NoSQL Databases
│ │
│ ├── 2.1 Document-Based
│ │ ├── Definition: Stores data as **JSON/BSON/XML** documents.
│ │ ├── Best for: Semi-structured data, catalogs, CMS.
│ │ ├── Example DBs: MongoDB, CouchDB
│ │ ├── Example:
│ │ │ {
│ │ │ "_id": 1,
│ │ │ "name": "John Doe",
│ │ │ "age": 30,
│ │ │ "skills": ["Java", "Python"]
│ │ │ }
│ │ ├── **Questions:**
│ │ │ - Q3: Write a MongoDB query to insert a document.
│ │ │ - Q4: Write a MongoDB query to fetch users older than 25.
│ │ │ - Q5: How do you update a document in MongoDB?
│
│ ├── 2.2 Key-Value
│ │ ├── Definition: Uses key-value pairs to store data.
│ │ ├── Best for: Caching, session storage, shopping carts.
│ │ ├── Example DBs: Redis, DynamoDB
│ │ ├── Example:
│ │ │ SET user:1001 "John Doe"
│ │ │ GET user:1001
│ │ ├── **Questions:**
│ │ │ - Q6: How do you set an expiry time for a key in Redis?
│ │ │ - Q7: What are the advantages of using a Key-Value store?
│
│ ├── 2.3 Column-Family
│ │ ├── Definition: Stores data in a **column-oriented** format.
│ │ ├── Best for: Large-scale analytics, time-series data.
│ │ ├── Example DBs: Apache Cassandra, HBase
│ │ ├── Example (CQL - Cassandra Query Language):
│ │ │ CREATE TABLE users (id UUID PRIMARY KEY, name TEXT, age INT);
│ │ ├── **Questions:**
│ │ │ - Q8: Write a query to insert data into a Cassandra table.
│ │ │ - Q9: How does a column-family database differ from a relational database?
│
│ ├── 2.4 Graph-Based
│ │ ├── Definition: Uses nodes and edges to represent relationships.
│ │ ├── Best for: Social networks, fraud detection, recommendations.
│ │ ├── Example DBs: Neo4j, ArangoDB
│ │ ├── Example:
│ │ │ CREATE (p:Person {name: 'Alice'})
│ │ │ CREATE (q:Person {name: 'Bob'})
│ │ │ CREATE (p)-[:FRIENDS_WITH]->(q)
│ │ ├── **Questions:**
│ │ │ - Q10: Write a Neo4j query to find all friends of Alice.
│ │ │ - Q11: Explain the advantages of a graph database.
│
├── 3. NoSQL vs SQL
│ ├── Schema: NoSQL (Flexible) vs SQL (Fixed)
│ ├── Scaling: NoSQL (Horizontal) vs SQL (Vertical)
│ ├── Data Model: NoSQL (Key-Value, Document, etc.) vs SQL (Tables)
│ ├── ACID vs BASE: SQL (ACID Transactions) vs NoSQL (BASE - Eventually Consistent)
│ ├── Query Language: SQL uses structured queries; NoSQL varies by type.
│ ├── **Questions:**
│ │ - Q12: Compare ACID properties with BASE properties.
│ │ - Q13: When should NoSQL be chosen over SQL?
│
├── 4. Advantages of NoSQL
│ ├── High Scalability (sharding & replication)
│ ├── Schema Flexibility (adapt to changing data structures)
│ ├── High Availability (distributed architecture)
│ ├── Faster Read/Writes (especially for large-scale applications)
│ ├── **Questions:**
│ │ - Q14: Explain how sharding improves scalability.
│ │ - Q15: Why is NoSQL better suited for high-velocity data?
│
├── 5. Disadvantages of NoSQL
│ ├── Less Mature (compared to SQL)
│ ├── Consistency Issues (eventual consistency in many cases)
│ ├── Query Complexity (different query languages per database type)
│ ├── **Questions:**
│ │ - Q16: What are the challenges of eventual consistency?
│ │ - Q17: Discuss the limitations of NoSQL databases.
│
├── 6. Use Cases of NoSQL
│ ├── Big Data & Analytics
│ ├── Real-Time Applications (chat apps, recommendation engines)
│ ├── IoT & Sensor Data (handling high-velocity data streams)
│ ├── **Questions:**
│ │ - Q18: Why is NoSQL suitable for IoT applications?
│ │ - Q19: How does NoSQL handle real-time data processing?
│
└── 7. Performance & Scalability
├── Horizontal Scaling: Adding more servers instead of upgrading a single machine.
├── Sharding: Splitting data across multiple nodes to improve performance.
├── Replication: Creating multiple copies of data for redundancy.
├── **Questions:**
│ - Q20: Explain the difference between sharding and replication.
│ - Q21: How does horizontal scaling improve database performance?
│
└── 8. Hands-on Questions (Practical)
├── MongoDB:
│ - Q22: Write a query to find users who know Python in MongoDB.
│ - Q23: How do you delete a document where age < 18?
│
├── Redis:
│ - Q24: Store and retrieve user details in Redis.
│ - Q25: How do you list all keys in Redis?
│
├── Cassandra:
│ - Q26: Create a table for storing product details in Cassandra.
│ - Q27: Write a query to fetch products with price > 500.
│
├── Neo4j:
│ - Q28: Create a "WORKS_AT" relationship between users and companies.
│ - Q29: Retrieve all employees working at "Google."
│
├── General:
│ - Q30: Design a NoSQL schema for a social media app.