ER Example with MySQL Workbench Flashcards
What is an identifier or key?
Fully identifies an instance
What is a Partial Identifier?
Identifies an instance in conjunction with one or more partial identifiers
What are the attributes types?
- Mandatory - NOT NULL (blue diamond)
- Optional - NULL (empty diamond)
- [Derived] - e.g [YearsEmployed]
- {Multivalued} - e.g {Skill}
- Composite - e.g Name (First, Middle, Last)
What is the definition of derived attributes?
Derived attributes imply that their values can be derived from some other attributes in the database.
Example: anything calculable - [Years employed]
What are the types of relationship cardinality?
- One to One: Each entity will have exactly {0 or 1} related entity
- One to Many: One of the entities will have {0, 1, or more} related entities, the other will have {0 or 1}
- Many to Many: Each of the entities will have {0, 1, or more} related entities
What is auto_increment?
tells mySQL to add one
What is ON Delete Restrict?
What is ON UPDATE CASCADE?
How to deal with Many-to-Many?
Based on business rules
- Depends if the business wants one email or multiple like amazon
What is the rule for dealing with One-to-One (Binary)
Rule: move the key from the one side to the other side
How to design unary relationships One to One?
Put a Foreign key in the relation
How to design Unary relationships One-to-Many
Put a Foreign key in the relation
How to design Unary relationships Many-to-Many?
- Generate an Associative Entity
- Put two Foreign keys in the Associative Entity
- Need 2 different names for the Foreign keys
- Both Foreign keys become the combined key of the Associative Entity
What is the definition of ternary relationships?
Relationships between three entities
- Generate an Associative Entity - Three One-to-Many relationships - Same rules then apply as One-to-Many