Entity in DBMS can be a real-world object with an existence, For example, in a College database, the entities can be Professor, Students, Courses, etc.
Entities has attributes, which can be considered as properties describing it, for example, for Professor entity, the attributes are Professor_Name, Professor_Address, Professor_Salary, etc. The attribute value gets stored in the database.
Let us see an example −
<Professor>
Professor_ID | Professor_Name | Professor_City | Professor_Salary |
P01 | Tom | Sydney | $7000 |
P02 | David | Brisbane | $4500 |
P03 | Mark | Perth | $5000 |
Here, Professor_Name, Professor _Address and Professor _Salary are attributes.
Professor_ID is the primary key
The following are the types of entities in DBMS −
The strong entity has a primary key. Weak entities are dependent on strong entity. Its existence is not dependent on any other entity.
Strong Entity is represented by a single rectangle −
Continuing our previous example, Professor is a strong entity here, and the primary key is Professor_ID.
The weak entity in DBMS do not have a primary key and are dependent on the parent entity. It mainly depends on other entities.
Weak Entity is represented by double rectangle −
Continuing our previous example, Professor is a strong entity, and the primary key is Professor_ID. However, another entity is Professor_Dependents, which is our Weak Entity.
<Professor_Dependents>
Name | DOB | Relation |
This is a weak entity since its existence is dependent on another entity Professor, which we saw above. A Professor has Dependents.
The example of strong and weak entity can be understood by the below figure.
The Strong Entity is Professor, whereas Dependent is a Weak Entity.
ID is the primary key (represented with a line) and Name in Dependent entity is called Partial Key (represented with a dotted line).