The most common model for abstract representation of the structure of a database is the entity-relationship model (or E/R model). In the E/R model, the structure of data is represented graphically, as an "entity-relationship diagram", using three principal element types:
a. Entity sets
We shall cover each in turn.
a) Entity SetsAn entity is an abstract object of some kind, and a compilation of alike entities forms an entity set. There is some resemblance between the entity and an "object" in the sense of object-oriented programming. Similarly, an entity set bears some similarity to a class of objects. However, the E/R model is a static concept, involving the structure of data and not the operations on data. Therefore, one would not expect to find techniques associated with an entity set as one would with a class.
Example : We shall use as a running example a database about movies, their stars, the studios that produce them, and other sides of movies. Each movie is an entity, and the set of all movies composes an entity set. Similarly, the stars are entities, and the set of stars is an entity set. A studio is another type of entity, and the set of studios is a third entity set that will appear in our examples.
b) Attributes Entity sets have combined attributes, which are properties of the entities in that set. For example, the entity set Movies might be given attributes such as title (the name of the movie) or length, the number of minutes the movie runs. In our version of the E/R model, we shall presume that attributes are atomic values, such as strings, integers, or reals. There are other variations of this model in which attributes can have some limited structure; see the above box on "E/R Model Variations".
c) RelationshipsRelationships are connections among two or more entity sets. For example, if Movies and Stars are two entity sets, we could have a relationship Stars-in that connects movies and stars. The intent is that a movie entity m is related to a star entity s by the relationship Stars-in if s appears in movie m. While binary relationships, those between two entity sets, are by far the most common type of relationship, the E/R model allows relationships to include any number of entity sets. We shall postpone discussion of these multiway relationships until "Multiway Relationships".
Entity-Relationship DiagramsAn E/R diagram is a graph representing entity sets, attributes, and relationships. Components of each of these kinds are represented by nodes of the graph, and we use a special shape of node to indicate the kind, as follows:
● Entity sets are represented by rectangles.
● Attributes are represented by ovals.
● Relationships are represented by diamonds.
Edges connect an entity set to its attributes and also connect a relationship to its entity sets.
Example : In the following figure is an E/R diagram that represents a simple database about movies. The entity sets are Movies, Stars, and Studios.
The Movies entity set has four attributes: title, year (in which the movie was made), length, and film Type (either "color" or "Black & White"). The other two entity sets Stars and Studios happen to have the same two attributes: name and address, each with clear meaning. We also see two relationships in the diagram:
1. Stars-in is a relationship connecting each movie to the stars of that movie. This relationship consequently also connects stars to the movies in which they appeared.
2. Owns connects each movie to the studio that owns the movie. The arrow pointing to entity set Studios in the above figure indicates that each movie is owned by a unique studio. We shall discuss uniqueness constraints such as this one in "Multiplicity of Binary E/R Relationships".
- entity set
- Set Operations on Relations
- An Algebra of Relational Operations
- Relational Algebra
- Attribute Lists
- Semistructured Data Representation
- Semistructured Data
- Object-Oriented Versus Object-Relational
- Nested Relations
- What If There Is No Key
- Representing ODL Relationships
- Representing Other Type Constructors
- Representing Set-Valued Attributes
- Nonatomic Attributes in Classes
- Declaring Keys in ODL
- Subclasses in ODL / Multiple Inheritance in ODL
- Types in ODL
- Methods in ODL
- Multiplicity of Relationships
- Relationships in ODL / Inverse Relationships
- Attributes in ODL
- Introduction to ODL
- The Type System
- Decomposition into Fourth Normal Form
- Reasoning About Multivalued Dependencies
- Definition of Multivalued Dependencies
- Multivalued Dependencies
- Third Normal Form
- Boyce-Codd Normal Form
- Projecting Functional Dependencies
- Closing Sets of Functional Dependencies
- The Transitive Rule
- Why the Closure Algorithm Works
- Computing the Closure of Attributes
- Trivial Functional Dependencies
- The Splitting/Combining Rule
- Rules About Functional Dependencies
- Keys of Relations
- Functional Dependencies
- Using Null Values to Combine Relations - Comparison of Approaches
- An Object-Oriented Approach
- Converting Subclass Structures to Relations
- Handling Weak Entity Sets
- Combining Relations
- From E/R Relationships to Relations
- From Entity Sets to Relations
- Relation Instances
- Equivalent Representations of a Relation
- Tuples / Domains
- Attributes / Schemas
- The Relational Data Model
- Summary of The Entity-Relationship Data Model
- Weak Entity Set Notation
- Requirements for Weak Entity Sets
- Weak Entity Sets
- Other Kinds of Constraints
- Referential Integrity in E/R Diagrams
- Referential Integrity
- Single-Value Constraints
- Representing Keys in the E/R Model
- Keys in the E/R Model
- The Modeling of Constraints
- Picking the Right Kind of Element
- Choosing the Right Relationships
- Simplicity Counts
- Avoiding Redundancy
- Design Principles
- Subclasses in the E/R Model
- Converting Multiway Relationships to Binary
- Attributes on Relationships
- Roles in Relationships
- Multiplicity of Binary E/R Relationships
- Instances of an E/R Diagram
- Relational Database Systems