Week 3 Flashcards
What are the different ERD components?
- Entities: Corresponds to an entire table, not row and is represented by a rectangle
- Attributes: Correspond to columns in tables and are listed in rectangle (in entity)
- Relationships: Reflected by P.K and F.K pairs and are represented by lines among entities.
What are the 4 steps to creating an ERD?
- Identify entities through business rules
- Identify relationships among the entities
- Specify attributes within each entity
- Check/specify all the details (e.g. weak entity)
What is Connectivity?
Connectivity describes relationship classification (e.g. 1:1, 1:M, M:N)
What is Cardinality?
Cardinality expresses the number of entity occurrences associated with one occurrence of a related entity. (e.g. one employee can be associated with a maximum of two tablets)
What are the two different types of relationship participation?
- Optional participation: One entity occurrence does not require corresponding entity occurrence in particular relationship
- Mandatory participation: One entity occurrence requires corresponding entity occurrence in particular relationship.
What are the general rules for FK: 1:1 relationships?
The general rules for FK in 1:1 relationships are:
- Put the Foreign Key in the strong entity or in the most frequently accessed entity
- Or put foreign key in the entity selected by the semantics of the problem.
What are the general rules for FK: 1:M relationships?
Create the foreign key by putting the primary key of the “1” in the table of the “M”.
What are the general rules for FK: M:N relationships?
Convert the M:N relationship to a composite (bridge) entity consisting of (at least) the parent tables’ primary keys.
What is a composite entity?
Composite entities (aka bridge tables) are used to bridge between M:N relationships. They are composed of the primary keys of each entity needing connection. Normally contains additional attributes
What is a primary key?
A primary key is an essential attribute of each entity that is unique to the record within that entity.
What is the difference between a simple and a composite attribute?
Simple attribute: Can’t be subdivided (e.g. Age, Sex, Marital Status)
Composite Attribute: Can be subdivided into additional attributes (e.g. Address into street, city, zip)
What is the difference between a single-valued and multivalued attribute?
Single-valued attribute: Can only have a single value (e.g. person can only have one social security number)
Multivalued attribute: Can have many values (e.g. Person may have several college degrees)
How do you handle multivalued attributes?
If there is a multivalued attribute there are two options:
- Within the original entity, create several new attributes, one for each of the original multivalued attribute’s components.
- Create a new entity composed of the original multivalued attribute’s components
What are derived attributes?
Derived attributes are attributes that can be derived with an algorithm (computation) (e.g. age can be derived from date of birth). If the derived attribute is often queried upon, keep it in the table.