UNIT 1
Lecture 8
E R Model
Question 2
•Construct an E-R diagram for a car-insurance
company whose customers own one or more
cars each. Each car has associated with it zero to
any number of recorded accidents.
Dinesh Kumar Bhawnani, BIT DURG
Step 1 : Identify the entity sets
• From the given question the entity sets identified are
1. PERSON
2. CAR
3. ACCIDENT
Dinesh Kumar Bhawnani, BIT DURG
Step 2 : Identify the relevant attributes
• The relevant attributes of PERSON entity set are
• Person_Id
• Person_Name
• Address
• The relevant attributes of CAR entity set are
• Engine_No
• Model
• Year
• The relevant attributes of ACCIDENT entity set are
• Report_No
• Location
• Acc_Date
Dinesh Kumar Bhawnani, BIT DURG
Step 3 : Identify the prime attributes
•The prime attribute of PERSON entity set is
•Person_Id
•The prime attribute of CAR entity set is
•Engine_No
•The prime attribute of ACCIDENT entity set is
•Report_No
Dinesh Kumar Bhawnani, BIT DURG
Step 4 : Identify the relationships
•Customers own one or more cars each.
Dinesh Kumar Bhawnani, BIT DURG
PERSON CARowns
Step 4 : Identify the relationships
•Each car is associated with it zero to any number
of recorded accidents.
Dinesh Kumar Bhawnani, BIT DURG
Step 4 : Identify the relationships
•Each car is associated with it zero to any number
of recorded accidents.
Dinesh Kumar Bhawnani, BIT DURG
PERSON CAR
participated
ACCIDENT
Step 5 : Complete E R Diagram
Dinesh Kumar Bhawnani, BIT DURG
PERSON CAR
participated
ACCIDENT
owns
Person_Id
Person_Name
Address
Model
Year
Engine_No
Report_No Location
Acc_Date
Damage_Amount
Question 3
• Design an E-R diagram for keeping track of the exploits
of your favorite sports team. You should store the
matches played, the scores in each match, the players
in each match and individual player statistics for each
match. Summary statistics should be modeled as
derived attributes.
Dinesh Kumar Bhawnani, BIT DURG
Step 1 : Identify the entity sets
• From the given question the entity sets identified are
1. MATCH
2. PLAYER
Dinesh Kumar Bhawnani, BIT DURG
Step 2 : Identify the relevant attributes
• The relevant attributes of MATCH entity set are
• Match_Id
• Stadium
• Date
• Opponent
• Own_Score
• Opp_Score
• The relevant attributes of PLAYER entity set are
• Player_Id
• Player_Name
• Summary_Score
Dinesh Kumar Bhawnani, BIT DURG
Step 3 : Identify the prime attributes
•The prime attribute of MATCH entity set is
•Match_Id
•The prime attribute of PLAYER entity set is
•Player_Id
Dinesh Kumar Bhawnani, BIT DURG
Step 4 : Identify the relationships
Dinesh Kumar Bhawnani, BIT DURG
MATCH PLAYERplayed
Step 5 : Complete E R Diagram
Dinesh Kumar Bhawnani, BIT DURG
MATCH PLAYERplayed
Match_Id
Opponent
Stadium
Own_Score Opp_Score
Date
Score Summary_Score
Player_Id Player_Name
Question 4
• Design an E-R diagram for keeping track of the exploits of your
favorite sports team. You should store the matches played, the scores
in each match, the players in each match and individual player
statistics for each match. Summary statistics should be modeled as
derived attributes.
• Extend the E-R diagram of the previous question to track the same
information for all teams in a league.
Dinesh Kumar Bhawnani, BIT DURG
Complete E R Diagram
Dinesh Kumar Bhawnani, BIT DURG
MATCH PLAYERplayed
Match_Id
Opponent
Stadium
Date
Score
Summary_Score
Player_Id Player_Name
TEAM
team_played player_of
Name Ranking
Result
Team_Score
Question 4
A university registrar’s office maintains data about the following
entities: (a) courses, including number, title, credits, syllabus, and
prerequisites; (b) course offerings, including course number, year,
semester, section number, instructor(s), timings, and classroom; (c)
students, including student-id, name, and program; and (d) instructors,
including identification number, name, department, and title. Further,
the enrollment of students in courses and grades awarded to students
in each course they are enrolled for must be appropriately modeled.
Construct an E-R diagram for the registrar’s office. Document all
assumptions that you make about the mapping constraints.
Dinesh Kumar Bhawnani, BIT DURG
Step 1 : Identify the entity sets
• From the given question the entity sets identified are
1. COURSE
2. COURSE-OFFERINGS
3. STUDENT
4. INSTRUCTOR
Dinesh Kumar Bhawnani, BIT DURG
Step 2 : Identify the relevant attributes
• The relevant attributes of COURSE entity set are
• Course_No
• C_Tile
• Credits
• Syllabus
• The relevant attributes of COURSE-OFFERINGS entity set are
• Year
• Time
• Secno
• Room
• Semester
• The relevant attributes of STUDENT entity set are
• S_Id
• S_Name
• Program
• The relevant attributes of INSTRUCTOR entity set are
• I_id
• I_Name
• I_Title
• Dept
Dinesh Kumar Bhawnani, BIT DURG
Step 3 : Identify the prime attributes
• The prime attribute of COURSE entity set are
• Course_No
• There is no prime attribute in COURSE-OFFERINGS entity set,
so it is an weak entity set, however the partial key
(discriminator) is
• Year
• The prime attribute of STUDENT entity set is
• S_Id
• The prime attribute of INSTRUCTOR entity set is
• I_id
Dinesh Kumar Bhawnani, BIT DURG
Step 4 : Identify the relationship
Dinesh Kumar Bhawnani, BIT DURG
COURSErequires
pre-requisite
main-course
Step 4 : Identify the relationship
Dinesh Kumar Bhawnani, BIT DURG
COURSE
COURSE-
OFFERINGS
Is_offered
Step 4 : Identify the relationship
Dinesh Kumar Bhawnani, BIT DURG
STUDENT enrolls
COURSE-
OFFERINGS
Step 4 : Identify the relationship
Dinesh Kumar Bhawnani, BIT DURG
INSTRUCTORteaches
COURSE-
OFFERINGS
Step 5 : Complete E R Diagram
Dinesh Kumar Bhawnani, BIT DURG
STUDENT INSTRUCTOR
COURSE
enrolls teaches
requires
COURSE-
OFFERINGS
Is_offered
I_id I_Name
Dept I_Title
Course_No
Credits
C_Title
Syllabus
Program
S_Id Grade
S_Name
Time Secno Room
Year Semester
pre-requisite
main-course
For Video lecture on this topic please subscribe to my youtube channel.
The link for my youtube channel is
https://www.youtube.com/channel/UCRWGtE76JlTp1iim6aOTRuw?sub
_confirmation=1
Dinesh Kumar Bhawnani, BIT DURG

Dbms Notes Lecture 8 : E R Diagram question with solutions

  • 1.
  • 2.
    Question 2 •Construct anE-R diagram for a car-insurance company whose customers own one or more cars each. Each car has associated with it zero to any number of recorded accidents. Dinesh Kumar Bhawnani, BIT DURG
  • 3.
    Step 1 :Identify the entity sets • From the given question the entity sets identified are 1. PERSON 2. CAR 3. ACCIDENT Dinesh Kumar Bhawnani, BIT DURG
  • 4.
    Step 2 :Identify the relevant attributes • The relevant attributes of PERSON entity set are • Person_Id • Person_Name • Address • The relevant attributes of CAR entity set are • Engine_No • Model • Year • The relevant attributes of ACCIDENT entity set are • Report_No • Location • Acc_Date Dinesh Kumar Bhawnani, BIT DURG
  • 5.
    Step 3 :Identify the prime attributes •The prime attribute of PERSON entity set is •Person_Id •The prime attribute of CAR entity set is •Engine_No •The prime attribute of ACCIDENT entity set is •Report_No Dinesh Kumar Bhawnani, BIT DURG
  • 6.
    Step 4 :Identify the relationships •Customers own one or more cars each. Dinesh Kumar Bhawnani, BIT DURG PERSON CARowns
  • 7.
    Step 4 :Identify the relationships •Each car is associated with it zero to any number of recorded accidents. Dinesh Kumar Bhawnani, BIT DURG
  • 8.
    Step 4 :Identify the relationships •Each car is associated with it zero to any number of recorded accidents. Dinesh Kumar Bhawnani, BIT DURG PERSON CAR participated ACCIDENT
  • 9.
    Step 5 :Complete E R Diagram Dinesh Kumar Bhawnani, BIT DURG PERSON CAR participated ACCIDENT owns Person_Id Person_Name Address Model Year Engine_No Report_No Location Acc_Date Damage_Amount
  • 10.
    Question 3 • Designan E-R diagram for keeping track of the exploits of your favorite sports team. You should store the matches played, the scores in each match, the players in each match and individual player statistics for each match. Summary statistics should be modeled as derived attributes. Dinesh Kumar Bhawnani, BIT DURG
  • 11.
    Step 1 :Identify the entity sets • From the given question the entity sets identified are 1. MATCH 2. PLAYER Dinesh Kumar Bhawnani, BIT DURG
  • 12.
    Step 2 :Identify the relevant attributes • The relevant attributes of MATCH entity set are • Match_Id • Stadium • Date • Opponent • Own_Score • Opp_Score • The relevant attributes of PLAYER entity set are • Player_Id • Player_Name • Summary_Score Dinesh Kumar Bhawnani, BIT DURG
  • 13.
    Step 3 :Identify the prime attributes •The prime attribute of MATCH entity set is •Match_Id •The prime attribute of PLAYER entity set is •Player_Id Dinesh Kumar Bhawnani, BIT DURG
  • 14.
    Step 4 :Identify the relationships Dinesh Kumar Bhawnani, BIT DURG MATCH PLAYERplayed
  • 15.
    Step 5 :Complete E R Diagram Dinesh Kumar Bhawnani, BIT DURG MATCH PLAYERplayed Match_Id Opponent Stadium Own_Score Opp_Score Date Score Summary_Score Player_Id Player_Name
  • 16.
    Question 4 • Designan E-R diagram for keeping track of the exploits of your favorite sports team. You should store the matches played, the scores in each match, the players in each match and individual player statistics for each match. Summary statistics should be modeled as derived attributes. • Extend the E-R diagram of the previous question to track the same information for all teams in a league. Dinesh Kumar Bhawnani, BIT DURG
  • 17.
    Complete E RDiagram Dinesh Kumar Bhawnani, BIT DURG MATCH PLAYERplayed Match_Id Opponent Stadium Date Score Summary_Score Player_Id Player_Name TEAM team_played player_of Name Ranking Result Team_Score
  • 18.
    Question 4 A universityregistrar’s office maintains data about the following entities: (a) courses, including number, title, credits, syllabus, and prerequisites; (b) course offerings, including course number, year, semester, section number, instructor(s), timings, and classroom; (c) students, including student-id, name, and program; and (d) instructors, including identification number, name, department, and title. Further, the enrollment of students in courses and grades awarded to students in each course they are enrolled for must be appropriately modeled. Construct an E-R diagram for the registrar’s office. Document all assumptions that you make about the mapping constraints. Dinesh Kumar Bhawnani, BIT DURG
  • 19.
    Step 1 :Identify the entity sets • From the given question the entity sets identified are 1. COURSE 2. COURSE-OFFERINGS 3. STUDENT 4. INSTRUCTOR Dinesh Kumar Bhawnani, BIT DURG
  • 20.
    Step 2 :Identify the relevant attributes • The relevant attributes of COURSE entity set are • Course_No • C_Tile • Credits • Syllabus • The relevant attributes of COURSE-OFFERINGS entity set are • Year • Time • Secno • Room • Semester • The relevant attributes of STUDENT entity set are • S_Id • S_Name • Program • The relevant attributes of INSTRUCTOR entity set are • I_id • I_Name • I_Title • Dept Dinesh Kumar Bhawnani, BIT DURG
  • 21.
    Step 3 :Identify the prime attributes • The prime attribute of COURSE entity set are • Course_No • There is no prime attribute in COURSE-OFFERINGS entity set, so it is an weak entity set, however the partial key (discriminator) is • Year • The prime attribute of STUDENT entity set is • S_Id • The prime attribute of INSTRUCTOR entity set is • I_id Dinesh Kumar Bhawnani, BIT DURG
  • 22.
    Step 4 :Identify the relationship Dinesh Kumar Bhawnani, BIT DURG COURSErequires pre-requisite main-course
  • 23.
    Step 4 :Identify the relationship Dinesh Kumar Bhawnani, BIT DURG COURSE COURSE- OFFERINGS Is_offered
  • 24.
    Step 4 :Identify the relationship Dinesh Kumar Bhawnani, BIT DURG STUDENT enrolls COURSE- OFFERINGS
  • 25.
    Step 4 :Identify the relationship Dinesh Kumar Bhawnani, BIT DURG INSTRUCTORteaches COURSE- OFFERINGS
  • 26.
    Step 5 :Complete E R Diagram Dinesh Kumar Bhawnani, BIT DURG STUDENT INSTRUCTOR COURSE enrolls teaches requires COURSE- OFFERINGS Is_offered I_id I_Name Dept I_Title Course_No Credits C_Title Syllabus Program S_Id Grade S_Name Time Secno Room Year Semester pre-requisite main-course
  • 27.
    For Video lectureon this topic please subscribe to my youtube channel. The link for my youtube channel is https://www.youtube.com/channel/UCRWGtE76JlTp1iim6aOTRuw?sub _confirmation=1 Dinesh Kumar Bhawnani, BIT DURG