- What is the difference between SQL and NoSQL?
- What is referencing and what is embedding in MongoDB?
- Why should we embed more than referencing when we can in MongoDB?
- When should we prefer referencing over nesting in MongoDB?
- What are ORMs? Why we use them? Give an example of an SQL request with and without using ORM.
- What is the difference between a table and a collection?
Some helpful resources:
Huzeyfe Abdullahoglu, Emine Cig, Sara Hamoud, Adnan Khaldar
1.What is the difference between SQL and NoSQL?
SQL databases are table-based, while NoSQL databases are document, key-value, graph, or wide-column stores. Some examples of SQL databases include MySQL, Oracle, PostgreSQL, and Microsoft SQL Server. NoSQL database examples include MongoDB, BigTable, Redis, RavenDB Cassandra, HBase, Neo4j, and CouchDB.
SQL databases are relational, NoSQL databases are non-relational.
SQL databases use structured query language and have a predefined schema. NoSQL databases have dynamic schemas for unstructured data.
SQL databases are vertically scalable, while NoSQL databases are horizontally scalable.
SQL databases are table-based, while NoSQL databases are document, key-value, graph, or wide-column stores.
SQL databases are better for multi-row transactions, while NoSQL is better for unstructured data like documents or JSON
Embedding can be explained by the idea that one embeds data inside each other.
Referencing can be explained by one arranging 2 or more data sets separately, but connect them with key data that is called a “reference.” Thus, they could be separate yet connected.
3.Why should we embed more than referencing when we can in MongoDB?
it’s faster than referencing, we can read and update data in a single operation
4.When should we prefer referencing over nesting in MongoDB?
We can think of an example: having a biiig box that has everything about our computer. Finding a battery for our mouse inside that big box would be like hell! But when we have smaller boxes, all labeled “computer components,” and some other info, we could easily find everything we need, in seconds.
5.What are ORMs? Why we use them? Give an example of an SQL request with and without
using ORM.
ORMs -Object Relational Mappings- are simply libraries that make it easier to communicate with the databases.
6.What is the difference between a table and a collection?
Instead of tables, a MongoDB database stores its data in collections. A collection holds one or more BSON documents. Documents are analogous to records or rows in a relational database table. Each document has one or more fields; fields are similar to the columns in a relational database table