First, the composition of elements
element | description | It represents the shape |
entity | The objective existence of things and can be distinguished from each other | Use boxes to specify the name of the entity rectangle |
Attributes | An entity having property | Represented by oval, and connect with the edges with no corresponding entity |
relationship | And the relationship between the entity and the internal entities entities | With diamond, said diamond box indicate the contact name, and are connected by undirected edges with relevant entities, Type simultaneously on undirected edges beside links |
Second, explain the relationship between
First, one on one
1 to 1 relationship is set for the entity A and the entity set B, each of A up to an entity associated with the entity B; and conversely, each entity in the entity set B has at most one entity in the entity set A relationship.
Second, many
To-many relationship is the entity set A and set B, the entity at least N (N> 0) are related entities; and B each entity set up an entity associated with the entity in the entity set A.
Third, many to many
Many relationship means that every entity sets and entity B entity set A in at least M (M> 0) are related entities, each entity sets and entity B, the entity A set of at least N ( N> 0) are related entities.
Third, the example explanation
I. Description of the problem
A student can be more than elective course, there are a number of students to take a course;
a teacher can teach a multi-course, only one teacher teaching a course;
student to take a course, only one result.
Students attributes are student number, student's name; number of teachers attribute teachers, teacher's name; property courses have course number, course name.
Two, ER 图