|
recaplica
SQL vs NoSQL: How Relational and Non-Relational Databases Differ | |||||||||||||||
| © 2026 Recaplica · recaplica.com — All rights reserved | |||||||||||||||
SQL vs NoSQL: How Relational and Non-Relational Databases DifferWhat to print Page numbers appear when printing with default margins. SlidesChoose a cut Flash10 slidesThe essential thread, to present in classFull14 slidesEvery chapter and the deeper detailBoth come with speaker notes. In 30 seconds quick readA relational database stores data in tables with a fixed schema, set before a single row is ever written. A non-relational database, or NoSQL, uses flexible schemas built around one specific data model instead: documents as in MongoDB, key-value pairs as in Redis, partitioned wide columns as in Apache Cassandra, or nodes linked by relationships as in Neo4j. NoSQL databases emerged in the late 2000s, as storage got cheaper and systems increasingly needed to run across many machines at once. Choosing between the two isn't about which one is generally faster or more scalable — it depends on the shape of the data and the job at hand, since both can grow, just in different directions, and the CAP theorem explains the trade-off every distributed system faces the moment its network connections break. Key Points
Key figures
Deep DiveTwo ways to organize dataA relational database starts from a schema decided ahead of time: tables with fixed columns, the same for every row, linked by primary and foreign keys. A non-relational database, or NoSQL, starts from the problem instead: it picks one specific data model — documents, key-value pairs, partitioned columns, or graphs — and shapes its schema around that model. According to AWS, NoSQL databases are often called “purpose-built” databases, designed for a specific job, with flexible schemas that adapt more easily than relational tables to modern applications. This isn’t a contest between an outdated model and a new one — neither replaces the other across the board. It’s a choice that depends on the shape of the data, how much scale is needed, and how much structure makes sense from day one. The four main NoSQL modelsAWS describes three of these models, each with a real product behind it. The document database stores data as JSON-like documents, flexible and semi-structured; MongoDB is a well-known example of this model. The key-value database maps every value to a key and is, according to AWS, highly partitionable, capable of horizontal scaling at a level other NoSQL types struggle to match: Amazon DynamoDB, for instance, aims for consistent performance with single-digit-millisecond latency at any scale of traffic. The graph database, such as Neo4j, is built for applications working with densely connected data. A fourth widely used model is wide-column, which partitions its tables around a partition key: Apache Cassandra is a well-known example.
A flexible schema, not the absence of oneIn the document model, each document holds pairs of field and value, and the values can be strings, numbers, booleans, arrays, or even other nested documents. Different documents in the same collection can carry different fields: that flexibility is exactly what makes the schema easier to change when it needs to. In the relational model, by contrast, the schema is fixed: every row in a table must hold the same predefined set of column types, and changing that schema after data has already been stored is far more involved. Redis, a key-value database, is a good reminder that “key-value” doesn’t just mean plain strings: alongside strings, it implements hashes, which behave like dictionaries of field-value pairs, unordered sets of unique strings, and lists ordered by insertion. A set in Redis lets you add, remove, and check for an element’s existence in constant time, no matter how many elements it holds. Scaling, vertical and horizontalVertical scaling grows by adding resources to a single machine — more memory, more processing power. Horizontal scaling grows by adding more machines, often grouped into distributed clusters spread across several servers that can sit in different locations and talk to each other over the internet. According to MongoDB, relational databases are designed mainly for vertical scaling, with limited room to extend horizontally; NoSQL databases, on the other hand, are built to scale both vertically and horizontally, often through sharding, replication, and clustering.
Apache Cassandra, a wide-column database, is a concrete example of that philosophy: its design goals include scaling out on commodity hardware, with throughput that grows linearly as processors are added, and online load balancing as the cluster grows. The CAP theorem: a trade-off, not a fixed labelThe CAP theorem describes the trade-offs a distributed database faces between consistency, availability, and partition tolerance whenever data is replicated across multiple nodes. Because partition tolerance is a requirement in any distributed environment, the real choice, according to MongoDB, comes down to keeping consistency or keeping availability the moment communication between nodes breaks down. It isn’t a permanent label stamped on a system, but a trade-off that kicks in when needed. MongoDB, for example, offers tunable settings, such as writeConcern and readPreference, that let teams balance accuracy, speed, and resilience — it can behave as a system leaning toward consistency or one leaning toward availability, depending on how it’s configured. Apache Cassandra, for its part, implements what its own documentation calls “eventually consistent” semantics: the nodes of the cluster converge on the same data over time, not necessarily right after every write. When one model fits better than the otherAccording to MongoDB, teams choosing between a relational and a NoSQL database typically weigh factors like fast-paced agile development, the need to store structured data alongside semi-structured data, large data volumes, scale-out architecture requirements, or modern application patterns such as microservices and real-time streaming. A product catalog with clear relationships between customers, orders, and invoices remains a natural fit for a relational database. A recommendation system built on networks of connections, or a service that needs to absorb unpredictable traffic spikes with a lightning-fast lookup algorithm, tends to shift more easily toward a NoSQL model — document, graph, or key-value, depending on the problem. The choice comes down to the problem at hand: the shape of the data, how much that shape is likely to change over time, and how the system that holds it needs to grow. Slide deckSlides ready to download and make your own in PowerPoint or Google Slides, with speaker notes. Pick the Flash cut or the Full one. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Common myths
Mind mapDrag the background to move around and the nodes to reposition them; use − and + to collapse and expand branches.
Quiz: test yourselfAnswer the questions to check what you have learned: you get instant feedback and a short explanation. Grade 0/10 0/5
FlashcardsTap the card to flip it and check whether you remember the answer, then move to the next one. 1 / 8 Explain it in your own wordsThe ultimate test: if you can explain it in simple words, you've truly understood it. Write your explanation, then compare it with the Recap. Your explanation is saved only on this device.
Frequently asked questionsWhat is the difference between SQL and NoSQL databases?A relational (SQL) database stores data in tables with one fixed schema shared by every row; a non-relational (NoSQL) database uses a flexible schema built for a specific data model, such as documents, key-value pairs, partitioned columns, or graphs. What are some examples of non-relational databases?MongoDB for the document model, Redis for the key-value model, Apache Cassandra for the wide-column model, and Neo4j for the graph model are among the most cited NoSQL examples, each suited to a different use case. What are the types of NoSQL databases?AWS groups NoSQL databases into four main types: document databases, such as MongoDB, for JSON-like data; key-value databases, such as Redis, for fast lookups by key; graph databases, such as Neo4j, for highly connected data; and wide-column databases, such as Apache Cassandra, for tables partitioned at scale. Are non-relational databases always faster than relational ones?No. Relational databases can still extend some horizontal scaling capability of their own, and for distributed NoSQL systems, the availability advantage described by the CAP theorem only kicks in once communication between nodes breaks down — it isn't a constant rule. RDBMS vs NoSQL: how do they compare on schema and scaling?An RDBMS (relational database management system) stores data in tables with a fixed schema and scales mainly vertically, by upgrading one machine. A NoSQL database uses a schema built for its data model and, according to MongoDB, is designed to scale both vertically and horizontally, often through sharding, replication, and clustering. Every Recap goes through an independent review before publication. |












