Question

I've recently worked with MongoDB and learned about its schemaless design. However, I'm confused with the term NoSQL? Why is it called that? Doesn't it use SQL or SQL-like queries?

I've also read from an article that the main difference lies in how data is stored. Is this true? In the case of MongoDB, it's stored like JSON documents.

Also, I'm confused why I always see 'NoSQL vs relational databases'. Aren't NoSQL databases relational? I believe documents in MongoDB are still related/linked through some keys (please correct me if I'm wrong). So why is it labeled as non-relational?

Thanks in advance!

Was it helpful?

Solution

Doesn't it use SQL or SQL-like queries?

While "non-relational databases" might be a more accurate name, most of them do in fact not use SQL or something similar.

Aren't NoSQL databases relational? I believe documents in MongoDB are still related/linked through some keys (please correct me if I'm wrong). So why is it labeled as non-relational?

NoSQL databases are non-relational databases.

They come in a variety of flavours (mainly "document databases", "key-value stores", and "graph databases"), but you usually don't get any or all of the following "relational" features:

  • Defining tables with a schema (named and usually typed columns)

  • Ability to join multiple tables in a single query

  • Long-running, isolated transactions of arbitrary scope

  • Ad-hoc queries that can take a long time, and many ways to index the data to speed them up (as opposed to having to change the whole database layout)

(What you get by giving up some of these handy features is improved performance, availability and scalability).

OTHER TIPS

The name "NoSQL" was in fact first used by Carlo Strozzi in 1998 as the name of file-based database he was developing. Ironically it was relational database. Wiki

Here is what famous peoples say about 'nosql':

Eric Evans (rackspace):

"I've spent the last couple of days at nosqleast and one of the hot topics here is the name "nosql". Understandably, there are a lot of people who worry that the name is Bad, that it sends an inappropriate or inaccurate message. While I make no claims to the idea, I do have to accept some blame for what it is now being called. How's that? Johan Oskarsson was organizing the first meetup and asked the question "What's a good name?" on IRC; it was one of 3 or 4 suggestions that I spouted off in the span of like 45 seconds, without thinking.

My regret however isn't about what the name says, it's about what it doesn't. When Johan originally had the idea for the first meetup, he seemed to be thinking Big Data and linearly scalable distributed systems, but the name is so vague that it opened the door to talk submissions for literally anything that stored data, and wasn't an RDBMS."

Martin Fowler:

"Indeed there's often a twist in the name itself: many advocates of NoSQL say that it does not mean a "no" to SQL, rather it means Not Only SQL. On this point I think it's useful to separate an individual database from the kind of ecosystem that NoSQL advocates see as the future. When we say "x is a NoSQL database" I think it's silly to interpret NoSQL as "Not Only" because that would render the term meaningless. (You could then reasonably argue that SQL Server (say) is a NoSQL database.) So I think it's best to say a "NoSQL database" is a "no-sql" database."

As wikipedia says:

[NoSQL] is a broad class of database management systems identified by non-adherence to the widely used relational database management system model.

That means that it is a database that does not adhere a relational model (the one by Codd) and by consequence it does not use SQL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top