Source: The Geek Stuff - SQL vs NoSQL
Fill in the chart below with five differences between SQL and NoSQL databases:
SQL | NoSQL |
---|---|
AKA Relational Databases (RDBMS) | AKA Non-relational or Distributed Databases |
Table-based, have standard predefined schema | Documents, key:value pairs, graphs, or wide-column stores, have dynamic schema |
Vertically scalable | Horizontally scalable |
Use SQL (Structured Query Language) | Use UnQL (Unstructured Query Language), syntax varies |
Examples: MySql, Oracle, Sqlite, Postgres and MS-SQL | Examples: MongoDB, BigTable, Redis, RavenDb, Cassandra, Hbase, Neo4j and CouchDb |
An SQL database is a good fit for complex queries, structured data, and compliance to ACID properties (Atomicity, Consistency, Isolation, Durability)
A banking app, where data consistency is prioritized
A NoSQL database is a good fit for unstructured data with a variety of data types and high-throughput data amounts.
Social media app, where a variety of data types and structures are used.
NoSQL
NoSQL
Structured Query Language
A database which:
-
Supports the structured query language (SQL)
-
Works with tables
-
Tables have fields (columns), and every new entry is a new record (rows), and no row can have more or fewer columns
-
Multiple related tables
Tables
A way to define the structure and relationships betwen the data (the tables, columns, data types, relationships between tables, etc.)
A NoSQL database, MongoDB for example, that don't follow strict schema
NoSQL databases work by having flexible schema and different data models such as document databases (like JSON), key-value, column-family, or graph.
Inside a MongoDB are collections, documents, and indexes. A collection is like a table but more flexible. Documents are individual entries like a row in a table. Indexes are how the data is retreived
MongoDB, because the data doesn't have to conform to the strict schema of SQL
You will have duplicates of some data, which will slow down the queries. It will also mean you will have to update data in multiple places.
What are examples where a company might use both SQL and NoSQL databases? What would be used for each, and would the two be able to communicate with each other?