HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Why do we need weak entity

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
whyweakentityneed

Problem

As the title said, since we can convert any weak entity set to a strong one by adding the appropriate attributes, then why do we need weak entity sets?

Solution

In logical modelling one tends to record the natural keys to entity types. These will often require the "parent" and hence weak entity types are documented. Consequently they can show the scope of re-use of particular values. Take the cannonical Customer-Order-Order Line-Product example. Although the Order will have Customer Number as a foreign key it is usual for Order Numbers to be globally unique so Order is a strong entity. Often each Order's line numbers will start again at 1. By making Order Line weak we document this possibility more transparently.

In physical design we may choose to implement "weak" tables to reduce the number of joins in some queries. Continuing the example, if we make Customer Number part of the key to Order and also to Order Line then a query to count how many widgets the Jones Trading Company has ordered need only touch one table. Needless to say this involves costs in other areas and should be weighed carefully before implementation.

Context

StackExchange Database Administrators Q#115745, answer score: 3

Revisions (0)

No revisions yet.