80

I've tried to look on Google about a decent explanation of weak and strong entity type, but I haven't fully understood them.

Could someone give me an example of a strong and weak entity type?

nbro
  • 15,395
  • 32
  • 113
  • 196
learner123
  • 961
  • 1
  • 10
  • 16

12 Answers12

140

A weak entity is one that can only exist when owned by another one. For example: a ROOM can only exist in a BUILDING. On the other hand, a TIRE might be considered as a strong entity because it also can exist without being attached to a CAR.

Heniam
  • 68
  • 16
Paul
  • 2,972
  • 2
  • 21
  • 16
  • 19
    I don't understand why this is accepted, it's simply wrong. What @Paul describes should be modelled by using an existence dependency. The definition of Chen in his 1976 paper is that an entity set is weak if its entities can not be uniquely identified on the values of its own attributes, and must rely on the (key) attributes of a related entity set. That another entity must exist and own the weak entity is only a logical implication of this definition, but not the other way around. A correct example of weak entities to add ordered numbers to an entity (i.e. answer number for a question). – RDM Oct 11 '18 at 13:29
  • If you're creating a table for Room and a Building.. then a room can exist without a building right ? I find it hard to understand the analogy. – Sushan Shakya Aug 19 '22 at 09:20
56

Just to play with it, question is strong entity type and answer is weak. Question is always there, but an answer requires a question to exist.

Example: Don't ask 'Why?' if Your Dad's a Chemistry Professor

shanethehat
  • 15,460
  • 11
  • 57
  • 87
Faheem
  • 3,429
  • 19
  • 26
  • 3
    This is wrong, you could make answer both strong and weak. The difference is that is answer is weak, you can use the same numbering for each question (answer 1, 2, 3, ...), but if it is strong, a single numbering must be applied for all answers. This is because if you make answer weak, you choose to rely on questionid to create the (composite) primary key of answer. Reflecting that an answer requires a question to exist is done by ensuring there is an existence dependency (total participation of answer in the identifying relation to question). This can be done for answer even if it's strong. – RDM Oct 11 '18 at 14:03
  • Thank you @Warkst for clarifying. I was going for a more generic/everyday life case. – Faheem Dec 06 '18 at 18:29
33

A weak entity is the entity which can't be fully identified by its own attributes and takes the foreign key as an attribute (generally it takes the primary key of the entity it is related to) in conjunction.

Examples

The existence of rooms is entirely dependent on the existence of a hotel. So room can be seen as the weak entity of the hotel.
Another example is the
bank account of a particular bank has no existence if the bank doesn't exist anymore.

Vijay
  • 213
  • 1
  • 9
utkarsh_shah
  • 339
  • 3
  • 3
  • 1
    Your explanation of what's a weak entity is probably the best one here, but you're not explaining what's a strong entity and what's the difference between the two types. – nbro Mar 21 '16 at 15:40
  • @nbro, this is the correct definition of a weak entity set. A strong entity set is simply the opposite, i.e.: an entity set whose entities can be uniquely identified based on the values of the attributes of the entity set itself. The difference is that you need to add attributes to a weak entity set in order to be able to identify each entity uniquely, either by adding a surrogate key (in which case it becomes a strong entity) or by adding a foreign key to another (or multiple other) entity set(s) (making it weak and the other entity set(s) its identifier(s)). – RDM Oct 11 '18 at 13:33
  • How would you make tables for it ? Can you give me the schema ? – Sushan Shakya Aug 19 '22 at 09:21
23

A company insurance policy insures an employee and any dependents, the DEPENDENT cannot exist without the EMPLOYEE; that is, a person cannot get insurance coverage as a dependent unless the person is a dependent of an employee.DEPENDENT is the weak entity in the relationship "EMPLOYEE has DEPENDENT"

Sergey K.
  • 24,894
  • 13
  • 106
  • 174
Carol
  • 239
  • 2
  • 2
12

Strong entity

It can exist without any other entity.

Example

Customer(customerid, name, surname)

Weak entity

It depends on a dominant entity, and it cannot exist without a strong entity.

Example

Address(addressid, addressName, customerid)
Amal K
  • 4,359
  • 2
  • 22
  • 44
Metin Zontul
  • 121
  • 1
  • 3
  • 9
    Explain why `Customer` and `Address` are respectively a strong and a weak entity. – nbro Mar 21 '16 at 15:23
  • Address holding customerId as FK which means address corresponds only to particular customerId. Address entity will move to complete useless state without any customer. Once customer entity is added then the value gets added in Address. Correct me if am wrong. – Yogi Apr 05 '17 at 07:25
  • 4
    This is a bad example. An address can exist without an attached customer entity. A better example is an apartment with a building - the apartment cannot physically exist without a building. Your example is more along the lines of 'tire' & 'car'. While the tire is probably associated a with a car, it does not have to be. – Matthew Jan 27 '19 at 14:18
4

Weak entity exists to solve the multi-valued attributes problem.

There are two types of multi-valued attributes. One is the simply many values for an objects such as a "hobby" as an attribute for a student. The student can have many different hobbies. If we leave the hobbies in the student entity set, "hobby" would not be unique any more. We create a separate entity set as hobby. Then we link the hobby and the student as we need. The hobby entity set is now an associative entity set. As to whether it is weak or not, we need to check whether each entity has enough unique identifiers to identify it. In many opinion, a hobby name can be enough to identify it.

The other type of multi-valued attribute problem does need a weak entity to fix it. Let's say an item entity set in a grocery inventory system. Is the item a category item or the actually item? It is an important question, because a customer can buy the same item at one time and at a certain amount, but he can also buy the same item at a different time with a different amount. Can you see it the same item but of different objects. The item now is a multi-valued attribute. We solve it by first separate the category item with the actual item. The two are now different entity sets. Category item has descriptive attributes of the item, just like the item you usually think of. Actual item can not have descriptive attributes any more because we can not have redundant problem. Actual item can only have date time and amount of the item. You can link them as you need. Now, let's talk about whether one is a weak entity of the other. The descriptive attributes are more than enough to identify each entity in the category item entity set. The actual item only has date time and amount. Even if we pull out all the attributes in a record, we still cannot identify the entity. Think about it is just time and amount. The actual item entity set is a weak entity set. We identify each entity in the set with the help of duplicate prime key from the category item entity set.

4

./Database/DataModels/RelationalDataModel/WeakEntity

It probably can be written in two factors:

  • DEPENDENCE: Depends on the existence of an identifying entity set (total, one-to-many relationship).
  • IDENTIFICATION: Does not have a primary key. It has a partial key (or discriminator). It needs to use the primary key of another table for identification.

If we would think of a database holding questions and answers, then the questions would be the strong entity and the answers would be the weak entity. So, Question (id, text) and Answer (number, question_id, text) would be our tables. But why is the Answer's table a weak entity?

  • Dependence to the question table. Every answer is connected to one question (assumption) and so it cannot be on its own. That is why we have people who ask one question and answer it themselves so that they can help other people and get some extra likings.

  • Identification from the primary key of the question. One would not be able to identify an answer (assuming that its id is a number identifier) because a question might be answered by answers whose identifier might exist in other questions too. Primary key of the answer table: (number, question_id).

Bugs
  • 4,491
  • 9
  • 32
  • 41
Doren
  • 139
  • 1
  • 6
3

Weak entities are also called dependent entities, since it's existence depends on other entities. Such entities are represented by a double outline rectangle in the E-R diagram.

Strong entities are also called independent entities.

nbro
  • 15,395
  • 32
  • 113
  • 196
arya
  • 39
  • 1
1

After browsing search engines for a few hours I came across a site with a great ERD example here: http://www.exploredatabase.com/2016/07/description-about-weak-entity-sets-in-DBMS.html

I've recreated the ERD. Unfortunately they did not specify the primary key of the weak entity.

enter image description here

If the building could only have one and only one apartment, then it seems the partial discriminator room number would not be created (i.e. discarded).

gimmegimme
  • 331
  • 7
  • 20
  • 1
    The apartment is a weak entity because it cannot exist without the existence of its Identifying Owner, the Building entity. Weak entities are not given primary keys. Instead, the partial identifier, denoted by the dashed line under DoorNo (Door number) attribute, is combined with the BNo. primary key attribute from the Buliding entity to form a unique identification for each apartment instance. – Matthew Jan 27 '19 at 14:15
-2

Weak Entity Type: An entity whose instances cannot exits without being linked with instances of some other entity is called weak entity type. It cannot exist independently. For example: Our PC is depend on us it will not open or close with its own.

Strong Entity Type: An entity whose linked to the instances of any other entity type is called strong entity type. It can exit independently. For example: A person can do every thing can go everywhere and use ever thing

-4

A data object that can exist without depending upon the existence of another data object is known as Strong Data Object.

-6

First Strong/Weak Reference types are introduced in ARC. In Non ARC assign/retain are being used. A strong reference means that you want to "own" the object you are referencing with this property/variable. The compiler will take care that any object that you assign to this property will not be destroyed as long as you points to it with a strong reference. Only once you set the property to nil, the object get destroyed.

A weak reference means you signify that you don't want to have control over the object's lifetime or don't want to "own" object. The object you are referencing weakly only lives on because at least one other object holds a strong reference to it. Once that is no longer the case, the object gets destroyed and your weak property will automatically get set to nil. The most frequent use cases of weak references in iOS are for IBOutlets, Delegates etc.

For more info Refer : http://www.informit.com/articles/article.aspx?p=1856389&seqNum=5