You are on page 1of 20

Logical Database Design

Recall the following


• Attribute types
– Stored Attributes vs derived attributes [ age, annual salary]
– Atomic vs multi valued attributes [ more than one value eg. Skills]
– Composite attribute eg. Address [ box, town ], name [ first ,
Middle, surname]
• KEYs
– Primary key [unique, meaningful, available]
– Foreign key [ primary key of a table taken to another table for reference]
– Alternate key [access key]
– Composite key [a key made of more that one attribute]
– Secondary key [key used together with PK to retrieve data] eg. name
CADINALITY & DEGREE of relationship
• Degree [unary, binary, ternary] number of entities that participate
in a relationship
• Ternary relationship is beyond the scope.
• CARDINALITY constraint: specifies the number of instances of a
particular entity that can (or must) be associated with each instance
of the other entity.
• Minimum cardinality: minimum number of instances of one entity that may be associated with each
instance of another entity.
• Maximum cardinality: maximum number of instances of one entity that may be
associated with each instance of another entity
• Mandatory(at least 1) vs optional (0) {0..m, 0 & crow foot}
participation
• NOTE: in one-to-many relationship, the one side is considered
parent, many side is child side. Parent-to-child
ReM relational model
• Relation
Definition:
– A relation is a named, two-dimensional table of data
– Table is made up of rows (records), and columns (attribute
or field)
– Not all tables qualify as relations
Requirements:
– Every relation has a unique name.
– Every attribute value is atomic (not multivalued, not
composite)
– Every row is unique (can’t have two rows with exactly the
same values for all their fields)
– Attributes (columns) in tables have unique names
– The order of the columns is irrelevant
– The order of the rows is irrelevant
Correspondence with ER Model

• Relations (tables) correspond with entity


types and
• with many-to-many relationship types, Rows
correspond with entity instances and with
many to-many relationship instances
• Columns correspond with attributes
What is Logical Design
• It is a process of transforming the conceptual
data model into a logical data model – one
which is consistent and compatible to a type
of database technology [ relational, network,
hierarchical]
• An experienced database designers often do
logical design in parallel with conceptual data
modeling they know the type of technology.
LOGICAL DATABASE MODEL
Steps Involved
1. Map regular Entities
2. Map weak entities
3. Map binary relationships
4. Map Associative Entities
5. Map Unary relationships
6. Map ternary relationships
7. Map super-type/ sub-type relationships
Map regular Entities
1. Simple attributes: E-R attributes map directly
onto the relation
2. Composite attributes: Use only their simple,
component attributes
3. Multi-valued Attribute - Becomes a separate
relation with a foreign key taken from the
superior entity
composite
Multi valued attribute

Multi valued attribute is taken to another relation; primary key is composite primary
key of the original table and the multi value attribute (EmployeeID, skill)
Map weak entities
• Weak entity Becomes a separate relation with a
foreign key taken from the superior entity
• Primary key composed of:
– Partial identifier of weak entity
– Primary key of identifying relation (strong entity)
Mapping weak entity
Mapping Binary Relationships
– One-to-Many - Primary key on the one side
becomes a foreign key on the many side
– Many-to-Many - Create a new relation with
the primary keys of the two entities as its
primary key
– One-to-One - Primary key on the mandatory
side becomes a foreign key on the optional side
Mapping one to many
Mapping Many to Many relationship
Mapping one to one relationship
Mapping Associative Entities
– Identifier Not Assigned
• Default primary key for the association
relation is composed of the primary keys of
the two entities (as in M:N relationship)
– Identifier Assigned
 It is natural and familiar to end-users
 Default identifier may not be unique
Logical Relational model
• The logical model of the database will
represent all relations and their attributes
including the interconnection between them.
• The model will also indicate different types of
keys so that they can easily converted into a
working model.

You might also like