0% found this document useful (0 votes)
62 views27 pages

ER-Relational Mapping From VIT

The document outlines a 7 step process for mapping an ER model to a relational schema, including mapping regular entity types, weak entity types, binary 1:1, 1:N and M:N relationship types, multi-valued attributes, and N-ary relationship types to tables, columns, primary keys and foreign keys. Each entity and relationship from the ER model is mapped to database tables and attributes, with primary keys defined based on entity identifiers and foreign keys defined for relationships between tables. The result is a relational schema consisting of tables, columns, domains and keys that can be implemented in a relational database.

Uploaded by

Navya Verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views27 pages

ER-Relational Mapping From VIT

The document outlines a 7 step process for mapping an ER model to a relational schema, including mapping regular entity types, weak entity types, binary 1:1, 1:N and M:N relationship types, multi-valued attributes, and N-ary relationship types to tables, columns, primary keys and foreign keys. Each entity and relationship from the ER model is mapped to database tables and attributes, with primary keys defined based on entity identifiers and foreign keys defined for relationships between tables. The result is a relational schema consisting of tables, columns, domains and keys that can be implemented in a relational database.

Uploaded by

Navya Verma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Module-2

Mapping ER model to Relational


Schema
ER to Relational Schema Mapping
• 7 Steps
ER to Relational Schema Mapping
Step 1: Mapping of Regular Entity Types
Step 2: Mapping of Weak Entity Types
Step 3: Mapping of Binary 1:1 Relation Types
Step 4: Mapping of Binary 1:N Relationship
Types.
Step 5: Mapping of Binary M:N Relationship
Types.
Step 6: Mapping of Multi valued attributes.
Step 7: Mapping of N-ary Relationship Types.
Step 1: Mapping of Regular Entity
Types
Step 1: Mapping of Regular Entity
Types
• Create a relation R that includes all simple
attributes of E
– Each entity became a table
– Each single value attribute becomes column
– Derived attributes are ignored
– Composite attribute represented by components
– Key attribute became the primary key of the table
Step 1: Mapping of Regular Entity
Types
Step 1: Mapping of Regular Entity
Types

Employee
Emp_ID (PK)
Emp_First Name
Emp_Last Name
….
….
Step 2: Mapping of Weak Entity Types
Step 2: Mapping of Weak Entity Types
Step 2: Mapping of Weak Entity Types
Course Section
Course_ID (PK) Section_ID (PK)
Course Name Course_ID (FK)
Course credits Section Name
…. Class No.
…..
Step 3: Mapping of Binary 1:1 Relation
Types
Step 3: Mapping of Binary 1:1 Relation
Types
Professor Course
Professor_ID (PK) Course_ID (PK)
Professor Name Course Name
Teaches …..
(Course_ID)
….
….
Step 3: Mapping of Binary 1:1 Relation
Types
• Employee manages the department
• Employee sits on the chair
• Chair used by the employee
Step 4: Mapping of Binary 1:N
Relationship Types
Step 4: Mapping of Binary 1:N
Relationship Types

Professor Student
Professor_ID (PK) Student Roll No (PK)
Professor Name Student Name
…. …..
…. Guide ID (FK)
…. (Professor_ID)
Step 4: Mapping of Binary 1:N
Relationship Types
• Teacher teaches many subjects
• Student registered many courses
Step 5: Mapping of Binary M:N
Relationship Types
Step 5: Mapping of Binary M:N
Relationship Types

Course Student
course_ID (PK) Student Roll No (PK)
course Name Student Name
…. …..

enrolls

Course ID (FK)

Student ID (FK)
Step 6: Mapping of Multi valued
attributes
Step 6: Mapping of Multi valued
attributes
Employee Emp-Email_Id
Emp_ID (PK) Email_ID
Emp_First Name Emp_ID (FK)
Emp_Last Name
….
….
Step 7: Mapping of N-ary Relationship
Types
• Doctor prescribed medicine to a patient
Step 7: Mapping of N-ary Relationship
Types
• Doctor prescribed medicine to a patient

Doctor Patient Medicine


Doctor_ID Patient_ID Medicine_ID
Name Patient Name Medicine Name
….. …… …..

Prescription
Doctor_ID
Medicine_ID
Patient_ID
Next Visit
Self referencing Relationship
• Employees who are also a couple (1:1)
Employee
Emp ID (PK)
Emp Name
Date of Join
Skill
Spouse ( FK)
Self referencing Relationship
• Employee, Manager_of (1:N)
Employee
Emp ID (PK)
Emp Name
Date of Join
Skill
Mgr ID ( FK)
Self referencing Relationship
• Employee, Guarantor_of (M:N)

Employee Guarantor
Emp ID (PK) Emp ID (FK)
Emp Name G ID (FK)
Date of Join
Skill
…..
Relational Schema
• It Consists of relation name and set of
attributes (or) column names.
• Each attribute has an associated with domain
(set of atomic values, i.e. data type).
• Example:
Student { Student name : string
Roll Number : string
Phone Number : integer
Year of admission : integer
Branch : string }
Relational Schema
• Key ( Primary Key )
• Instances
• Examples
Student
Department
Professor
Course
enrollment

You might also like