educative.io

What is the reason for using relational DB for storing consumer information?

One of the reasons specified was “data integrity”. Could someone please explain what that means in this case?

Hi @Ezhil_Nikhilan,
We assume you are referring to the sentence: “We’ll use a relational database since our consumer-related data is structured, and we want to ensure our data integrity.” Your question is what data integrity means in this context. A subscriber can have one or more topics. That means, in the topics relation (table), the subscriber will be a foreign key. Due to the relational database’s referential integrity enforcement, every topic will have valid subscribers. Additionally, a specific subscriber can not be deleted without disassociating it from the topics relation. Had we not used a relational database, application logic would have to take care of all such cases to ensure that overall data remains valid.
We hope the above explanation answers your question. Happy learning!

2 Likes