Beruflich Dokumente
Kultur Dokumente
Data Names
Be Unique from the name used for every other distinct data object; words should be included in a data name if they distinguish the data object from other similar data objects (e.g., HomeAddress versus CampusAddress). Be Readable, so that the name is structured as the concept would most naturally be said (e.g., GradePointAverage is a good name. Be Composed of Words; each organization often chooses a vocabulary from which significant words in data names must be chosen. Alternative, or alias names, also can be used as can approved abbreviations (e,g CUST for Customer), and you may be encouraged to use abbreviations so that data names are short enough to meet maximum length limits of database technology. Be Repeatable, meaning that different people or the same person at different times should develop exactly or almost the same name; this often means that there is a standard hierarchy or pattern for names (e,g., the birth date of a student would be StudentBirthDate and the birth date of an employee would be EmployeeBirthDate).
ER Model Concepts
Entities and Attributes
Entities are specific objects or things in the mini-world that are represented in the database. For example EMPLOYEE , DEPARTMENT, PERSON, COMPANY. Attributes are properties used to describe an entity. For example an EMPLOYEE entity may have a Name, Id, 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', Id='123456789', Address ='731, Fondren, Houston, TX', Sex='M', BirthDate='09-JAN-55 Each attribute has a value set (or data type) associated with it e.g. integer, float string, date-type, enumerated type,
Types of Attributes
Simple Each entity has a single atomic value for the attribute. Attribute that are not divisible are called simple or atomic attributes. For example, id 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). 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}.
A composite attribute is an attribute, such as Address, that has meaningful component parts. Figure shows the notation that we use for composite attributes applied to this example. EMPLOYEE Employee_Address (StreeCAddress, City, State, PostaLCode)
Simple (or atomic) attribute: An attribute that cannot be broken down into smaller components that are meaningful to the organization. For example, all of the attributes associated with AUTOMOBILE are simple: Vehicle_ID, Color, Weight and Horsepower.
Prepared by Jesmin Akhter, Lecturer, IIT,JU
CAR Registration(RegistrationNumber, State), VehicleID, Make, Model, Year, {Color} car1 ((ABC 123, TEXAS), TK629, Ford Mustang, convertible, 1999, {red, black}) car2 ((ABC 123, NEW YORK), WP9872, Nissan 300ZX, 2-door, 2002, {blue}) car3 ((VSY 720, TEXAS), TD729, Buick LeSabre, 4-door, 2003, {white, blue}) . . .
NOTATION OF ER-DIAGRAM
Symbol Meaning ENTITY WEAK ENTITY RELATIONSHIP IDENTIFYING RELATIONSHIP ATTRIBUTE KEY ATTRIBUTE MULTIVALUED ATTRIBUTE COMPOSITE ATTRIBUTE DERIVED ATTRIBUTE
E1 E1
R R R N (min,max)
E2 E2 E
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
Example relationship instances of the WORKS_FOR relationship between EMPLOYEE and DEPARTMENT
EMPLOYEE WORKS_FOR DEPARTMENT
e1 e2 e3 e4 e5 e6 e7
r1 r2
d1 d2 d3
r3 r4 r5 r6 r7
Example relationship instances of the WORKS_ON relationship between EMPLOYEE and PROJECT
EMPLOYEE WORKS_ON PROJECT
r9 e1 e2 e3 e4 e5 e6 e7
r1 r2
p1 p2 p3
r3 r4 r5 r6 r8 r7
Example: Suppose that a DEPENDENT entity is identified by the dependents first name and birhtdate, and the specific EMPLOYEE that the dependent is related to. DEPENDENT is a weak entity type with EMPLOYEE as its identifying entity type via the identifying relationship type EPENDENT_OF
Chapter 3-23
Chapter 3-24
Constraints on Relationships
Constraints on Relationship Types ( Also known as ratio constraints ) Maximum Cardinality One-to-one (1:1) One-to-many (1:N) or Many-to-one (N:1) Many-to-many Minimum Cardinality (also called participation constraint or existence dependency constraints) zero (optional participation, not existencedependent) one or more (mandatory, existence-dependent)
e1 e2 e3 e4 e5 e6 e7
r1 r2
d1 d2 d3
r3 r4 r5 r6 r7
r9 e1 e2 e3 e4 e5 e6 e7
r1 r2
p1 p2 p3
r3 r4 r5 r6 r8 r7