- 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 is the difference between a table and a collection?
-
-
Save hiba-machfej/e96e1a7fb01a9dbdd53fb4586df48d11 to your computer and use it in GitHub Desktop.
Mohammed Nazar, Dawood Alkawaz, Hana Abduallah, Elaf Gardi.
- NoSQL Schema is more flexible , it can grow horizontally and it has faster queries and we can use Json with NoSQL.
- Embedding is about putting new data to the document as new filed while referencing is creating another collection to have a new entity with a filed that has a reference for the main document.
- prefer embedding by default for efficiency and ease of access. Use references when data independence or shared access is necessary.
- When we have a new distinct entity having its own properties and when you might want to have the new data accessed separately.
- When you create a table you must have a schema with datatypes and stick to that.
Group : Nada Al Shakiry | Dilan Ahmed | Ahmed Sabah | Helin tayab | Mohammad Sabah
- Initially SQL and NoSQL are the same in terms of being Database management, but they are differ in terms of
Data modeling and Scalability : data is more stored and organized in table like striucture in SQL but in NoSQL databases are flexible organized similar to JSON. Also, SQL is more vertically modeled data in which we have the date over one big server while we have the data over smaller servers in NoSQL horizontally distributed.
Also they differ in Schema in which SQL is more solid while NoSQL is more dynamic.
they are also differ in Transactions and Use Cases as well.
-
in referencing the data are associated to each other from one document to another based on the shared id , while in embedding is more like nesting the information inside one collection in which they are related to each other. Also, the referencing is more slower in comparison to embedding and embedding is more faster as there are less queries and faster fetching.
-
We think it is better to use embedding over using referencing as the embedding is more faster in terms of fetching data and less queries required to return data which makes it more simple in terms of structuring database and manipulation of the data as well. Therefore, it is much better to use embedding over referencing as reference involves more queries and slower, yet the referencing is better usage for complex relational databases.
-
we think using referencing for having multiple relationships, consistent data, avoiding duplication of data, having large embedded dat.
-
SQL uses tables that have a predefined structure, while NoSQL databases like MongoDB are flexible with how data is stored.
-
In MongoDB, referencing keeps related data in a separate collection and links it using IDs. Embedding puts related data directly in the parent document.
-
Embedding is usually better for performance since it avoids joins. Keeping related data together makes queries faster.
-
Reference if related data may change a lot or get too big. This way it can grow without slowing down the parent document.
-
SQL tables enforce structure and data types, while MongoDB collections are flexible - they can hold different document types.
Written by Room 10 members:
- Zainab Alnajjar
- Zainab Mirza
- Hanan Islam
- Sajad Ismael
Ahmed Isam, Bahram Baqer, Eman Jamal, Payam R.
Q1-What is the difference between SQL and NoSQL?
A-
Q2- What is referencing and what is embedding in MongoDB?
A-Referencing: In MongoDB, referencing means storing related data in separate collections and using references or IDs to link them.
Embedding: Embedding involves storing related data within a single document in MongoDB.
Q3- Why should we embed more than referencing when we can in MongoDB?
A-Embedding can be more efficient for read operations since it retrieves all related data in one query, reducing the need for joins. It simplifies data retrieval and can improve performance for data that is frequently accessed together.
Q4- When should we prefer referencing over nesting in MongoDB?
A-Use referencing when data is frequently updated, as it avoids the need to update multiple documents. Referencing is also beneficial when the related data might be accessed independently from the main document.
Q5 What is the difference between a table and a collection?
A-Table: In SQL, a table is a collection of rows that conform to a schema, with each row representing a record.
-Collection: In MongoDB, a collection is similar to a table but does not enforce a schema, allowing for more flexible document structures.