ZZomato·BehavioralSenior SWESystem Design

SQL vs NoSQL Databases - Trade-offs

viaGlassdoor

Q: What is the difference between SQL and NoSQL databases?

A: Key differences to cover:

  • Schema: SQL (relational) enforces a fixed schema with tables, rows, and typed columns; NoSQL databases (document, key-value, column-family, graph) are typically schema-less or schema-flexible.
  • Scaling: SQL databases traditionally scale vertically and require careful sharding for horizontal scale; many NoSQL stores are built for horizontal scaling out of the box.
  • Consistency: SQL databases favor strong (ACID) consistency and transactions; NoSQL often trades strict consistency for availability and partition tolerance (per CAP theorem), offering eventual consistency.
  • Query flexibility: SQL supports rich joins and ad-hoc queries via SQL; NoSQL query capability varies by type (e.g., document stores support flexible queries, key-value stores support only key lookups).
  • Use cases: SQL suits structured, relational data with complex queries and transactional integrity (e.g., financial systems); NoSQL suits high-volume, flexible-schema, high-throughput workloads (e.g., catalogs, session stores, logs).
Add a follow-up question they asked
When would you still pick NoSQL despite needing joins?
asked …
LeaderboardSalary
Language
Account