Logical Data Model & Normalisation Flashcards
Week 2.2 (27 cards)
what does translating the conceptual model into a logic model involve
- translating ER diagrams
- normalising these relations
what are the 7 relationships that can be derived
- strong entity
- weak entity
- one-to-many (1:*)
- one-to-one (1:1)
- one-to-one recursive (1:1 recursive)
- many-to-many (:)
- complex relationships
what is a strong entity & how to derive it
- create a relation that includes all the simple attributes of that entity
- primary key of the relation is the primary key of the entity
what is a weak entity & how do you derive it
- create a relation that includes all simple attributes
- primary key is partially or fully derived from each owner entity after all relationships with the owner entities have been mapped
what is a 1:* relationship
the entity on the ‘one side’ is designated as the parent entity and the entity on the ‘many side’ is designated as the child entity
how to represent a 1:* relationship
a copy of the primary key attribute(s) of the parent entity is placed in the relation for the child as a foreign key
why is a 1:1 relationship complex
cardinality cannot be used to identify the parent and child entities in a relationship
what are used to define how 1:1 cases are implemented
participation constraints
what are the 3 participation constraints of 1:1 and 1:1 recursive relationships
- mandatory participation on both sides
- mandatory participation on one side
- optional participation on both sides
how are mandatory participation on both sides represented in a 1:1 relationship
combine entities into one relation and choose one of the primary keys of the original entities to be primary key and the other (if exists) as an alternate key
how is mandatory participation on one side represented in a 1:1 relationship
entity with optional participation is designated as parent entity, and entity with mandatory participation is designated as child entity. a copy of primary key of the parent entity is placed in the relation for the child entity as the foreign key.
how is optional participation on both sides represented in a 1:1 relationship
arbitrary designation of the parent and child entities unless we can find out more about the relationship that can help a decision to be made one way or another
how is mandatory participation on both sides represented in a 1:1 recursive relationship
represent the recursive relationship as a single relation with two copies of the primary key. one copy represents a foreign key and should be renamed to indicate the relationship it represents
how is mandatory participation on one side represented in a 1:1 recursive relationship
either a single relation with two copies of the primary key (like mobs) or create a new relation to represent the relationship. this relation would have only two attributes which are both copies of the primary key with one renamed to act as a foreign key.
how is optional participation on both sides represented in a 1:1 recursive relationship
create a single relation with two copies of the primary (like mobs)
how is a : relationship represented
- create a relation for the relationship with all attributes of the relationship, with a copy of the primary key of the participating entities as foreign keys
these foreign keys will also form the primary key of the new relation
how are complex relationships represented
- create a relation to represent the relationship. Copy the primary key of the participating entities as foreign keys
- any foreign keys that represent a ‘many’ relationship generally will also form the primary key of this new relation
what 3 things does normalisation produce
- minimal number of attributes necessary to support the data requirements
- attributes with a close logical relationship placed in the same relation
- minimal redundancy, with each attribute represented only once, except those forms all or part of foreign keys
what are the 3 normal forms
- 1NF
- 2NF
- 3NF
what is 1NF
a relation is in 1NF when intersection of each row and column contains one value only
- atomicity
what is a relating group
a column containing multiple values for a row
what 2 ways do we deal with repeating groups
- place each value in a new row and fill in the other columns with the nonrepeating data
OR - place the repeating data in a separate relation together with a copy of the key attribute
what is 2NF
- if the primary key of a relation consists of a single attribute, it is automatically in at least 2NF
- a relation in 2NF is a relation that is in 1NF and every non-primary key attribute is fully functionally dependent on the primary key
- removal of partial dependencies - when a non-primary key attribute is dependent on only part of a primary key
how do we remove partial dependencies
if they exist - remove the partially dependent attributes from the relation and place them in a new relation with a copy of the primary key attribute they are dependent on. primary key attribute is called their determinant