Curs2 PDF
Curs2 PDF
FROM Databases
Requirements specs
2. Conceptual Modeling
independent of
E/R diagrams (UML)
physical
considerations
3. Logical modeling
Normalisation
Relational schema
2
Plan
3 08:23
Schema design: motivation
4 08:28
Basic E/R concepts
(Chen 1976)
Entity
Data that can be modeled as an object having independent existence
An entity type groups objects having the same properties; each entity type is described by a name and a
list of properties; each object in the group will be called an entity (occurrence/instance)
Any entity must be uniquely identifiable within its class
Relationship
Models the interaction/association between entities
A relationship type is a set of associations among entities types; each relationship type is given a
(descriptive) name
A relationship (occurrence/instance) is uniquely identifiable by the participating entities
Degree of a relationship type = the number of entity types involved
binary, ternary…
A recursive relationship type involves one entity type more than once, playing distinct roles
Attributes
For entity types these are specific properties describing the independent objects
For association types these may be
Properties of the involved entity types
Specific properties of the relationship type, storing new information related to the association
5 08:28
E/R diagrams
Instructors
STUDENTS MENTORS
Courses
Grades
Mentors GRADES INSTRUCTORS
Ternary relationship
Recursive relationship
PRE COURSES
Requirements:
We can determine any student’s grades for the courses he/she attended and
the accumulated credits
We can determine a student’s mentor
We store the prerequisites for each course
7 08:31
More E/R concepts
Roles
Explain the function of the entity type in an association
rol
Primary key
The minimal set of attributes that is designated to uniquely identify an entity instance or a
relationship instance
It is mandatory for entity types in order to identify the entity instances that are involved in
relationships
Primary_key
STUDENTS MENTORS
advised by
evaluated
advisor
sem
PRE COURSES
necesitates
code title credits
u:v
10 08:44
Example
(Students1,1Mentors)
(Instructors,0,7,Mentors)
Interpretation: Every student has exactly one instructor as advisor/mentor
and an instructor can advise at most 7 students
STUDENTS MENTORS
advised
1:1
advisor
0:7
INSTRUCTORS
11 08:48
Multiplicity constraints for binary
relationships (1)
12 08:49
Multiplicity constraints for binary
relationships (2)
13 08:49
Weak entity type
0:n
1:1
Weak entity type
Has no key
Must satisfy the multiplicity constraint (Weak-entity,1,1,R), participating in a
one-to-one or one-to-many relationship with respect to the strong entity
14 08:53
Weak entity - example
STUDENTS
0:10
EARN
1:1
SCHOLARSHIPS
15 08:53
Connection traps
(Fan traps)
INSTRUCTOR INSTRUCTOR
EMPLOYEES
EMPLOYEES
has has
UNIVERSITY FACULTALTY
composed of components of
STRUCTURE
STRUCTURE
components of composed of
composition
FACULTATY (special type of relationship) UNIVERSITY
Problem: Solution:
In which department profesor X is working? Restructured model
16 22:27
Connection traps
(Chasm traps)
holds
FACULTY FACULTY
offers offers
CURRICULUM CURRICULUM
offered by offered by
COURSE RESOURCE COURSE
activity activity
TIMETABLE TIMETABLE
location location
CLASSROOM property of CLASSROOM
Problem: Solution:
Which are the classrooms belonging to some faculty? New relationships
17 22:27
Enhancements of the E/R model
Specializations
STUDENTS
IS A
FOREIGN
STUDENTS
18 22:27
Specialization constraints
19 22:27
UML Modeling
20 22:27
E/R – UML Correspondence
E/R UML
Entity type Class
Relationship type NOT having Association
own attributes
Relationship type with own Association class
attributes
Specialization Subclass
Composition and
Aggregation
21 22:27
Classes
STUDENTS
22 22:27
Associations
23 22:27
Associations
Multiplicity constraints
Constraints
u:v x:y
(C1,u,v,A) C1 A C2
(C2,x,y,A)
2..4 12..14
25 22:27
Recursive relationships
requires
COURSES PRE
is required by
code title credits
26 22:27
N-ary relationships
27 22:27
Association classes
title session
28 22:27
Association classes
STUDENTS
29 22:27
Eliminating association classes
30 22:27
Subclasses
(1)
ID fName lName
STUDENTS
superclass
IS A IS A
ROMANIAN
FOREIGN STUDENTS
STUDENTS
CNP country
31 22:27
Subclass
(2)
32 22:27
Compositions and aggregation
34 22:27
Entity types and relationships
35 22:27
Quiz
36 22:27
Recursive relationships
37 22:27
Association classes
38 22:27
Specializations/Subclasses
Choices:
1. Superclass relation + subclass relations containing foreign key and specialized
attributes
C1(K1,X1), C2(K1,X2), C3(K1,X3)
2. Independent superclass relation + subclass relations containing both general
attributes and specialized attributes
C1(K1,X1), C2(K2,X1,X2), C3(K2,X1,X3)
3. One relation containing everything
C(K1,X1,X2,X3)
39 22:27
Quiz
o n1<n2<n3
o n1n2n3
o n3<n2<n1
o n3 n2 n1
40 22:27
Composition and aggregation
accepts NULL
41 22:27
ER / UML Modeling
Summary
PROS
Popular technique in conceptual modeling
Constructions which allow us expressing our own personal point of
view on data/application
Allows expressing some classes of constraints (primary keys, foreign
keys, multiplicity…)
CONS
Subjectivity (entity / attribute, entitity / relationship, subclass,
composition)
Does not allow modeling all kinds of dependencies
Necessitates future normalisation steps
42 22:27
Bibliography
Tools:
https://creately.com (ER diagrams, UML class diagrams)
http://diagramo.com/ (ER diagrams)
http://argouml-downloads.tigris.org/nonav/argouml-0.32.2/ArgoUML-0.32.2.zip
(UML class diagrams)
43 22:27