er diagram, also called entity-relationship diagram (Entity Relationship Diagram), provides a method to represent entity types, attributes and relationships, and is used to describe the conceptual model of the real world. The ER model was first proposed by Peter Chen in 1976. It has been widely recognized in the field of database design, but is rarely used as a data model for actual database management systems.
er diagram is also called entity-relationship diagram (Entity Relationship diagram Diagram), provides a method to represent entity types, attributes and relationships, and is used to describe the conceptual model of the real world. The ER model was first proposed by Peter Chen (Chen Pinshan) proposed it in 1976. It has been widely recognized in the field of database design, but it is rarely used as a data model for actual database management systems.
E-R diagram is also called entity-relationship diagram (Entity Relationship diagram) Diagram), provides a method to represent entity types, attributes and relationships, and is used to describe the conceptual model of the real world.
It is an effective way to describe a conceptual model of real-world relationships. It is a way of representing a conceptual relationship model. Use "rectangular frame" to represent the entity type, and write the entity name in the rectangular frame; use "elliptical frame" or rounded rectangle to represent the attributes of the entity, and use "solid line segments" to connect it with the "entity type" of the corresponding relationship;
Use "diamond box" to indicate the cause of the connection between entity types, write the contact name in the diamond box, and use "solid line segments" to connect to the relevant entity types respectively, and mark next to "solid line segment" The type of contact (1:1, 1:n or m:n).
Components of ER diagram
There are the following four components in the ER diagram:
Rectangular box: represents the entity, and records the entity in the box name.
Rhombus box: indicates contact, enter the contact name in the box.
Oval box: Represents the attributes of an entity or relationship. Record the attribute name in the box. For primary attribute names, underline the name.
Connection lines: between entities and attributes; between entities and relationships; between relationships and attributes, connect them with straight lines, and mark the type of relationship on the straight line. (For a one-to-one connection, write 1 in each direction of the connection between the two entities; For a one-to-many relationship, write 1 on the one side and N on the many side; for a many-to-many relationship, write N and M in the direction of the connection between the two entities. )
Composition elements
The three basic elements that constitute the E-R diagram are entity type, attributes and relationships, and their representation method is:
ENTITY
It is generally believed that things that can be objectively distinguished from each other are entities. Entities can be specific people and things, or they can also be abstract concepts and connections. The key is that one entity can be distinguished from another entity, and entities with the same attributes have the same characteristics and properties. Use entity names and their attribute name sets to abstract and describe similar entities. It is represented by a rectangle in the E-R diagram, and the entity name is written in the rectangular box; for example, student Zhang San and student Li Si are both entities. If it is a weak entity, put a solid rectangle outside the rectangle.
Attributes
A certain characteristic of an entity. An entity can be characterized by several attributes. Attributes cannot be separated from entities; attributes are relative to entities. It is represented by an ellipse in the E-R diagram, and undirected edges are used to connect it with the corresponding entities; for example, the student's name, student number, and gender are all attributes. If it is a multi-valued attribute, put a solid ellipse outside the ellipse. If it is a derived attribute, it is represented by a dotted ellipse.
Contact
Contact is also called relationship, which reflects the association within or between entities in the information world. The relationship within an entity usually refers to the relationship between the attributes that make up the entity; the relationship between entities usually refers to the relationship between different entity sets. It is represented by a diamond in the E-R diagram. The contact name is written in the diamond box, and undirected edges are used to connect it to the relevant entities respectively. At the same time, the type of contact is marked next to the undirected edge (1 : 1, 1 : n or m : n). For example, there is a teaching relationship between teachers teaching students, and there is a course selection relationship when students choose courses. If it is a weak entity connection, put another rhombus outside the rhombus.
The above is the detailed content of What is a database ER diagram?. For more information, please follow other related articles on the PHP Chinese website!