Chapter 2 Flashcards
What is an entity?
- Entity instance - person, place, object, event, concept (often corresponds to a row in a table)
- Entity type - collection of entitities (often corresponds to a table)
What are relationships?
Relationship instance - link between entities (corresponds to primary key-foreign key equivaltencies in related tables)
Relationsihp type - category of relationship.. link between entity types
What are attributes?
Properties or characteristics of an entity or relationship type (often corresponds to a field in a table)
Sample E-R Diagram
Basic E-R notation (visualized)
What are business rules?
Statements that define or constrain some aspect of the business.
What are business rules derived from?
Policies, procedures, events, and functions
What are some aspects of business rules?
- Assert business structure
- Control/influence business behavior
How are business rules expressed/automated?
- They are expressed in terms that are familiar to end users
- Automated through DBMS software
What are the components of a good business rule?
- Declarative
- Precise
- Atomic
- Consistent
- Expressable
- Distinct
- Business-oriented
Business Rules - What does declarative mean?
What, not how
Business Rules - What does precise mean?
Clear, agreed-upon meaning
Business rules - What does atomic mean?
One statement
Business rules - What does consistent mean?
internally and externally consistent
Business Rules - What does expressible mean?
Structured, natural language
Business Rules - What does distinct mean?
non-redundant
Business Rules - What does business-oriented mean?
Understood by business people
What are the components of a good data name?
- Related to business, not technical, characteristics
- Meaningful and self-documenting
- Unique
- Readable
- Composed of words from an approved list
- Repeatable
- Written in standard syntax
What is a data definition?
Explanation of a term or fact
What is a term?
word or phrase with specific meaning
What is a fact?
association between two or more terms
What are the guidelines for good data definition?
- Concise description of essential data meaning
- Gathered in conjunction with systems requirements
- Accompanied by diagrams
- Achieved by consensus, and iteratively refined
What is an entity?
a person, place, object, event, or concept in the user environment about which the organization wishes to maintain data
What is an entity type?
A collection of entities that share common properties or characteristics.
What is an entity instance?
A single occurrence of an entity type
Entity type/instance example
What should be an entity?
- An object that will have many instances in the database
- An object that will be composed of multiple attributes
- An object that we are trying to model
What should an entity not be?
- A user of the database system
- An output of the database system (e.g. a report)
Example of Appropriate/Innappropriate entities
What are characteristics of a strong entity?
- Exists independently of other types of entities
- Has it’s own unique identifier (identifiter underline with single line)
What are the characteristics of a weak entity?
- Dependent on a strong entity (identifying owner), cannot exists on its own
- Does not have a unique identifier (only a partial identifier)
- Entity box and partial identifier have double lines
What is an identifying relationship in relation to entities?
- Links strong entities to weak entities
Stong vs. Weak entity visualized
What are the guidelines for naming entities?
- Singular Noun
- Specific to organization
- Concise, or abbreviation
- For event entities, the result not the process
- Name consistent for all diagrams
What are the guidelines for defining entities?
- “an X is”
- Describe unique characteristics of each instance
- Explicit about what is and is not the entity
- When an instance is created or destroyed
- Changes to other entity types
- History that should be kept
What is an attribute?
Property or characteristic of an entity or relationship type
What are the classifications of attributes?
- Required vs Optional
- Simple vs Composite
- Single-valued vs Multivalued
- Stored vs Derived
- Identifier
Example of Required vs Optional Attributes
What is a required attribute?
Must have a value for every entitiy (or relationship) instance with which it is associated
What is an optional attribute?
May not have a value for every entity (or relationship) instance with which it is associated.
What is a composite attribute?
An attribute that has meaningful component parts (attributes)
Composite attribute (example)
What is a multivalued attribute?
May take on more than one value for a given entity (or relationship) instance
What is a derived attribute?
Values can be calculated from related attribute values (not physically stored in the database)
Multivalued and Derived attribute example
What is an identifier (Key)?
An attribute (or combination of attributes) that uniquely identifies individual instances of an entity type
What are the two types of identifiers?
- Simple
- Composite
What is a candidate identifier?
An attribute that could be an identifier (satisfies the requirements for being an identifier)
What are two criteria for choosing identifiers?
- Will not change in value
- Will not be null
What should you avoid in identifiers?
- Intelligent identifiers (containing locations or people that might changed, basically information that might change)
What should you do for long composite keys?
Substitute new simple keys
Simple and Composite Identifier example
What requirements are there when naming attributes?
- Name should be a singular noun or noun phrase
- Name should be unique
- Name should follow a standard format
- Similar attributes of different entity types should use the same qualifiers and classes
What are the requirements when defining attributes?
- State what the attribute is and possibly why it is important
- Make it clear what is and is not included in the attribute’s value
- Include aliases in documentation
- State source of values
- State whether attribute value can change once set
- Specify required vs. optional
- State min and max number of occurences allowed
- Indicate relationships with other attributes
What is the difference between relationship types and relationship instances?
- Relationship type is modeled as lines between entity types
- Relationship Instance is between specific entity instances
What is the difference between relationship types and relationship instances?
- Relationship types are modeled as lines between specific entity types
- Relationship instances are between specific entity instances
Can relationships have attributes?
- Yes, these describe features pertaining to the associations between the entities in the relationship.
Can entities have more than one relationship between them?
- Yes, these are call multiple relationships
What is an associative entity?
Combination of relationship and entity
Relationship types and instance visualized
What is the degree of a relationship?
The number of entity types that participate in it
What are the three types of relationships?
- Unary
- Binary
- Ternary
Relationship degrees visualized
What are the cardinality of relationships?
- One-to-one
- One-to-many
- Many-to-Many
What is a one-to-one relationship cardinality?
Each entity in the relationship will have exactly one related entity
What is a one-to-many relationship cardinality?
- An entity on one side of the relationship can have many related entities, but an entity on the other side will have a maximum of one related entity
What is a many-to-many relationship cardinality?
Entities on both sides of the relationship can have many related entities on the other side
Unary relationship examples
Binary relationship example
Ternary relationship example
What are cardinality Constraints?
The number of instances of one entity that can or must be associated with each instance of another entity.
What are the minimum cardinalities?
- If zero, then optional
- If one or more, then mandatory
What is the maximum cardianality?
The maximum number
Example of cardinality constraints
Examples of cardinality constraints, optional and mandatory
Examples of cardinality constraints, all optional
Examples of mulitple relationships
Example of multiple relationships, fixed lower limit constraint
Simple and Composite attributes shown as relationships
What does an entity have?
Attributes
What does a relationship do?
Links Entities together
When should a relationship with attributes instead be an associative entity?
- When all relationships for the associative entity should be many
- When the associative entity could have meaning independent of the other entitiies
- When the associative entity preferably has a unique identifier, and should also have other attributes
- The associative entity may participate in other relationships other than th entities of the associated relationship
- Ternary relationships should be converted to associative entities
Binary relationship with an attribute example
What is an associative entity similar to?
A relationship with an attribute.
Associative entity example
Good example of ternary relationship and business rules
What is a time stamp?
a time value that is associated with a data value, often indicating when some event occured that affected the data value