4. Database Design and the E-R Model Flashcards
What’s the point of the design process?
- Need to meet the aims of the enterprise
- Specification of user requirements
- Interaction with domain experts required
What are the 3 main phases of the design process?
- Conceptual design phase (ER diagram)
- Logical design phase (map ER to Relational / OO / …)
- Physical design phase (file organisation, indexing, …)
How can a database be modelled relative to entities?
A database can be modelled as a collection of entities, with relationships among entities
What is an entity?
An object that exists and is distinguishable from other objects
e.g specific person
What is an attribute?
Entities have descriptive properties called attributes
e.g people have names and addresses
What is an entity set?
A set of entities of the same type that share the same set of attributes
e.g set of all persons
What are the 5 attribute types?
• Simple, which compromise of a single component part
e.g salary
• Composite, which compromise multiple component parts
e.g address is made up of house name, street etc
• Single-valued, can only have one value per entity
e.g date of birth
• Multi-valued, may have more than one value per entity
e.g phone number for home, work etc
• Derived, attributes are computed from other attributes
e.d age is calculated from date of birth and current date
What is a relationship?
An association that exists between entities, and like entities, relationships are uniquely identifiable
e.g a specific person works at a specific company
What is a relationship set?
A set of relationships between one or more entity sets
e.g set of all pairs of persons working for companies
What is a binary relationship set?
Involves two entity sets, most relationship sets in a database system are binary
What is a N-ary relationship set?
An example of this is students work on research projects under the guidance of an instructor
What are multiplicity constraints?
Number of times an entity can or must take part in a particular type of relationship
What is participation?
The minimum number of times an entity must take part in a relationship set
• Total participation means an entity must take part in the relationship set
• Partial participation means an entity may or may not take part in the relationship set
What is cardinality?
The maximum number of times an entity can take part in a relationship set
What are the 4 types of mappings for cardinality constraints?
- One to one
- One to many
- Many to one
- Many to many
What is a candidate key?
A candidate key of an entity set is a minimal set of attributes that uniquely identifies each entity e.g Consider module with attributes code, title, and credits. Candidate keys are code and title
What is a primary key?
A primary key of an entity set is the candidate key that is chosen to uniquely identify each entity e.g Primary key for module is code
What is a weak entity set?
An entity set with no candidate keys, so it depends on the existence of an identifying entity set(s)
• Weak entity set must have total participation in relationship with identifying entity set(s)
• Must be one-to-many relationship from each identifying set to the weak entity set
What is a discriminator?
The discriminator (or partial key) of a weak entity set is the set of attributes that distinguishes among all the entities of a weak entity set.
How would you form the primary key of a weak entity set?
The primary key of a weak entity set is formed by the primary key(s) of the identifying entity set(s), plus the weak entity set’s discriminator.