Académique Documents
Professionnel Documents
Culture Documents
• The E-R model is a detailed, logical representation of the data for a business area.
• It is expressed in terms of entities in the business, the relationships, and the properties of the entities and
relationships.
What is an Entity?
An Entity is a person, place, object, event, or concept about which organization wishes to maintain data.
Example
Person: EMPLOYEE, STUDENT
Place: CITY, STATE
Object: MACHINE, AUTOMOBILE
ER model Symbols:
Weak Entity: An entity type whose existence depends on other entity type.
Example: entity DEPENDENT won’t exists without another entity EMPLOYEE/ ASSOCIATE
Represented with
• Relation ships are glue that holds together the various components of E-R model.
• An association among the instances of one or more entity types.
Example:
STUDENT: Student_ID, Student_Name
AUTOMOBILE: Vehicle_ID, Color
Flight_No Date Captain_
Name
FLIGHT
Example: For an EMPLOYEE entity, attribute Years_Employeed is derived. This can be derived from the Date_Joined attribute
Exercise
1. Draw an ER diagram for the following.
A company purchases items from a number of different vendors, who then ship the items to the manufacturer. The items are
assembled into products that are sold to customers who order the products. Each customer order may order one or more
products.
Relational Keys
• Must be able to store and retrieve a row of data in a relation, based on the data values stored in that row
• A primary key is an attribute (or combination of attributes) that uniquely identifies each row in a relation.
• The primary key in the EMPLOYEE1 relation is EMP_ID (this is why it is underlined) as in:
EMPLOYEE1 (Emp_ID, Name, Dept, Salary)
• Super Key: An attribute (or combination of attributes) that uniquely identifies each entity in a table.
• Candidate Key: A minimal super key. A super key that does not contain a subset of attributes that is itself a super
key.
• Primary key: A candidate key selected to uniquely identify all other attribute values in any given row. Cannot
contain null entries.
• Foreign Key: A key is used when we must represent the relationship between two tables and relations
A foreign key is an attribute (possibly composite) in a relation of a database that serves as the primary key of
another relation in the same database.
Example
EMPLOYEE1 (Emp_ID, Name, Dept_Name, Salary)
DEPARTMENT (Dept_Name, Location, Fax)
The attribute Dept_ Name is a foreign key in EMPLOYEE1.
It allows the user to associate any employee wit the department they are assigned to.
Some authors show the fact that an attribute is a foreign key by using a dashed underline.