Why can I not use regular SQL queries like select *from student
(assuming there is a table called student) in MongoDB
, although they say it is Not only SQL (NoSql)?

- 1,277
- 2
- 13
- 28

- 106
- 1
- 9
-
Possible duplicate of [Why is it called NoSQL?](https://stackoverflow.com/questions/12907794/why-is-it-called-nosql) – felix Jun 27 '19 at 10:19
2 Answers
SQL is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS)
Wouldn't it be quite confusing to use such a specific language to query data from a DBMS (MongoDB) that is structurally different from RDBMS, where there is no concept of table, rows and columns, where joins don't exist, where you can nest documents into other documents following no defined schema, and so on?
The point is that the difference between SQL and Mongo query language is not just the syntax, it is also the semantics. A Mongo query does not say the same thing of a SQL query just in a different language, it says a different thing at all.
Sure you can find a direct Mongo translation for basic SQL query, like a simple SELECT item, status from inventory WHERE status = "A"
but how would you translate a JOIN
to Mongo, or how would you query a nested document using SQL?

- 793
- 7
- 25
I'm not sure I fully understand the question.... But I'll give it a go.
NoSQL is a non-relational database and stands for "Not only SQL"... As for not being able to use it that is because MongoDB has their own terminology and such.
In MongoDB terms a collection is the same as a table. A collection is a grouping of MongoDB documents (A document is a record in MongoDB collection that is the basic unit of data in MongoDB)
In order to translate your statement
select *from student
to MongoDB we would use
db.student.find()
Notice the different syntax in statements. They each have their use case it is just all finding which one fits yours. There are numerous differences between the two beyond syntax such as schema, architecture and how they work.
For more information on this see the following link: MongoDB terminology versus SQL

- 920
- 1
- 10
- 17
-
Yes Joe I understand what mongo db is but I'm confused as to why it's called not only SQL when you have no SQL at all when querying – Harshith Yadav Jun 26 '19 at 15:08
-
You want to know why NoSQL is called NoSQL ? See this post https://stackoverflow.com/questions/12907794/why-is-it-called-nosql – smitty_werbenjagermanjensen Jun 26 '19 at 15:19
-
I read the answers in the link they were all alright answers,I guess....but I have a my own theory why it called so after reading it. Assuming the traditional RDBMS uses only SQL and the person who invented it wanted it to say the opposite of only SQL he just added a 'Not' in front of ' only SQL ' and he then called it Not only SQL :0 – Harshith Yadav Jun 27 '19 at 03:44
-
Hahahaha that could be it the world will never know for certain :o – smitty_werbenjagermanjensen Jun 27 '19 at 12:21