...

/

Normalization and Denormalization of Data

Normalization and Denormalization of Data

Learn about database design and how it helps create effective data retrieval.

Database design

A properly-designed database schema is essential for our query’s effectiveness. It will reduce the amount of data retrieval code we’ll have to write to retrieve data from the database later. For example, there’s a relationship between the books and authors models of the online bookshop application. A book can be written by different authors and an author can also write different books. How this relationship is saved in the database depends on the type of queries we run.

MongoDB, which is a NoSQL database, doesn’t enforce a schema by default unlike SQL databases like Postgres and MySQL. In a relational database, data is separated into different tables and is retrieved by queries using join statements to link and pull data from the different tables. This isn’t the case for NoSQL databases, which favor saving all the information about a model in a single collection instead.

Data normalization

...