reading-notes

MongoDB and Mongoose

SQL vs NoSQL

Fill in the chart below with five differences between SQL and NoSQL databases:

SQL NoSQL
Relational Databases Non-Relational Databases
Table-Based Databases Document-Based Databases
Relational Databases Non-Relational Databases
Pre-defined Schema Dynamic Schema for Unstructured Data
Vertically Scalable Horizontally Scalable
Good For Complex Queries Not Good For Complex Queries
  1. What kind of data is a good fit for an SQL database?
    • Numeric data types.
  2. Give a real world example.
    • Dates, inventory, etc.
  3. What kind of data is a good fit a NoSQL database?
    • Hierarchical data storage as it follows the key-value pair way of storing data similar to JSON data.
  4. Give a real world example.
    • Color: red;
  5. Which type of database is best for hierarchical data storage?
    • NoSQL
  6. Which type of database is best for scalability?
    • SQL - vertically scalable
    • NoSQL - horizontally scalable

More SQL vs NoSQL

  1. What does SQL stand for?
    • Structured Query Language
  2. What is a relational database?
    • We have a database which works with certain assumptions and supports the Structured Query Language.
  3. What type of structure does a relational database work with?
    • Tables
  4. What is a ‘schema’?
    • The “blueprint” of a database which describes how the data may relate to other tables or other data models.
  5. What is a NoSQL database?
    • MongoDB
  6. How does it work?
    • Has collections rather than relations that may have different structures and schemas.
  7. What is inside of a MongoDB database?
    • Collections and documents
  8. Which is more flexible - SQL or MongoDB? and why.
    • MongoDB, because SQL is much more rigid with strict schemas, while MongoDB is very flexible.
  9. What is the disadvantage of a NoSQL database?
    • Relational data must be entered manually and may have duplicate data.