reading-notes

MongoDB and Mongoose

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

Q1 What kind of data is a good fit for an SQL database?

An SQL database is a good fit for complex queries, structured data, and compliance to ACID properties (Atomicity, Consistency, Isolation, Durability)

Q2 Give a real world example.

A banking app, where data consistency is prioritized

Q3 What kind of data is a good fit a NoSQL database?

A NoSQL database is a good fit for unstructured data with a variety of data types and high-throughput data amounts.

Q4 Give a real world example.

Social media app, where a variety of data types and structures are used.

Q5 Which type of database is best for hierarchical data storage?

NoSQL

Q6 Which type of database is best for scalability?

NoSQL

Source: YouTube - Academind

Q1 What does SQL stand for?

Structured Query Language

Q2 What is a relational database?

A database which:

Q3 What type of structure does a relational database work with?

Tables

Q4 What is a ‘schema’?

A way to define the structure and relationships betwen the data (the tables, columns, data types, relationships between tables, etc.)

Q5 What is a NoSQL database?

A NoSQL database, MongoDB for example, that don’t follow strict schema

Q6 How does it work?

NoSQL databases work by having flexible schema and different data models such as document databases (like JSON), key-value, column-family, or graph.

Q7 What is inside of a MongoDB database?

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

Q8 Which is more flexible - SQL or MongoDB? and why.

MongoDB, because the data doesn’t have to conform to the strict schema of SQL

Q9 What is the disadvantage of a NoSQL database?

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.

Things I want to know more about

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?