An Entity-Relationship diagram is a way of representing the structure of a relational database. The two basic concepts in entity-relationship diagramming are, shockingly enough, entities and relationships.

An entity represents a discrete object. Entities can be thought of (roughly) as nouns. Examples: a computer, an employee, a song, a mathematical theorem

A relationship captures how two or more entities are related to one another. Relationships can be thought of (again, roughly) as verbs. Examples: an owns relation between a company and a computer, a supervises relation between an employee and a department, a performs relation between an artist and a song, a proved relation between a mathematician and a theorem.

Entities and relationships can both have attributes. Examples: an employee entity might have a Social Security Number attribute (in the US), the proved relation may have a date attribute. Attributes are drawn as ovals connected to their owning entity sets by a line.

Every entity (unless it is a weak entity) must have a minimal set of uniquely identifying attributes. This set is called the entity's primary key.

Entity-relationship diagrams don't show single entities or single instances of relations. Rather, they show entity sets and relationship sets (displayed as rectangles and diamonds respectively). Example: a particular song is an entity. The collection of all songs in a database is an entity set. The proved relationship between Andrew Wiles and Fermat's Last Theorem is a single relationship. The set of all such mathematician-theorem relationships in a database is a relationship set.

Lines are drawn between entity sets and the relationship sets they are involved in. If all entities in an entity set must participate in a relation in the relationship set, a thick line is drawn. This is called a participation constraint. If each entity of the entity set can participation in at most one relationship in the relationship set, an arrow is drawn from the entity set to the relationship set. This is called a key constraint. To indicate that each entity in the entity set is involved in exactly one relationship, a thick arrow is drawn.

Less Common Symbols

A weak entity is an entity that can't be uniquely identified by its own attributes alone, and therefore must use as its primary key both its own attributes and the primary key of an entity it is related to. A weak entity set is indicated by a bold rectangle (the entity) connected by a bold arrow to a bold diamond (the relationship).

Sometimes two entities are more specific subtypes of a moregeneral type of entity. For example, programmers and marketers might both be types of employees at a software company. To indicate this, a triangle with "ISA" on the inside is drawn. The superclass is connected to the point on top and the two (or more) subclasses are connected to the base.

Finally, through aggregation a relation and all its participating entity sets can be treated as a single entity set for the purpose of taking part in another relation. This is indicated by drawing a dotted rectangle around all aggregated entities and relationships.

Log in or register to write something here or to contact authors.