- 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:
Team Members are :
Yaman ,Mohammad ibrahim ,Hamza
1: What is the difference between SQL and NoSQL
-SQL: relational, use structured query language and have a predefined schema, is vertically scalable, is table-based.
-NoSQL: non-relational, NoSQL databases have dynamic schemas for Unstructured data, are horizontally scalable, and are document, key-value, graph, or wide-column stores.
2: What is referencing and what is embedding in MongoDB?
References are one way NoSQL databases handle one-to-many relationships. In relational databases, referencing is more comparable to associations than embedding. Foreign keys are used in references, but the point from one document to another, rather than from one table to another.
Document embedding is another way NoSQL databases manage this type of one-to-many interaction. When one document is embedded within another, the result is a big hash. The author document, for example, would contain numerous post documents, and each posted document would contain many comment documents. Each author document is a hash that contains an array of posts, each of which contains an array of comments.
3: Why should we embed more than referencing when we can in MongoDB?
Both embedding and referring are viable solutions, but each serves a different purpose. Before making a decision, there are a few factors to consider. Data consistency and document size, Embedding documents lead to better performance because we can read and update data in a single database operation,
4:When should we prefer referencing over nesting in MongoDB?
In general,, reference is better for many-to-many relationships.
5: What are ORMs? Why do we use them? Give an example of an SQL request with and without using ORM.
Object-relational mapping (ORM) is a programming technique in which a metadata descriptor is used to connect object code to a relational database. Object code is written in object-oriented programs (OOP) languages such as Java or C#
why should we use it?
an example of an SQL request without using ORM :
SELECT * FROM users WHERE email = '[email protected]';
and with using ORM:
var orm = require('generic-orm-libarry'); var user = orm("users").where({ email: '[email protected]' });
6: What is the difference between a table and a collection?
6- In an SQL database we store our data in column and row (a record) and what hold those rows and column is called tables each database can have multiple tables, in the case of a NoSQL database like MongoDB we have a collection instead of table and inside each table, we can have multiple documents in a collection and inside the documents, we have multiple fields instead of columns.