Relationships
Attributes and Entities unable you to explicitly describe what data or information, is being stored in the database. Relationships are the other powerful characteristic of relational modeling and provide the modeling technique its name. A relationship is a logical linkage among two entities which defines how those entities are related with each other. Suppose of relationships as the logical links in a database that turn simple data into useful information.
For example, our definition of a teacher reads: “A person employed through the college who is responsible for instructing students in a class.”
You will now see to recognize not only the need for a relationship, but also the kind of relationship.
Identifying relationships in a data Model
If entities can be thought of as the nouns in data modeling, then relationships are best defined as the verbs. In fact, relationships frequently have a verb phrase related with them in the data model much like entities have an associated definition. One trick to discovering relationships among entities is to look closely at the entity definitions. Suppose the following entity definitions from before in the chapter:
- Teacher: A person employed through the college who is responsible for instructing a CLASS of STUDENTS.
- Student: A person who is enrolled in CLASSES at the college and attends CLASS SESSIONS.
- Course: Defines the subject material taught in a CLASS.
- Class: A scheduled example of a COURSE which is taught through one TEACHER and which meets in particular room during specific times of the week.
- Class Session: An example of a CLASS which occurs at a particular time and date.
Notice that the definitions now are written to show other entities in all caps and significant verbs or verb phrases appear in italics. To Formatting your entity definitions in this method makes it simple to identify possible relationships among entities. These definitions can be distilled into various simple statements which highlight the relationships among the entities in this case study:
A TEACHER instructs CLASSES
A COURSE defined subject material for CLASSES.
STUDENTS are enrolled in CLASSES
STUDENTS attend CLASS SESSIONS
A CLASS occurs as CLASS SESSIONS
In an ER diagram, relationships are represented as lines drawn among entities. Frequently, the verb phrase appears near the line to define the relationship additionally.