We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Software

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What Is Entity Integrity?

By T.S. Adams
Updated: May 16, 2024
Views: 31,285
Share

Entity integrity is one of the primary rules of effective database construction. It refers to the process of enforcing a primary key for each table in a database, where the key must be either a row or a combination of rows that are unique non-null values. By maintaining entity integrity, each record in each table of a database can be specifically identified via the primary key. This prevents duplicate records and other issues that would indirectly compromise the integrity of the database. In the absence of entity integrity, the entries in a database can accidentally overlap, as there will be no way to pluck a specific entry from the table.

When considering the first part of entity integrity, a "unique" value, the concept of a primary key is important to understand. A primary key in a database is a value used to specifically identify each individual record. To be effective, a primary key must be unique; in other words, it must prove impossible to retrieve multiple records by searching for a single primary key. A Social Security number would be a good primary key for a database focused on individual personal records in the US, since two people never have the same number. Anyone searching in the database for a specific Social Security number would, by definition, retrieve only a single record at a time.

To see the problems that arise in the absence of entity integrity through unique primary keys, one could picture a database where an individual's last name is used as the primary key. Since more than one person can share a last name, entering "Smith" or "Jones" as the search criteria could possibly produce dozens of records. If this happens, the integrity of the database is in question because the end user no longer has a method to retrieve individual records.

The second part of entity integrity states that the value chosen as the primary key must never be a null, or empty, value for any item in the database. If the primary key value remained null for one or more records in the database, certain records would become impossible to retrieve, as a null value is insufficient to uniquely identify these records. In other words, if a Social Security number is used as the primary key and an employee is not from the US and thus does not have one, the foreign employee's record will be impossible to identify using the primary key, invalidating the integrity of the database.

Share
EasyTechJunkie is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.
Discussion Comments
Share
https://www.easytechjunkie.com/what-is-entity-integrity.htm
Copy this link
EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.

EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.