Professional Documents
Culture Documents
Se DB CH3
Se DB CH3
Se DB CH3
I. Conceptual schema/model/design:
Creating conceptual schema.
Conceptual schema is a concise description of the data
requirements and detailed description of the entity
types, relationships and constraints.
A commonly-used conceptual model is called an entity-
relationship model.
Cont…
Entity type
It refers to the category that a particular entity belongs to
The category of a particular entity in the relation in RDBMS is called the entity type.
• Eg. A table named STUDENT in a university database and a table named EMPLOYEE in a
company database.
Entity set
All
rows of a relation (table)
A group of similar entities and these entities can have attributes.
Collection of entities
ID of a particular entity type at a point in time.
NAME AGE
STUDENT
01 YEABSIRA 18
02 SAMUEL 21
03 HALETA 16
Age
Name Phone
number
Person
Cont…
Derived attributes
Can be derived from other attributes
Eg. Age can be derived from date of birth
Stored attribute
◦ From which the value of other attributes are derived
◦ Eg. Birth date of a person
Key attribute
It is capable of identifying each entity uniquely
Complex attributes
Are the nesting of two or more composite and multi-valued attributes.
Therefore, these multi-valued and composite attributes are called ‘Components’ of complex
attributes.
◦ Multi-valued attributes represented within ‘{ }’
◦ Composite attributes represented by ‘( )’
◦ Components are separated by commas ‘, ‘
For example: let us consider a person having multiple phone numbers, emails, and an address.
Cont…
ERD Cont…
Relationship :
◦ Shows the communication among the entities in a database or we
can say it represents an association among two or more
entities;
◦ For example, an employee works on projects. A relationship
exists between the employee and each project.
One-to-many (1:M) relationship
PERSON IS_MARRI
ED_TO
N
Cont…
Binary relationship
Exists when there is an association among two entities.
Publishe
PUBLLISHER BOOK
s
Ternary relationship
Exists when there is ana association among three entities
TEACHER
Reading assignment
There are also quaternary, quinary, senary, septenary, octal relationships
Relationship constraints
I. Cardinality Ratio (maximum cardinality)
Maximum number of relationship instances that an entity can participate in
For example: when An employee can work for a departments, A department
can have many employees, Each department has at most one manager….
Therefore, relationship types by maximum cardinality are:
One-to-one (1:1)
One-to-many (1:N),
Many-to-one (N:1) and
Many-to-many (M:N)
Cont…
How do you know the maximum cardinality between two entity types?
Let’s say we have 2 entity types called X and Y
One-to-One Relationship
◦ An entity in X is associated with at most one entity in Y , and vice-versa.
◦ E.g. Each passenger has his own Ticket
Many-to-One Relationship
◦ An entity in X is associated with at most one entity in Y. But an entity in Y can
be associated with any number (zero or more ) of entities in X
◦ E.g. Many needles can be injected into a single patient
Many-to-Many Relationship
◦ An entity in X is associated with any number(zero or more) of entities in Y, and
an entity in Y is associated with any number (zero or more ) of entities in X
Notations to represent cardinality in ERD
There are no. of notations to represent cardinality in ERD: Chen, UML, Crow’s
foot, Bachman etc.
Cardinality with chen notation
In total participation, each entity in the entity set occurs in at least one
relationship in the relationship set
The above example shows that the participation of the entity set Department in
the relationship set Manages is total. This is because every department must
have a manager .
In partial participation , some entities (not all entities) in the entity set occurs
in the relationship set
The above example shows that the participation of the entity set employee in
the relationship set manages is partial because it is not possible for every
employee entity to be a manager/ department head
Relationships cont…
Attributes of r/n types
In 1:1 relationship type, attributes can be migrated to either of the
entity types (look at figure A)
In 1:N or N:1 relationship type, attributes are migrated only to the
entity type on the N-side of the relationship (look at figure B)
In M:N relationship type, some attributes can be determined by a
combination of participating entities. (look at figure C)
Figure A
Figure B
Figure C
Relationships cont…
Role Names
Signifies the role that a participating entity plays in each
relationship instance.
It also explains what the relationship means
It is necessary only in recursive relationships
Recursive relationships
Same entity type participates more than once in a relationship
type in different roles
Cont….
Supervisors and subordinates are
called “Role Names”.
The degree of the REPORTS_TO
relationship is 1 i.e. a unary
relationship.
Cont…
• The minimum cardinality of the Supervisor entity is ZERO
since the lowest level employee may not be a manager for anyone.
• The maximum cardinality of the Supervisor entity is N since an
employee can manage many employees.
• Similarly, the Subordinate entity has a minimum cardinality of
ZERO to account for the case where CEO can never be a
subordinate.
• Its maximum cardinality is ONE since a subordinate employee
can have at most one supervisor.
Cont…
Sample ERD
ERD Representation Naming convention
Alternative description
How to Draw ER Diagrams
Identify all the entities in the system. An entity should appear only once in
a particular diagram. Create rectangles for all entities and name them
properly.
Add attributes for entities. Give meaningful attribute names so they can be
understood easily.
Identify relationships between entities. Connect them using a line and add a
diamond in the middle describing the relationship.
We use EER when basic concepts of the ER model are not sufficient
to represent the requirements of the newer, more complex
applications
It is ER plus the concepts of (specialization & generalization, and
aggregation).
It also includes the concepts of Subclass, Superclass and Inheritance
Superclass: is an entity type that includes distinct subgroups with
their own unique attributes that should be represented in the model
Subclass: is an entity type that is a member of the superclass with
its own distinct role. Or it is any subgroup of the Superclass.
Cont…
Inheritance: is an object oriented programming concept that allows one
class of objects to be defined as a special class of a more general class.
Subclass inherits all properties of its super classes and can define its
own unique properties.
Inheritance → superclass + subclass
We can think of a reverse process of abstraction in which we suppress
the differences among several entity types, identify their common
features, and generalize them into a single superclass of which the
original entity types are special subclasses.
It is an important feature of Generalization and Specialization. It
allows lower-level entities to inherit the attributes of higher-level
entities.
Cont…
Entities Before
Specialization
The database keeps track of three types of persons: employees, alumni, and students. A
person can belong to one, two, or all three of these types. Each person has a name,
SSN, sex, address, and birth date.
Every employee has a salary, and there are three types of employees: faculty, staff, and
student assistants. Each employee belongs to exactly one of these types. For each
alumnus, a record of the degree or degrees that he or she earned at the university is
kept, including the name of the degree, the year granted, and the major department.
Each student has a major department.
Each faculty has a rank, whereas each staff member has a staff position. Student
assistants are classified further as either research assistants or teaching assistants, and
the percent of time that they work is recorded in the database. Research assistants have
their research project stored, whereas teaching assistants have the current course they
work on.
Students are further classified as either graduate or undergraduate, with the specific
attributes degree program (M.S., Ph.D., M.B.A., and so on) for graduate students and
class (freshman, sophomore, and so on) for under- graduates.
Answer
Alternative Notation
Cont…
Thank you !!!