Professional Documents
Culture Documents
CSE - 220 Database Management Systems: Subrat K Dash Lnmiit
CSE - 220 Database Management Systems: Subrat K Dash Lnmiit
CSE - 220 Database Management Systems: Subrat K Dash Lnmiit
Database
Application
Programs
The company is organized into departments. Each department has a unique name,
a unique number, and a particular employee who manages the department. We
keep track of the start date when that employee began managing the department.
A department may have several locations.
We store each employee's name, social security number, address, salary, sex, and
birth date. An employee is assigned to one department but may work on several
projects, which are not necessarily controlled by the same department. We keep
track of the number of hours per week that an employee works on each project.
We also keep track of the direct supervisor of each employee.
ER Model Concepts
Entities and Attributes
Entities are specific objects or things in the mini-world with an
independent existence (physical or conceptual). For example a particular
person, an EMPLOYEE John Smith, the Research DEPARTMENT, an
institute LNMIIT.
Attributes are properties used to describe an entity. For example an
EMPLOYEE entity may have a Name, SSN, Address, Sex, BirthDate
A specific entity will have a value for each of its attributes. For example a
specific employee entity may have Name='John Smith', SSN='123456789',
Address ='731, Fondren, Houston, TX', Sex='M', BirthDate='09-JAN-55'
Each attribute has a value set (or domain of values) associated with it.
Typically specified using basic data types like integer, string, subrange,
enumerated type,
Subrat K Dash, LNMIIT
Composite
The attribute may be composed of several components. For example,
Address (Apt#, House#, Street, City, State, ZipCode, Country) or Name
(FirstName, MiddleName, LastName). Composition may form a hierarchy
where some components are themselves composite.
Multi-valued
An entity may have multiple values for that attribute. For example,
Color of a CAR or PreviousDegrees of a STUDENT. Denoted as {Color}
or {PreviousDegrees}
Complex
Composite and multi-valued attributes may be nested arbitrarily to
any number of levels although this is rare. For example,
PreviousDegrees of a STUDENT is a composite multi-valued attribute
denoted by {PreviousDegrees (College, Year, Degree, Field)}.
Subrat K Dash, LNMIIT
Derived
Attributes whose values can be derived from some
other attributes (Age is derivable from DOB) or related
entities.
ENTITY TYPE
WEAK ENTITY TYPE
RELATIONSHIP TYPE
IDENTIFYING RELATIONSHIP TYPE
ATTRIBUTE
KEY ATTRIBUTE
MULTIVALUED ATTRIBUTE
COMPOSITE ATTRIBUTE
DERIVED ATTRIBUTE
TOTAL PARTICIPATION OF E2 IN R
CARDINALITY RATIO 1:N FOR E1:E2 IN R
STRUCTURAL CONSTRAINT (min, max) ON PARTICIPATION OF E IN R
The company is organized into departments. Each department has a unique name,
a unique number, and a particular employee who manages the department. We
keep track of the start date when that employee began managing the department.
A department may have several locations.
We store each employee's name, social security number, address, salary, sex, and
birth date. An employee is assigned to one department but may work on several
projects, which are not necessarily controlled by the same department. We keep
track of the number of hours per week that an employee works on each project.
We also keep track of the direct supervisor of each employee.
An entity type EMPLOYEE with attributes Name, SSN (for social security
number), Sex, Address, Salary, BirthDate, Department, and Supervisor.
Both Name and Address may be composite attributes; however, this was
not specified in the requirements. We must go back to the users to see if
any of them will refer to the individual components of Name-FirstName,
Middlelnitial, LastName-or of Address.
An entity type DEPENDENT with attributes Employee, DependentName,
Sex, BirthDate, and Relationship (to the employee).
Subrat K Dash, LNMIIT
Example ER Diagram
ENTITY TYPE
WEAK ENTITY TYPE
RELATIONSHIP TYPE
IDENTIFYING RELATIONSHIP TYPE
ATTRIBUTE
KEY ATTRIBUTE
MULTIVALUED ATTRIBUTE
COMPOSITE ATTRIBUTE
DERIVED ATTRIBUTE
TOTAL PARTICIPATION OF E2 IN R
CARDINALITY RATIO 1:N FOR E1:E2 IN R
STRUCTURAL CONSTRAINT (min, max) ON PARTICIPATION OF E IN R
Relationship Type
Structural Constraints
1. Cardinality ratio (Mapping cardinalities)
Maximum number of relationship instances that an entity
can participate in
1:1, 1:N, N:1, M:N
Shown by placing appropriate number on the relationship
Structural Constraints
2. Participation constraint
Minimum number of relationship instances that each
entity can participate in Minimum cardinality constraint
Total participation (existence dependency)
Every EMPLOYEE must work for a DEPARTMENT
Displayed as a double line in ER diagram
Partial
Each DEPARTMENT is managed by an EMPLOYEE (but all
EMPLOYEES do not manage DEPARTMENTS)
Displayed as a single line in ER diagram
Subrat K Dash, LNMIIT
Example ER Diagram
Entity Types
Strong entity types
Have key attribute(s)
Example
A department has exactly one manager and an
employee can manage at most one department.
Sample Example
ER Diagram Exercise
A university keeps track of each student's name, student
number, social security number, current address and
phone, permanent address and phone, birthdate, sex, class
(freshman, sophomore, ..., graduate), major department,
minor department (if any), and degree program (B.A., B.S.,
..., Ph.D.). Some user applications need to refer to the city,
state, and zip of the student's permanent address, and to
the student's last name. Both social security number and
student number have unique values for each student.
Each department is described by a name, department code,
office number, office phone, and college. Both name and
code have unique values for each department.
ER Diagram Solution!
Specialization
Is the process of defining a set of
subclasses of a superclass
Example: {SECRETARY, ENGINEER,
TECHNICIAN} is a specialization of
EMPLOYEE based upon job type.
Example
An entity that is
member of a subclass
inherits all attributes of
the entity as a member
of the superclass
It also inherits all
relationships
Example
Specific
attribute
Specific
relationship
types
Subrat K Dash, LNMIIT
Generalization
The reverse of the specialization process
If we can determine exactly those entities that will become members of each
subclass by a condition, the subclasses are called predicate-defined (or conditiondefined) subclasses
Condition is a constraint that determines subclass members
Display a predicate-defined subclass by writing the predicate condition next to the line
attaching the subclass to its superclass
Completeness Constraint
Total specifies that every entity in the superclass must be a member of
some subclass in the specialization/ generalization
Shown in EER diagrams by a double line
Example
Example
UNION Types