Concept

What a Database Does & SQL vs NoSQL

The Six Core Jobs of a Database

  1. Durable storage — Data persists across restarts and crashes.
  2. Efficient retrieval — Indexes and query optimizers make lookups fast.
  3. Concurrent access — Multiple clients read and write without conflict.
  4. Transactional integrity — Related changes succeed or fail together.
  5. Security and access control — Read/write permissions enforced at the data layer.
  6. Scalability — Replication, indexing, and sharding allow growth beyond one server.

SQL vs NoSQL Philosophies

SQL (Relational)NoSQL (Non-Relational)
SchemaRigid, predefined (schema-on-write)Flexible or none (schema-on-read)
ConsistencyACID transactionsBASE / eventual consistency
ScalingVertical (scale-up)Horizontal (scale-out)
ExamplesPostgreSQL, MySQL, SQL ServerRedis, DynamoDB, Cassandra, MongoDB

ACID (SQL guarantee): Atomicity (all-or-nothing), Consistency (valid state always), Isolation (concurrent transactions don't interfere), Durability (committed data survives crashes). Non-negotiable for financial systems.

BASE (NoSQL trade-off): Basically Available, Soft state, Eventual consistency — data propagates to all nodes eventually, but a window exists where different nodes hold different versions.