CHOOSING OR NOT CHOOSING – MYSQL? VS MONGODB?

by Kamya Oberoi


Posted on 12/14/16 10:21 AM



In terms of IT, today, we all are living in the golden age of data management era. So, choosing the best database solution for yourself is a must.

Here I provide my rundown on MySQL vs MongoDB – concepts, terminologies, feature comparison, and conclusion. Let’s get cracking then!

OVERVIEW

Since the release of MySQL in 1995, it has remained most popular and inexpensive option. But with the burst in volume and variety of data in recent years, Databases such as MongoDB have come into view for addressing the requirements of new applications. Now, here comes the comparison between Relational Database (such as Mysql) and Non-relational Database (such as MongoDB).

WHAT IS MYSQL?

Developed, distributed, and supported by Oracle Corporation, MySQL is one of the most popular and open-source RDBMS(relational database management system).

It stores data in the form of tables(containing rows/tuples), uses structured query language for accessing the database, as well as create an association between separate tables through the use of joins. These relational systems have taken the leadership for years while becoming an obvious choice for the IT professionals.

WHAT IS MONGODB OR NOSQL DATABASE?

Developed by MongoDB Inc., MongoDB is an open-source NoSQL Database. It come into existence when the capacity to handle large relational data stores became the challenge, thereby limiting system scalability.

It stores data in JSON-like documents uses dynamic schemas and provides a cheaper way to build complex distributed systems.

COMMON CONCEPTS AND TERMINOLOGIES

The below table outlines the close analogue of Mysql as well as MongoDB:

MySQL

MongoDB

Table

Collection

Row

Document

Column

Field

Joins

Embedded documents

COMPARING FEATURES OF MYSQL & MONGODB

Both databases offer a rich set of features and functionalities.Let’s discuss them below:

MYSQL

MONGODB

Easy for programmers

No

Yes

Are transactions complex?

Yes

No

Contains rich data model

No

Yes

Dynamic schema

No

Yes

Query used

SQL

JSON

And much more on the list…..

QUERY LANGUAGE – MYSQL VS MONGODB

Both of them have a rich query language. Let check out:

MYSQL

MONGODB

INSERT INTO users (user_id, age, status)

VALUES (‘bcd001’, 45, ‘A’)

db.users.insert({

user_id: ‘bcd001’,

age: 45,

status: ‘A’

})

SELECT * FROM users

db.users.find()

UPDATE users SET status = ‘C’

WHERE age > 25

db.users.update(

{ age: { $gt: 25 } },

{ $set: { status: ‘C’ } },

{ multi: true }

)


So, Here I’ve discussed the few points of Mysql and Mongodb. Both are easy, convenient and functionality rich. Yet, MongoDB has achieved a greater edge over the other in terms of Fast & diverse data types, removes ORM(object-relational mapping) layer, it is schemaless and much scalable.

So, choose the one that meets your requirement and keeps coding. See you again with my next blog. Cheerio:)

Leave a Reply

Your email address will not be published. Required fields are marked *