Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
What is a weak entity
3.
Symbols Used in a Weak Entity Set
4.
Representation of Weak Entity Set
5.
Examples of Weak Entity Set
6.
Differences Between Strong Entity Set and Weak Entity Set
7.
Frequently Asked Questions
7.1.
What are the restrictions applicable to a weak entity?
7.2.
Can foreign keys be included in a weak entity?
7.3.
How weak entity can be converted into a strong entity?
7.4.
Can weak entities have more than one relationship?
8.
Conclusion
Last Updated: Mar 27, 2024
Easy

Weak Entity in DBMS

Author Urwashi Priya
1 upvote
Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Speaker
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM
weak entity

Introduction

Before directly discussing what is a weak entity, let us first get familiar with its roots.

Any facts in the form of text, number, images, etc. that can be recorded are referred to as data, and the collection of such data related to each other are referred to as database and the software managing the database is called Database management system. 

pictorial representation of data, database and database management system.

These data represent real-world objects categorised as entities in technical terms. Now let us focus on our topic of what is a weak entity.

Must Recommended Topic, Generalization in DBMS

What is a weak entity

Before understanding what is a weak entity, we must know that entities are generally of 2 types: strong entity and weak entity.

Now we will be discussing what is a weak entity.

Generally, in any entity type, we will have lots of entities. For example, if we take an entity type, say, employee, we will have many employees. Now the question arises of how we can distinguish one employee from another employee. So, just to answer that, we would have a uniqueness constraint. Actually, we are doing to have some special attributes called key attributes. Say, for example, here is the employee number.

weak entity

Next the question arises is how to identify the key attributes? 

So, this is from requirement analysis; whenever we talk to the users, we say that we have these many employees, and out of all these employees, we will give them some identity cards. Every identity card will have a unique number to identify them. Once we fix the key attribute, we must always check while inserting a new entity that this key attribute value should always be unique.

Sometimes, more than one attribute qualify to become a key attribute. For example, engine number, registration number and manufacturer number can be key attributes in a car. As a database engineer, one has the liberty to choose any one of these attributes as key attributes. 

But the problem arises when no attributes qualify to become a key attribute. Say, for example, dependent of employees, here all dependents can’t be assigned with some employee id.

example of weak entity

Here employees can be easily identified uniquely using employee IDs but dependent does not have any key attributes. Say, the attributes present in dependent are name, age and relation. So, there exist the possibility that the same name, age and relation may reappear. Such an entity which do not consist of key attributes is referred to as a weak entity. And if the entity has key attributes, it is referred to as a strong entity. Here dependent is an example of a weak entity, and employee is an example of a strong entity. Hence we have got the answer to our question of what is a weak entity.

Now to overcome this problem of uniqueness, every weak entity has to be related to strong entity through a relationship. This relationship is called an identifying relationship. This relationship is mandatory for the existence of a weak entity.

identifying strong and weak entity relationshipi

ER diagram for a weak entity can be represented as:

ER diagram

Must Recommended Topic, Schema in DBMS

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Symbols Used in a Weak Entity Set

Here, we will see all the symbols which are used in a weak entity set.

  • A weak entity set is depicted as a double rectangle.
  • The relationship that occurs between the strong and weak entity sets is known as the identifying relationship, and a double diamond symbol represents it.
  • To illustrate the link between the relationship set and the weak entity set, a double line is employed.

Representation of Weak Entity Set

As we are already aware that a weak entity set is depicted as a double rectangle, the relationship that occurs between the strong and weak entity sets is known as the identifying relationship, and a double diamond symbol represents it. And a double line is employed to depict the link between the relationships. Now let us see the representation using the diagram.

representation of weak entity set

Examples of Weak Entity Set

Let us see some examples of a weak entity set. 

  • Consider that there are two entities: a subject and a student. In this case, the subject is a weak entity, whereas the student is a strong one. A student has a phone number, name, and id. Name, issue date, and author are properties of the subject. The entity student's key attribute, in this case, is id, and the entity subject's key attribute names. Although all subject entities are associated with at least one student entity, not all student entities may be related to every topic entity.
  • Consider the owner and the flat as two separate entities. The owner is a strong entity in this situation, while the flat is a weak entity. The owner has a phone number, name, and id. Number, color, and address are characteristics of the flat. The entity owner's key attribute, in this case, is id, and the entity apartment's key attribute is number. Regardless of whether one or more flat entities are associated with one or more owner entities, all owner entities are related to one or more flat entities.
  • The teachers at the schools rely on the school's continued existence. Teachers may therefore be the weak entity of the school.
  • A weak entity is a set of bikes with qualities like color and name since two bikes can share the same properties with regard to both color and name. However, the entity set is weak since none of the properties can be used as a primary key.

Differences Between Strong Entity Set and Weak Entity Set

Strong entity set Weak entity set
A strong entity is depicted using a single rectangle.  A weak entity set is depicted using a double rectangle.
A strong entity set is not dependent on the existence weak entity set. A weak entity set is dependent on a strong entity set. 
A strong entity has a primary key. A weak entity has a partial discriminator key.
One diamond is used to depict the connection between two strong entities. A double diamond is used to depict the connection between two weak entities.
A strong entity might not gain total participation. A weak entity always has total participation.

You can also read about Aggregation in DBMS here.

Frequently Asked Questions

What are the restrictions applicable to a weak entity?

Restrictions on the weak entity are:

Total participation constraint and partial keys.

Can foreign keys be included in a weak entity?

A weak entity uses a foreign key to form a relationship with a strong entity. A weak entity does not consist of primary keys.

How weak entity can be converted into a strong entity?

A weak entity can be easily converted to a strong entity by adding a primary key or key attribute, which can define the uniqueness constraint.

Can weak entities have more than one relationship?

Yes, weak entities can obviously have more than one relationship but having one identifying relationship is a must.

Conclusion

We have clearly discussed about what is a weak entity. Along with a clear understanding of what is a weak entity, we also covered some frequently asked questions.

Recommended Readings:

Attributes in DBMS

After reading about what is a weak entity, are you not feeling excited to read/explore more articles on Database management System? Don't worry; Coding Ninjas has you covered. See DBMS guided path to learn.

Do upvote our blogs if you find them helpful and engaging!

Happy Learning!

Live masterclass