• A A

Home > Technology > IT > Database > Entity and Attribute Compared

Difference Between Entity and Attribute

Entity vs Attribute

Entity-relationship modeling (ERM) technique is widely used for modeling databases. Entity-relationship modeling is the process of coming up with an abstract and conceptual representation of data. One of the main building blocks of ERM is an entity. Entity represents a real world object or a thing that can stand on its own independently and can be identified uniquely. Attributes are the properties of these entities. ER diagrams are the product of entity-relationship modeling. ER diagrams are drawn using entities, attributes and other symbols (such as relationships).

What is an Entity?

An entity represents a thing that can exist independently and that can be identified uniquely. More specifically, an entity often represents a class, group or category of similar objects. Most often, an entity represents a real world object such as a car or an employee. Entities can be though of as nouns that come up during the description of the problem to be solved. Entities are represented as tables in relational databases. In general, each entity will map to exactly one table in the database. Individual rows in the tables correspond to the actual instances of the object/thing represented by the entity. For example, in an Employee database, each row corresponds to records of individual employees of the company.

What is an Attribute?

In the entity-relationship modeling, properties of entities are called attributes. In other words, attributes represent a sub group of information of the object represented by the entity. Attributes define the individual instances and help to differentiate between each instance by describing their characteristic. It is important to note that attributes cannot be set-valued and they should be atomic. In relational databases, where entities are realized as tables, each column represents the attributes of these entities. For example, in the Employee table, columns such as department, rank and salary are examples of attributes of the employees. In order to differentiate between individual instances of the entity, one or more attribute fields with unique values (for all instances) can be selected as a key. For example, the social security number attribute (which is unique for all employees) is often used as the primary key of an Employee table. Sometimes multiple attributes can makeup the primary key as well.

What is the difference between an Entity and an Attribute?

In entity-relationship modeling, entities represent real world objects/things that can be identified as unique and independent, while attributes represent the properties of those entities. In relational databases, entities become tables (each row representing individual instances), whereas attributes become columns of those corresponding tables. When designing databases, it is common to have confusion over choosing an entity vs. an attribute to represent a certain real word object. For example, should the address of the employee represented as an attribute or another entity (connected to employee entity through a relationship)? A general rule of thumb is, if an employee has more than one address, then the address must be an entity (because attributes are not set-valued). Similarly, if the structure of the address is important to capture, then again the address should be an entity (because attributes are atomic).


Related posts:

  1. Difference Between ER Diagram and Class Diagram
  2. Difference Between Conceptual and Logical Model
  3. Difference Between Database and Schema
  4. Difference Between ERD and DFD
  5. Difference Between DBMS and Database

Tags: , , , , ,

Copyright © 2010-2012 Difference Between. All rights reserved.Protected by Copyscape Web Plagiarism Detection
Terms of Use and Privacy Policy : Legal.
hit counters
eXTReMe Tracker
hit counters