NoSQL vs SQL syntax

Hello everyone, so I would like to show what is the difference between  NoSQL (MongoDB) syntax and SQL (Microsoft SQL) one. I was curious how the comparison between the two will look like and that’s why I decided to write this post. I will show how 1 query looks in SQL and NoSQL. Currently I’m not a master of NoSQL but I find it quite easy for me as developer to use it. I’m sure that NoSQL syntax is easy to use for people who code JavaScript and process JSON data.

This tutorial includes the following sections:

  1. Create database
  2. Add table
  3. Insert row
  4. Select data
  5. Update row
  6. Delete row
  7. Filter data

Let’s start…

Create database

SQL

 

NoSQL

 

Add table

SQL

 

NoSQL

One-to-many relationship with document references.

Insert row

SQL

 

NoSQL

 

Select data

SQL

SELECT DepartmentNoSQL

 


Update row

SQL

NoSQL

Delete row

SQL

NoSQL

Delete document in collection

Filter data

SQL

NoSQL

As you notice when you type queries in NoSQL you don’t need to type too much. You can find the full MongoDB documentation here. I hope you find useful this syntax comparison.

I recommend you to take a look at SQL to MongoDB Mapping documentation. There you will find similar examples which I showed above.

543 views