Okay, let's dive into 2.2 Data Management. This is a broad but crucial topic covering how systems store, retrieve, and manage data effectively, especially at scale.
We'll break this down into:
- 2.2.a Databases
- Relational Databases (SQL)
- NoSQL Databases
- SQL vs. NoSQL
- Database Scaling (Replication, Sharding)
- 2.2.b Caching (Deep Dive)
- 2.2.c Data Consistency
Let's start with 2.2.a Databases, beginning with Relational Databases.
Advertisement
Relational Databases (SQL)
- Definition: Databases that store data in a structured format using tables (relations) consisting of rows (records or tuples) and columns (attributes). Relationships between tables are defined using primary keys and foreign keys.
- Query Language: Uses SQL (Structured Query Language) for defining, manipulating, and querying data. SQL is a standardized language, although specific implementations might have minor variations.
- Key Characteristics:
- Structured Data: Best suited for data with a predefined schema (structure). The schema defines the tables, columns, data types, and constraints.
- ACID Compliance: Traditionally emphasize ACID properties for transactions:
- Atomicity: Transactions are all-or-nothing.
- Consistency: Transactions bring the database from one valid state to another.
- Isolation: Concurrent transactions don't interfere with each other.
- Durability: Committed transactions persist even through failures.
- Normalization: Data is often organized to reduce redundancy and improve data integrity through a process called normalization. This involves splitting data into multiple related tables.
- Common Use Cases:
- Transactional systems (e.g., financial systems, order processing).
- Applications requiring strong consistency guarantees.
- Situations where data relationships are complex and well-defined.
- Business intelligence and reporting (often using data warehouses built on relational principles).
- Examples:
- MySQL
- PostgreSQL
- Oracle Database
- Microsoft SQL Server
- SQLite (often used for mobile or embedded applications)
Advertisement
- In an Interview: Understand the core concepts of tables, rows, columns, keys, and ACID. Know when a relational database is a suitable choice (structured data, consistency requirements).
Advertisement