Entity–relationship model - Wikipedia
For example, at this level we would describe the attribute SSN as 10 bytes to Definition, The Entity-Relationship (ER) model, a high-level data model that is. For our sales database example, the product and customer entity sets would be . Like entities, relationships can have attributes: we can define a sale to be a. The ER model defines the conceptual view of a database. It works For example , a student entity may have name, class, and age as attributes. There exists a.
To be able to tell them apart, we need an attribute or a minimal combination of attributes guaranteed to be unique to each individual customer. The identifying attribute or attributes form a key. In our example, we can assume that no two customers have the same email address, so the email address can be the key. However, we need to think carefully about the implications of our choices. For example, if we decide to identify customers by their email address, it would be hard to allow a customer to have multiple email addresses.
Learning MySQL by Hugh E. Williams, Saied M.M. Tahaghoghi
Any applications we build to use this database might treat each email address as a separate person, and it might be hard to adapt everything to allow people to have multiple email addresses. Clearly, there may be several possible keys that could be used to identify an entity; we choose one of the alternative, or candidate, keys to be our main, or primary, key. You usually make this choice based on how confident you are that the attribute will be non-empty and unique for each individual entity, and on how small the key is shorter keys are faster to maintain and use.
Attributes comprising the primary key are shown underlined. The parts of any composite attributes are drawn connected to the oval of the composite attribute, and multivalued attributes are shown as double-lined ovals.
Similarly, a product price could be a positive rational number. Attributes can be empty; for example, some customers may not provide their telephone numbers.
You should think carefully when classifying an attribute as multivalued: The sales database requirements may specify that a product has a name and a price. To distinguish between products, we can assign a unique product ID number to each item we stock; this would be the primary key.
Each product entity would have name, price, and product ID attributes. The ER diagram representation of the product entity Representing Relationships Entities can participate in relationships with other entities. For example, a customer can buy a product, a student can take a course, an artist can record an album, and so on. Like entities, relationships can have attributes: Our database could then record each sale and tell us, for example, that at 3: For example, each customer can buy any number of products, and each product can be bought by any number of customers.
This is known as a many-to-many relationship. We can also have one-to-many relationships. For example, one person can have several credit cards, but each credit card belongs to just one person.
Looking at it the other way, a one-to-many relationship becomes a many-to-one relationship; for example, many credit cards belong to a single person. Finally, the serial number on a car engine is an example of a one-to-one relationship; each engine has just one serial number, and each serial number belongs to just one engine.
We often use the shorthand terms 1: N for one-to-one, one-to-many, and many-to-many relationships, respectively. The number of entities on either side of a relationship the cardinality of the relationship define the key constraints of the relationship.
There are many relationships that may at first seem to be one-to-one, but turn out to be more complex. For example, people sometimes change their names; in some applications, such as police databases, this is of particular interest, and so it may be necessary to model a many-to-many relationship between a person entity and a name entity.
Entity An entity is a real-world item or concept that exists on its own.Introduction to ER model
In our example, a particular student such as, "Emanuel Vagas"team, lab section, or experiment is an entity. The set of all possible values for an entity, such as all possible students, is the entity type. In an ER model, we diagram an entity type as a rectangle containing the type name, such as student see Figure 2.
Definition An entity is a real-world item or concept that exists on its own. The set of all possible values for an entity is the entity type. ER diagram notation for entity student Attribute Each entity has attributes, or particular properties that describe the entity. For example, student Emanuel Vagas has properties of his own Student Identification number, name, and grade.
A particular value of an attribute, such as 93 for the grade, is a value of the attribute. Most of the data in a database consists of values of attributes.
The set of all possible values of an attribute, such as integers from 0 to for a grade, is the attribute domain. In an ER model, an attribute name appears in an oval that has a line to the corresponding entity box, such as in Figure 3.
Definition An attribute of an entity is a particular property that describes the entity. The set of all possible values of an attribute is the attribute domain. Sometimes the value of an attribute is unknown or missing, and sometimes a value is not applicable. In such cases, the attribute can have the special value of null.
For example, until the professor grades a laboratory assignment, the team grade is missing or null. Definition Null is the special attribute value that indicates an unknown or missing value.
An attribute can be simple or composite. A simple attribute, such as grade, is one component that is atomic.
What is an Entity-Relationship Model (ER Model)? - Definition from Techopedia
If we consider the name in two parts, last name and first name, then the name attribute is a composite. A composite attribute, such as "Emanuel Vagas", has multiple components, such as "Emanuel" and "Vagas"; and each component is atomic or composite. We illustrate this composite nature in the ER model by branching off the component attributes, such as in Figure 4. Definition A simple attribute is one component that is atomic. The second issue is a 'chasm trap'.
A chasm trap occurs when a model suggests the existence of a relationship between entity types, but the pathway does not exist between certain entity occurrences. For example, a Building has one-or-more Rooms, that hold zero-or-more Computers. One would expect to be able to query the model to see all the Computers in the Building.
However, Computers not currently assigned to a Room because they are under repair or somewhere else are not shown on the list. Another relation between Building and Computers is needed to capture all the computers in the building. This last modelling issue is the result of a failure to capture all the relationships that exist in the real world in the model.
See Entity-Relationship Modelling 2 for details. Entity—relationships and semantic modeling[ edit ] Semantic model[ edit ] A semantic model is a model of concepts, it is sometimes called a "platform independent model". It is an intensional model.
At the latest since Carnapit is well known that: The first part comprises the embedding of a concept in the world of concepts as a whole, i. The second part establishes the referential meaning of the concept, i. Extension model[ edit ] An extensional model is one that maps to the elements of a particular methodology or technology, and is thus a "platform specific model".
The UML specification explicitly states that associations in class models are extensional and this is in fact self-evident by considering the extensive array of additional "adornments" provided by the specification over and above those provided by any of the prior candidate "semantic modelling languages".