Section 23 – Lesson 332 – Complete 2020 Web Development Bootcamp

Lesson 332 – Databases Explained: SQL vs. NOSQL

The main difference between databases is whether they are SQL or NOSQL.

SQL stands for Structured Query Language.

NOSQL stands for Not Only Structured Query Language.

The two most popular SQL databases to use with Node.js are MySQL and PostgreSQL.

The two most popular NOSQL databases to use with Node.js are mongoDB and redis.

The differences between SQL and NOSQL databases are –

  • Structure – A SQL database will group your data into tables whereas a NOSQL database will represent your data as JSON objects. SQL databases run on a table structure. NOSQL databases run on a document structure.
  • Relationships – SQL databases are relational databases and are good at establishing relationships between your data – NOSQL databases are non-relational databases and are not as good at establishing relationships between your data. If you need to store thing like customer details, order details, product details, inventory, things that have lots of relationships between each other, you might be better using a SQL database. If you have a website where you have something that’s more of a one to many relationship like Instagram where you have a user with many different posts, then that data is much easier to map out using a NOSQL database like mongoDB.
  • Scalability – Because of the way that NOSQL databases organize their data into smaller chunks of data, it allows for a distributed system so that you database can be distributed between many different computers which reduces the load on any one computer.