Strong and Weak Entities
A weak entity has no key of its own and can only be identified through an owner entity. It is drawn with a double rectangle, joined by an identifying relationship, and carries a partial key.
-
DBMS Fundamentals
- Data, Information and Databases
- What a DBMS Is and Why It Exists
- File System versus DBMS
- Advantages and Limitations of a DBMS
- Database Users and the Role of the DBA
- Three Level Architecture and Data Abstraction
- Logical and Physical Data Independence
- Schema, Instance and Metadata
- Database Applications and the Database System Environment
- Database Architecture
- Data Models
-
ER Model
- Entities, Entity Sets and Entity Types
- Types of Attributes in the ER Model
- Keys in the ER Model
- Relationships, Relationship Sets and Degree
- Cardinality and Participation Constraints
- Strong and Weak Entities
- Drawing and Reading ER Diagrams
- Extended ER: Generalisation, Specialisation and Aggregation
- Converting an ER Diagram into Relational Tables
- ER Design Projects
- Relational Model
- Relational Algebra
- Functional Dependencies
-
Normalisation
- Why Normalisation Exists: Anomalies and Redundancy
- First Normal Form
- Second Normal Form and Partial Dependency
- Third Normal Form and Transitive Dependency
- BCNF and BCNF Decomposition
- 4NF, 5NF, Multivalued and Join Dependencies
- Lossless Decomposition and Dependency Preservation
- Complete Worked Normalisation: Unnormalised to BCNF
- Denormalisation and When to Use It
Concept
| Strong entity | Weak entity | |
|---|---|---|
| Key | Has its own key attribute | Has no key of its own |
| Identified by | Itself | Its own partial key plus the owner key |
| Existence | Independent | Depends on the owner entity |
| Notation | Single rectangle | Double rectangle |
| Relationship | Ordinary, single diamond | Identifying, double diamond |
| Participation | Varies | Always total in the identifying relationship |
| Also called | Regular entity | Subordinate entity |
Notation
+------------+ +==============+
| EMPLOYEE |=====< HAS >=====|| DEPENDANT ||
+------------+ identifying +==============+
emp_id (double name (dashed
(underlined) diamond) underline =
PARTIAL KEY)
Read as: a dependant is identified by its name TOGETHER
WITH the employee id of the employee it belongs to.
Two employees may each have a dependant named Asha; the
pair (emp_id, name) still distinguishes them.
Full key of DEPENDANT = { emp_id, name }The three conditions
An entity type is weak when all three hold:
- It has no key attribute of its own that is unique across the whole entity set.
- It is existence dependent on an owner entity type — remove the owner and it is meaningless.
- Its identifying relationship has total participation on the weak side, and cardinality one to many from the owner.
Partial key
The partial key, also called the discriminator, distinguishes weak entities within one owner. It is drawn with a dashed underline. The full identifier is always the owner primary key plus the partial key.
Example
Three classic weak entities
1. DEPENDANT of an EMPLOYEE
partial key name
full key ( emp_id, name )
tables dependants ( emp_id, name, dob, relation )
primary key ( emp_id, name )
emp_id references employees ON DELETE CASCADE
2. ORDER LINE of an ORDER
partial key line_no
full key ( order_id, line_no )
line 1 of order 500 and line 1 of order 501 are
different things
3. ROOM of a BUILDING
partial key room_no
full key ( building_id, room_no )
room 101 exists in every building on campusConverting a weak entity to a table
- Create a table for the weak entity.
- Include its own attributes, including the partial key.
- Add the owner primary key as a foreign key.
- Make the primary key the combination of the owner key and the partial key.
- Set the foreign key
NOT NULL, because participation is total. - Use cascading delete, because the weak entity cannot outlive its owner.
-- Illustration only, to show the resulting shape.
-- dependants ( emp_id, name, dob, relationship )
-- PRIMARY KEY ( emp_id, name )
-- FOREIGN KEY ( emp_id ) REFERENCES employees ( emp_id )
-- ON DELETE CASCADEWeak entity or multivalued attribute?
Both become a separate table, so how do you choose?
- If the thing has only one value and no further detail, it is a multivalued attribute — a list of phone numbers.
- If it has several attributes of its own, it is a weak entity — a dependant has a name, a date of birth and a relationship.
Common mistakes
- Calling any entity with a foreign key weak. A student has a department foreign key and is perfectly strong, because roll_no identifies it alone.
- Giving the weak entity a primary key of its own. If it has one, it is not weak.
- Forgetting the owner key in the primary key. The partial key alone is not unique across the set.
- Using a single diamond for the identifying relationship. It must be a double diamond.
- Omitting cascading delete. Orphaned weak entities are meaningless rows.
Exam and interview questions
- Differentiate strong and weak entities on at least five points.
- State the three conditions that make an entity weak.
- What is a partial key and how is it drawn?
- Write the conversion steps from a weak entity to a table.
- When would you model something as a weak entity rather than a multivalued attribute?
Practice
- Identify the weak entity and its partial key: an ORDER and its ORDER LINES, a BUILDING and its ROOMS, a BANK and its ACCOUNTS.
- Explain in three sentences why a bank account is usually strong, not weak.
- Convert a HOTEL and its ROOMS into tables, stating both primary keys.
Conclusion
A weak entity has no key of its own, depends on an owner for existence, and is identified by the owner key plus its partial key. Double rectangle, double diamond, dashed underline, composite primary key and a cascading delete — that is the complete pattern.