DBA > Job Interview Questions > RDBMS FUNDAMENTALS Interview Questions and Answers

RDBMS FUNDAMENTALS - INTERPRETING DATA - Relatio

More DBA job interview questions and answers at http://dba.fyicenter.com/Interview-Questions/

(Continued from previous question...)

RDBMS FUNDAMENTALS - INTERPRETING DATA - Relationships

Relationships : A relationship is an association between two entities.

Types of Relationships : Relationships are classified into three types based on the occurrence of the related entities. One-to-One(1-1), One-to-Many(1-M) & Many-to-Many(M-M).

Using E/R Diagram : A E/R diagram represent entities and relationships in a database system.

Reducing E/R Diagrams to Relations :
Mapping Entities : A dominant entity is mapped to a new relation. A weak entity is mapped to a new relation. The primary key of the corresponding dominant entity is included as the foreign key in the weak entity relation.
Supertypes and subtypes are mapped to separate relations. The primary key of the supertype becomes the primary key of the subtype.
Mapping Relationships : A 1-1 relationship is mapped using a foreign key. The primary key of either of the entities is include as a foreign key in the relation of the other entity. This relationship is rare, because data elements related in this way are normally placed in the same table.
A 1-M or M-1 is mapped by introducing a foreign key. A primary key is the ??one?? side of the relationship, and the foreign key is the ??many?? side of the relationship. This relationship are most common.
A M-M involves the creation of a new relation. M-M are problematic and cannot be adequately expressed directly in a relational db. It is expressed using intersection tables. An intersection table contains two (or more) foreign keys, relating the primary key values of two (or more) tables to each other. The role of an intersection table is to convert the M-M into two 1-M relationships that can be easily handled by the database.

(Continued on next question...)

Other Job Interview Questions