What’s the difference between SQL and NoSQL?

SQL databases are primarily referred to as Relational Databases (RDBMS).

NoSQL databases are primarily referred to as Non-relational or Distributed Database.

svg viewer

SQL

  • SQL databases are table based databases.

  • Have predefined schema.

  • Are vertically scalable.

  • Use SQL (Structured Query Language) for defining and manipulating the data.

  • A good fit for the complex query intensive environment

  • Emphasize ACID properties (Atomicity, Consistency, Isolation and Durability)

  • Examples include: MySql, Oracle, Sqlite, Postgres and MS-SQL.

NoSQL

  • NoSQL databases are document based, key-value pairs, graph databases.

  • Have dynamic schema.

  • Are horizontally scalable.

  • Focused on the collection of documents.

  • Not ideal for complex queries.

  • Follow the Brewers CAP theorem (Consistency, Availability and Partition tolerance )

  • Examples include: MongoDB, BigTable, Redis, RavenDb, Cassandra, Hbase, Neo4j and CouchDb.

Diving deeper

  • Relational database: is a collective set of multiple data sets organized by tables, records and columns.
  • Document database: pairs each key with a complex data structure known as a document. Documents can contain many different key-value pairs and nested documents.
svg viewer
  • Key-value database: are the simplest NoSQL databases. Every single item in the database is stored as an attribute name (or ‘key’), together with its value.
svg viewer
Copyright ©2024 Educative, Inc. All rights reserved