Databases Reference
In-Depth Information
INTRODUCTION
The diagramming technique we will use is called the entity-relationship or
E-R Model. It is well named, as it diagrams entities (together with their attributes)
and the relationships among them. Actually, there are many variations of E-R
diagrams and drawing them is as much an art as a science. We will use the E-R dia-
gramming technique provided by Microsoft Visio with the ''crow's foot'' variation.
To begin, an entity is an object or event in our environment that we want to
keep track of. A person is an entity. So is a building, a piece of inventory sitting
on a shelf, a finished product ready for sale, and a sales meeting (an event). An
attribute is a property or characteristic of an entity. Examples of attributes include
an employee's employee number, the weight of an automobile, a company's address,
or the date of a sales meeting. Figure 2.1, with its rectangular shape, represents
a type of entity. The name of the entity type (SALESPERSON) is set in caps at
the top of the box. The entity type's attributes are shown below it. The attribute
label PK and the boldface type denote the one or more attributes that constitute the
entity type's unique identifier. Visio uses the abbreviation PK to stand for ''primary
key,'' which is a concept we define later in this topic. For now, just consider these
attributes as the entity type's unique identifier .
Entities in the real world never really stand alone. They are typically associated
with one another. Parents are associated with their children, automobile parts are
associated with the finished automobile in which they are installed, firefighters are
associated with the fire engines to which they are assigned, and so forth. Recognizing
and recording the associations among entities provides a far richer description of
an environment than recording the entities alone. In order to deal intelligently and
usefully with the associations or relationships among entities, we have to recognize
that there are several different kinds of relationships and several different aspects of
describing them. The most basic way of categorizing a relationship is by the number
of entity types involved.
SALESPERSON
PK
Salesperson
Number
Salesperson
Name
Commission
Percentage
Year of Hire
One
Salesperson
FIGURE 2.1
An E-R model entity and its attributes
BINARY RELATIONSHIPS
What is a Binary Relationship?
The simplest kind of relationship is known as a binary relationship . A binary
relationship is a relationship between two entity types. Figure 2.2 shows a small
E-R diagram with a binary relationship between two entity types, salespersons and
Search WWH ::




Custom Search