Unit 2 - Dbms
Unit 2 - Dbms
• Each attribute has a value set (or data type) associated with
it
– e.g. integer, string, subrange, enumerated type, …
Types of Attributes (1)
• Simple
• Each entity has a single atomic value for the attribute.
For example, SSN or Sex.
• Composite
• The attribute may be composed of several components.
For example:
• Address(Apt#, House#, Street, City, State, ZipCode,
Country), or Name(FirstName, MiddleName, LastName).
• 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}.
Types of Attributes (2)
• Derived attribute :Derived attributes are attributes
that contain values calculated from other
attributes. Age can be derived from the attribute
Birthdate.
• Composite and multi-valued attributes :
• For example, PreviousDegrees of a
STUDENT is a composite multi-valued
attribute denoted by {PreviousDegrees
(College, Year, Degree, Field)}
• Binary relationship type: This relationship type has two entity types
link together. This is the most common relationship. Like
Works_On and Manages.
• Relationship Type:
• Is the schema description of a relationship
• Identifies the relationship name and the
participating entity types
• Also identifies certain relationship constraints
• Relationship Set:
• The current set of relationship instances
represented in the database
• The current state of a relationship type
Relationship type vs. relationship set (2)
Refining the COMPANY database schema by
introducing relationships
• By examining the requirements, six relationship types are
identified
• All are binary relationships( degree 2)
• Listed below with their participating entity types:
• WORKS_FOR (between EMPLOYEE, DEPARTMENT)
• MANAGES (also between EMPLOYEE, DEPARTMENT)
• CONTROLS (between DEPARTMENT, PROJECT)
• WORKS_ON (between EMPLOYEE, PROJECT)
• SUPERVISION (between EMPLOYEE (as subordinate),
EMPLOYEE (as supervisor))
• DEPENDENTS_OF (between EMPLOYEE, DEPENDENT)
ER DIAGRAM – Relationship Types are:
WORKS_FOR, MANAGES, WORKS_ON, CONTROLS, SUPERVISION, DEPENDENTS_OF
Discussion on Relationship Types
• In the refined design, some attributes from the initial entity
types are refined into relationships:
• Manager of DEPARTMENT -> MANAGES
• Works_on of EMPLOYEE -> WORKS_ON
• Department of EMPLOYEE -> WORKS_FOR