Entities and Instances
Deciding what is an entity and what is merely an attribute of something else is the first irreversible-looking decision of conceptual design. This lesson gives the tests that separate the two, and shows where the boundary genuinely depends on the requirements.
Beginner
Learning objectives
- Apply the three tests — independent existence, identity, reuse — to decide whether something is an entity
- Distinguish an entity from an attribute without guessing
- Distinguish an entity from a relationship in the cases where both readings are defensible
- Name entities consistently and in the language of the domain
- Explain what a weak entity is and why it needs a different treatment of identity
Prerequisites
- Module 2: Requirements Analysis
Introduction
An entity is the only construct in the E-R model that can exist on its own. Attributes need something to belong to; relationships need two or more things to connect. Entities are the nouns the schema is built from, and getting them right decides almost everything that follows: the relations in Module 5 are, with few exceptions, one per entity.
That makes the entity decision the most consequential one in the module — and the one most often made by feel. A designer looks at a requirement, says "obviously Member is an entity", and moves on. Most of the time that instinct is right. The problem is the cases where it is not, and those cases are invisible precisely because no argument was made.
This lesson replaces the instinct with three tests, then shows the places where the tests conflict and the requirements have to decide.
Three tests for an entity
A class of objects is an entity when it satisfies all three of the following.
Independent existence. The object exists whether or not anything else in the schema exists, and it is not merely a property of another object. A Member exists before taking a loan and after returning the book. A Loan also has independent existence in this sense — it is not a property of the member, it is an event that involves one. By contrast, a member's address does not exist on its own: it is a property of the member, and if the member is deleted the address is gone with it.
Identity. Instances of the class must be distinguishable from one another, and the organisation must be able to refer to them individually. "The member with card 4471" is a thing you can point at, call, and complain about. This test is what separates an entity from a mere category: "colour" is not an entity because nobody refers to a colour; "vehicle model" often is, because the workshop says "the 2019 Punto" and orders parts for it.
Reuse. The object is referred to by more than one fact, or by more than one part of the domain. A Member is referred to by loans, reservations, fines and contact preferences. An object that appears in exactly one place and carries exactly one value is a candidate for being an attribute.
Entity
An entity is a class of objects of the domain that (a) have an existence independent of the other objects represented, (b) are individually identifiable by the organisation, and (c) are referred to by more than one fact. Each member of the class is an instance (or occurrence).
The three tests are not independent of each other, and that is the point: they fail in different ways. A class can have identity without reuse (an Invoice referred to only by its total), or reuse without independent existence (a member's Address, reused by billing and shipping but destroyed with the member). Only all three together justify an entity.
Entity or attribute? The question that decides the schema
This is the decision you will make more often than any other. Three questions resolve almost every case.
Does the thing have properties of its own? If the candidate has its own attributes — not just a name — it is very likely an entity. A Publisher has a name, an address, a contact and a contract; it is an entity. A member's surname has no properties; it is an attribute.
Is it shared between instances? If two books can have the same author, the author is not a property of the book: the name would have to be repeated, and repeated facts drift apart. Sharing is the strongest signal for an entity. This is the same argument as minimality from the previous lesson, seen from the other side.
Does the organisation refer to it as a thing? The librarian says "we have three copies of that title, one is at the bindery". Bindery is a place with an address and a schedule — an entity. The librarian never says "this book's genre is 4" — genre is a value, an attribute.
Entity or relationship?
The mirror question. Enrols is a relationship; Appointment could be either. The test is whether the thing has its own identity and its own life.
A relationship is appropriate when the construct is nothing but a connection: it has no attributes beyond those that belong to the connection itself, nothing else refers to it, and deleting one of the two participants destroys it. Enrols between Student and Course is the textbook case.
An entity is appropriate when the construct can be referred to independently — when other parts of the schema point at it, when it can exist in states of its own, or when it has relationships of its own. An Appointment that can be cancelled, rescheduled, invoiced and reviewed has a life; that life needs an entity. A Loan in a library is always an entity for exactly this reason: it has a due date, a return date, a renewal count and possibly a fine attached.
A useful heuristic: if the construct needs a relationship of its own, it must be an entity. A relationship cannot be the endpoint of another relationship in the E-R model. The moment a requirement says "each appointment is handled by a receptionist", the appointment has become an entity.
Naming
Names carry design information, and bad names hide design errors. Four rules, all cheap to follow.
Singular, in the domain's language. Member, not Members; Prestito, not Loans. The plural invites thinking of the entity as a table of rows, which is Module 5's business.
No prefixes, no abbreviations. tbl_mbr, T_MEMBER, mbr all mean the same thing and all cost the reader a translation step. If the organisation says "socio", the entity is Socio.
One concept per name. If you are tempted to call something BookCopyItem, you have probably merged two concepts. Ask which one the requirements actually need.
Consistent granularity across the schema. If you have Book and Loan, do not add BookTitle unless the requirements genuinely distinguish a title from a physical copy — and if they do, then Book must be renamed Copy so that the two are unambiguous.
Entities with no attributes, and entities with only an identifier
Two cases look like errors and are not.
An entity with no attributes of its own is legal and sometimes correct. Consider a schema where Membership connects a Member to a MembershipType. If the requirements say nothing about a membership beyond which member has which type, Membership has no attributes — and it is still needed if a member can hold several types. In Chen notation you draw the rectangle with no ellipses. It is a signal to re-read the requirements, not an error.
An entity whose only attribute is its identifier is extremely common. A Room identified by its number and otherwise described only by relationships (which department uses it, which bookings occupy it) has one attribute. That is a complete entity, not an incomplete one.
What is not legal is an entity with no identity. Every entity instance must be distinguishable from every other instance of the same entity, and if the requirements cannot supply that distinction, the requirements are incomplete — not the model.
Weak entities
Some objects have no identity of their own: they are identified through another entity. A library's Copy is identified as "copy 3 of title X" — copy 3 of a different title is a different object. The copy number alone is not unique in the library, and never will be.
Such an object is a weak entity: it exists only in association with an identifying entity (its owner), and its identifier is composed of the owner's identifier plus a partial key of its own. In Chen notation the weak entity is drawn with a double rectangle and the identifying relationship with a double diamond; the partial key is underlined with a dashed line.
Weak entities matter in this course because they are the first construct whose treatment in Module 5 differs from the default. A strong entity becomes a relation with its own primary key; a weak entity becomes a relation whose primary key includes the owner's key. Recognising weakness at conceptual time is what makes that translation mechanical rather than improvised.
A worked decision
Take four statements from a library requirements register and decide, for each, whether the construct is an entity, an attribute or a relationship. The reasoning is the deliverable; the verdict matters less.
R12. Each copy of a book carries a unique barcode. R13. Members may have up to three telephone numbers. R14. A loan is made to one member, of one copy, on a date, and is due back after 30 days. R15. The library works with 40 suppliers, each with a contact person and a payment term.
R12 — Copy is an entity, weak with respect to Title. It has independent existence (a copy is on a shelf, can be damaged, can be lost), it has identity (the barcode is unique — note that this makes it strong, not weak, which is a refinement worth noticing), and it is reused (loans, reservations and damage reports all refer to a copy). The barcode is its identifier, not merely an attribute.
R13 — telephone numbers are a multivalued attribute. No entity is created: a telephone number has no properties, is never shared, and nothing else refers to it. The fact that it repeats up to three times makes it multivalued, which is a property of the attribute — covered two lessons from now — not a reason to create a PhoneNumber entity. If the requirements later add "each number has a type (home, work, mobile) and a verified flag", the balance tips and PhoneNumber becomes an entity.
R14 — Loan is an entity. It has its own attributes that belong to neither participant (loan date, due date), it is referred to by other facts (fines, renewals, returns), and it has a life of its own. This is the case where the naive reading "a loan is just the connection between member and copy" would be wrong, and the reason is visible only because the requirements gave the loan dates.
R15 — Supplier is an entity. It has its own attributes, it is shared across many acquisitions, and the organisation refers to it by name. Note what the requirement also implies: payment_term might be a supplier attribute, or might be an entity of its own if the library negotiates terms per category. That is an open question, and it belongs in the assumptions list, not in the schema.
Entities in ERMap
In the ERMap editor an entity is a rectangle created from the entity tool. Two practical points, both of which come up in the exercises.
Attributes are attached to the entity, not typed inside it. ERMap draws attributes as ellipses connected by lines, which is the Chen convention. An attribute marked as key is underlined. This is why the schema you produce in the editor looks like the textbook diagrams and not like a table.
Positions are part of the diagram, not of the model. Where you place a rectangle has no meaning in the schema — it affects readability only. When you open an example from this course in the editor, the positions come from the example file so that the diagram is legible immediately; you are free to rearrange them, and doing so does not change the design.
Common mistakes
| Mistake | Symptom | Correct approach |
|---|---|---|
| Creating an entity for every noun | Name, Surname, City as entities |
Apply the three tests; most nouns are attributes |
| Making everything an attribute | author1, author2, author3 columns |
Shared things with their own properties are entities |
Deciding Address by taste |
Inconsistent treatment across the schema | Ask whether addresses are shared and referred to; record the assumption |
| Plural entity names | Members, Books |
Singular: the entity is the type, not the collection |
| Modelling a relationship as an entity too early | A table-shaped Enrols in the conceptual schema |
Use a relationship until it acquires its own relationships or identity |
| Modelling an entity as a relationship too long | Appointment as a relationship that suddenly needs a cancellation reason |
If it needs its own relationships, it is an entity |
| Ignoring weak entities | Copy given a globally unique id invented by the designer |
Recognise identity through the owner; the id belongs to Module 5 |
| Abbreviated names | mbr, cst, ord_hdr |
Names in the organisation's language |
Summary
- An entity requires independent existence, identity and reuse. Failing any one of the three, reconsider.
- The entity-or-attribute question is decided by three tests: does it have properties of its own, is it shared, does the organisation refer to it as a thing?
- The entity-or-relationship question is decided by life and reference: a construct that needs relationships of its own, or that other constructs point at, is an entity.
- Naming in the singular, in the domain's language, one concept per name, consistently granular.
- Weak entities are about identity, not attributes: they are identified through an owner entity, and their translation in Module 5 differs accordingly.
- When unsure, prefer the split and write down the assumption — merging later is impossible, splitting later is merely expensive.
Verification questions
Check your understanding
- State the three tests for an entity and give one example that passes two of them and fails the third.
- Why is a shared value such as an author's name a strong signal that an entity is needed?
- Give a construct that could legitimately be modelled as a relationship in one project and as an entity in another, and state what requirement would force the change.
- What is the difference between an entity with a single attribute and a weak entity?
- Why does the course recommend preferring the split when you are unsure?
Show the answers
- Tests: independent existence, identity, reuse. Example: a member's
Addresshas identity in a loose sense (you can point at a building) and is reused by billing and shipping, but it fails independent existence — delete the member and the address ceases to be part of the model. Verdict: attributes, unless the requirements make addresses shared objects. - Because a shared value forces duplication. If two books have the same author and the author's name is an attribute of
Book, the name appears twice and the two copies can disagree after a correction. Duplication is precisely what minimality forbids, and the only way to remove it is to give the shared thing its own identity — which is the definition of an entity. Appointment. As a relationship betweenPatientandDoctorit is minimal and correct while the requirements only say "who, with whom, when". The moment a requirement says "an appointment may be cancelled with a reason, and each cancellation must be visible to the receptionist", the appointment is referred to by another fact and needs its own life — it becomes an entity.- An entity with a single attribute is strong: its identifier is unique within the entity (a room number is unique in the building). A weak entity's identifier is not unique on its own and only becomes unique in combination with its owner's identifier (copy 3 of title X). The difference is identity, not the number of attributes.
- Because the costs are asymmetric. Merging two things that were wrongly split loses no information — you can always join. Splitting one thing that was wrongly merged destroys the information that distinguished the two, and it is not recoverable from the database. Given uncertainty, choose the error you can undo.
Exercise
Six candidates, three verdicts
A veterinary clinic's requirements register contains the following statements. For each, decide whether the bolded construct is an entity, an attribute (possibly multivalued), or a relationship, and justify the decision with the three tests. Two of the six are genuinely ambiguous: for those, state the requirement that would settle the question.
- Each animal treated by the clinic is registered with a name, a species, a breed and a date of birth.
- Each animal has one owner, who may own several animals.
- Owners may have several telephone numbers.
- A visit records the date, the attending vet and the reason for the visit.
- Each visit may produce prescriptions, each with a drug, a dose and a duration.
- The clinic works with three external laboratories, each with a name and an account code.
Show the commented solution
1. Animal — entity. Independent existence (the animal exists between visits), identity (the clinic refers to "the dog of Mrs Rossi", and animals can be distinguished), reuse (visits, prescriptions, vaccinations and weight history all refer to the animal). The four properties are attributes of the entity.
2. Owns — relationship. It is nothing but the connection between an owner and an animal: it has no attributes of its own and nothing refers to it. Cardinalities: (1,1) on the animal side ("each animal has one owner" — mandatory, exactly one) and (0,N) on the owner side ("may own several"). Note that Owner is an entity in its own right, because owners have properties and are reused by billing and by the relationship.
3. Telephone numbers — multivalued attribute of Owner. No properties of their own, never shared, nothing refers to them. The word "several" makes it multivalued, not an entity. Ambiguity point: if a requirement said "each number is labelled home, work or mobile, and the clinic must know which number was called", the numbers acquire properties and a PhoneNumber entity becomes justified.
4. Visit — entity. It has its own attributes (date, reason) that belong to neither the animal nor the vet, and it is referred to by other facts (prescriptions, invoices, follow-ups). The naive reading "a visit is the connection between an animal and a vet" fails because the visit has a reason and a date — its own life.
5. Prescription — entity, and this is the second ambiguity point. Two defensible readings:
- As a relationship
PrescribesbetweenVisitand aDrug, with attributesdoseandduration. Adequate if a prescription is nothing but "this drug, this dose, for this long, on this visit". - As an entity
Prescription, with attributesdose,duration,issued_at, and relationships toVisitandDrug. Required if a prescription has its own number, can be renewed, can be dispensed in part, or must be traced to a pharmacist.
What settles it: "does anything else refer to the prescription?" If the pharmacy module needs to record partial dispensing, the prescription has an identity and a life → entity. If not, the relationship is simpler and equally correct. Say which you chose and on what assumption.
6. Laboratory — entity. Independent existence, identity (name and account code), reuse (exams, invoices, contacts). Note the trap: "three" is a volume, not a structure. Writing lab1, lab2, lab3 as attributes of an exam would work until the clinic changes laboratory, which is exactly the sort of fix that costs a migration.
Summary of the six: entity, relationship, multivalued attribute, entity, entity-or-relationship, entity. The two ambiguous cases are 3 and 5, and in both the deciding question is the same one: does anything else in the domain refer to this construct?
Where to go next
- The previous lesson, on the model as a whole: Introduction to the Entity-Relationship Model.
- The property that every attribute carries and that is most often left out: Attributes and Domains.
- How attributes are recognised in a requirements text, in the previous module: Identifying Attributes and Relationships.
- Where these candidates come from in the requirements text: Identifying Candidate Entities.
- The same decisions applied to a complete, openable schema: Student and Course.