SQL vs NoSQL: differences and when to choose

A classic database trade-off question comparing relational (SQL) and non-relational (NoSQL) stores — often asked inside a system-design problem, where you must justify a choice from concrete requirements.

Key dimensions to cover:

  • Schema: SQL enforces a fixed schema; NoSQL is schema-flexible (document, key-value, column-family, graph)
  • ACID vs BASE: SQL favors strong ACID transactions; NoSQL often trades consistency for availability/partition tolerance (CAP theorem)
  • Scaling: SQL scales vertically (sharding is harder); NoSQL (Cassandra, DynamoDB) is built for horizontal scale-out
  • Query model: SQL has rich relational queries with joins and ad-hoc access; NoSQL is optimized for known access patterns

When to choose: structured, relational data with complex queries and strong consistency (e.g. financial transactions) → SQL; high-throughput, flexible-schema, or time-series/catalog/profile data → NoSQL. Expect follow-ups on mixed workloads (e.g. ride metadata vs. driver-location data) and how eventual consistency affects the product experience.

asked …
LeaderboardSalaryAccount