Friday, 23 October 2020

Tabular Representation of Strong Entity, Weak Entity and Relationship Sets in DBMS

 

Tabular Representation of Strong Entity Sets:

 

Let ‘E’ be a strong entity set with descriptive attributes a1, a2 . . . an. We represent this entity by a table called E with ‘n’ distinct columns, each of which corresponds to one of the attributes of E. Each row in this table corresponds to one entity of the entity set E.

 

For ex: consider the entity set loan of the E-R diagram. It has two attributes: loan-number and amount. We represent this entity set by a table called loan, with two columns, as in below fig. We can add a new entity to the database by inserting a row into a table. We can also delete or modify rows.

 

Let D1 denote the set of all loan numbers, and let D2 denote the set of all balances. Any row of the loan table must consist of a 2-tuple (v1, v2), where v1 is a loan (that is, v1 is in set D1) and v2 is an amount (that is, v2 is in set D2). In general, the loan table will contain only a subset of the set of all possible rows.

 

We refer to the set of all possible rows of loan as the Cartesian product of D1 and D2, denoted by: D1 × D2

 

In general, if we have a table of ‘n’ columns, we denote the Cartesian product of D1, D2, · · ·Dn by: D1 × D2 × · · · × Dn−1 × Dn


Loan Table

Fig: Loan Table


Customer Table

Fig: Customer Table

Consider another ex. of entity set customer having attributes customer-id, customer-name, customer-street, and customer-city. The table corresponding to the customer has four columns, as shown in above fig.


Tabular Representation of Weak Entity Sets:

 

Let ‘A’ be a weak entity set with attributes a1, a2 . . . , am. Let ‘B’ be the strong entity set on which ‘A’ depends. Let the primary key of ‘B’ consist of attributes b1, b2 . . . bn. We represent the entity set ‘A’ by a table called ‘A’ with one column for each attribute of the set: {a1, a2 . . . am} {b1, b2 . . . bn}

 

For ex: consider the entity set payment in the E-R diagram. This entity set has three attributes: payment-number, payment-date, and payment-amount. The primary key of the loan entity set, on which payment depends, is loan-number. Thus, we represent payment by a table with four columns labeled loan-number, payment-number, payment-date, and payment-amount, as shown in below fig.


Payment Table

Fig: Payment table


Tabular Representation of Relationship Sets:

 

Let ‘R’ be a relationship set, let a1, a2 . . . am be the set of attributes formed by the union of the primary keys of each of the entity sets participating in ‘R’, and let the descriptive attributes (if any) of ‘R’ be b1, b2 . . .  bn. We represent this relationship set by a table called ‘R’ with one column for each attribute of the set:

{a1, a2 . . . am} {b1, b2 . . .  bn}

 

Consider the relationship set borrower in the E-R diagram. This relationship set involves the following two entity sets:

• customer, with the primary key customer-id

• loan, with the primary key loan-number

Since the relationship set has no attributes, the borrower table has two columns, labeled customer-id and loan-number, as shown in following fig.

Borrower Table

Fig: Borrower table

No comments:

Post a Comment