📜  MongoDB 与 MySQL

📅  最后修改于: 2022-05-13 01:55:49.290000             🧑  作者: Mango

MongoDB 与 MySQL

下面讨论MongoDB和MySQL在各种参数上的差异:

什么是 MongoDB 和 MySQL?

MongoDBMySQL
MongoDB is an open-source database developed by MongoDB, Inc. MongoDB stores data in JSON-like documents that can vary in structure. It is a popular NoSQL database.MySQL is a popular open-source relational database management system (RDBMS) that is developed, distributed and supported by Oracle Corporation.

数据如何存储?

MongoDBMySQL
In MongoDB, each individual records are stored as ‘documents’.In MySQL, each individual records are stored as ‘rows’ in a table.

记录的等级上限

MongoDBMySQL
Documents belonging to a particular class or group as
stored in a ‘collection’.
Example: collection of users.
A ‘table’ is used to store rows (records) of similar type.

SQL 或 NoSQL

MongoDBMySQL
MongoDB is what is called a NoSQL database. This means that pre-defined structure for the incoming data can be defined and adhered to but also, if required different documents in a collection can have different structures. It has a dynamic schema.MySQL as the name suggests uses Structured Query Language (SQL) for database access. The schema can not be changed. The inputs following the given schema are only entered.

示例:在一个表中,如果有名称、地址列,并且需要在其中一个条目的新列中输入“年龄” ,则不会使用它,因为该列未在架构中定义。
这可以在 MongoDB 中实现,无论模式如何都可以插入任何新字段,因此已知具有动态模式。

显着特点

MongoDBMySQL
MongoDB was designed with high availability and scalability in mind, and includes out-of-the-box replication and sharding.MySQL concept does not allow efficient replication and sharding but in MySQL one can access associated data using joins which minimizes duplication.
mongodb mysql 功能比较 gfg

MongoDB MySQL 特性对比 gfg

术语差异
MongoDB 和 MySQL 之间存在基于术语的差异。

术语差异 gfg

术语差异 gfg

数据表示
数据在两个数据库中的表示和存储方式之间的差异是完全不同的。
MongoDB 以类 JSON 文档的形式存储数据,而 MySQL 以表行的形式存储数据,如前所述。
示例:展示如何在 MongoDB 和 MySQL 中存储和表示数据。

mongodb vs mysql gfg中的数据表示

数据表示 MongoDB vs MySQL gfg