SlideShare a Scribd company logo
ER diagram practice
Activity 1:
Draw an entity relationship diagram for the given senario. Mention keys,
cardinality ratios and participation with proper notation. State assumption if
any.
Please note that after solving this activity there is going to be a class
participation activity. Please pay attention and solve this activity with me step
by step for good practice .
Departmental store database
A store wants to keep track of all its musical albums.
1. Musical album have a title, price , a unique identifier as albumId
2. There are artists who create albums. We save artists name and CNIC for
our record.
3. One artist can create multiple albums. But one album can only belong to
a single artist.
4. One album can be of a single genre.
5. Genre has genereID , name, description.
6. Multiple albums can have a same genre.
Step 1: find all entities and their
attributes.
1. Musical album have a title,
price , a unique identifier
as albumId
2. There are artists who create albums. We
save artists name and CNIC for our
record.
3. One artist can create multiple albums.
But one album can only belong to a
single artist.
4. One album can be of a single genre.
5. Genre has genereID , name, description.
6. Multiple albums can have a same genre.
Step 1: find all entities and their
attributes.
1. Musical album have a title,
price , a unique identifier
as albumId
2. There are artists who create albums. We
save artists name and CNIC for our
record.
3. One artist can create multiple albums.
But one album can only belong to a
single artist.
4. One album can be of a single genre.
5. Genre has genereID , name, description.
6. Multiple albums can have a same genre.
Album
albumid
Title
Price
Step 1: find all entities and their
attributes.
1. Musical album have a title, price , a
unique identifier as albumId
2. There are artists who create
albums. We save artists name
and CNIC for our record.
3. One artist can create multiple albums.
But one album can only belong to a
single artist.
4. One album can be of a single genre.
5. Genre has genereID , name, description.
6. Multiple albums can have a same genre.
Step 1: find all entities and their
attributes.
1. Musical album have a title, price , a
unique identifier as albumId
2. There are artists who create
albums. We save artists name
and CNIC for our record.
3. One artist can create multiple albums.
But one album can only belong to a
single artist.
4. One album can be of a single genre.
5. Genre has genereID , name, description.
6. Multiple albums can have a same genre.
Album
albumid
Title
Price
Artists
CNIC
Nam
e
Step 2: find all entities and their
attributes. + relationship
1. Musical album have a title, price , a
unique identifier as albumId
2. There are artists who create
albums. We save artists name
and CNIC for our record.
3. One artist can create multiple albums.
But one album can only belong to a
single artist.
4. One album can be of a single genre.
5. Genre has genereID , name, description.
6. Multiple albums can have a same genre.
Album
albumid
Title
Price
Artists
CNIC
Nam
e
Creat
es
Step 2: find all entities and their
attributes. + relationship
1. Musical album have a title, price , a
unique identifier as albumId
2. There are artists who create albums. We
save artists name and CNIC for our
record.
3. One artist can create multiple
albums. But one album can
only belong to a single artist.
4. One album can be of a single genre.
5. Genre has genereID , name, description.
6. Multiple albums can have a same genre.
Album
albumid
Title
Price
Artists
CNIC
Nam
e
Creat
es
Step 2: find all entities and their
attributes. + relationship
1. Musical album have a title, price , a
unique identifier as albumId
2. There are artists who create albums. We
save artists name and CNIC for our
record.
3. One artist can create
multiple albums. But one
album can only belong to
a single artist.
4. One album can be of a single genre.
5. Genre has genereID , name, description.
6. Multiple albums can have a same genre.
Album
albumid
Title
Price
Artists
CNIC
Nam
e
Creat
es
1
M
Step 2: find all entities and their
attributes. + Relationship
1. Musical album have a title, price , a
unique identifier as albumId
2. There are artists who create albums. We
save artists name and CNIC for our
record.
3. One artist can create multiple albums.
But one album can only belong to a
single artist.
4. One album can be of a
single genre.
5. Genre has genereID ,
name, description.
6. Multiple albums can have
a same genre.
Album
albumid
Title
Price
Artists
CNIC
Nam
e
Creat
es
1
M
Step 2: find all entities and their attributes. +
relationship
1. Musical album have a title, price , a unique
identifier as albumId
2. There are artists who create albums. We save
artists name and CNIC for our record.
3. One artist can create multiple albums. But one
album can only belong to a single artist.
4. One album can be of a single
genre.
5. Genre has genereID , name,
description.
6. Multiple albums can have a
same genre.
Album
albumid
Title
Price
Artists
CNIC
Nam
e
Creat
es
1
M
Genre
genreid
nam
e
descriptio
n
Has
1
M
Step 3: find all entities and their attributes. +
relationship + participation
1. Musical album have a title, price , a unique
identifier as albumId
2. There are artists who create albums. We save
artists name and CNIC for our record.
3. One artist can create multiple albums. But one
album can only belong to a single artist.
4. One album can be of a single genre.
5. Genre has genereID , name, description.
6. Multiple albums can have a same genre.
Assumption1 : album cannot be
created without artist. But artist can exist
without launching an album.
Assumption 2: album will have genre but
there is possibility that genre exists but there is
not album on that genre.
Album
albumid
Title
Price
Artists
CNIC
Nam
e
Creat
es
1
M
Genre
genreid
nam
e
descriptio
n
Has
1
M
Activity # 2
Activity # 2
Lecture 2.5 ER Diagram and practice in DB.pptx
Lecture 2.5 ER Diagram and practice in DB.pptx
Lecture 2.5 ER Diagram and practice in DB.pptx
Lecture 2.5 ER Diagram and practice in DB.pptx
Lecture 2.5 ER Diagram and practice in DB.pptx
Lecture 2.5 ER Diagram and practice in DB.pptx
Activity # 2
Draw an entity relationship diagram for the given senario. Mention keys, cardinality ratios and
participation with proper notation. State assumption if any.
 . Consider a MOVIEdatabase in which data is recorded about the movie industry.The data
requirements are summarized as follows:
 Each movie is identified by title and year of release. Each movie has a length in minutes. Each has
a production company, and each is classified under one or more genres (such as horror, action,
drama, and so forth). Each movie has one or more directors and one or more actors appear in
it.Each movie also has a plot outline.Finally,each movie has zero or more quotable quotes, each of
which is spoken by a particular actor appearing in the movie.
 Actors are identified by name and date of birth and appear in one or more movies.Each actor has
a role in the movie.
 Directors are also identified by name and date of birth and direct one or more movies.It is possible
for a director to act in a movie (including one that he or she may also direct).
 Production companies are identified by name and each has an address.A production company
produces one or more movies.
Activity # 3 Company database
 The company is organized into departments. Each department has a unique name, a
unique number, and a particular employee who manages the department. We keep
track of the start date when that employee began managing the department. A
department may have several locations.
 A department controls a number of projects, each of which has a unique name, a
unique number, and a single location.
 We store each employee’s name, Social Security number,2 address, salary, gender ,
and birth date. An employee is assigned to one department, but may work on several
projects, which are not necessarily controlled by the same department. We keep track
of the current number of hours per week that an employee works on each project. We
also keep track of the direct supervisor of each employee (who is another employee).
 We want to keep track of the dependents of each employee for insurance purposes.
We keep each dependent’s first name, gender, birth date, and relationship to the
employee. We only need the data of dependent till employee will work for us.
Lecture 2.5 ER Diagram and practice in DB.pptx
Exercise # 4
 A manufacturing company produces products. The following product information is stored:
product name, product ID and quantity on hand. These products are made up of many
components. Each component can be supplied by one or more suppliers. The following
component information is kept: component ID, name, description, suppliers who supply them,
and products in which they are used. Use Figure B.1 for this exercise.
 Create an ERD to show how you would track this information.
 Show entity names, primary keys, attributes for each entity, relationships between the entities
and cardinality.
 Assumptions
• A supplier can exist without providing components.
• A component does not have to be associated with a supplier.
• A component does not have to be associated with a product. Not all components are used in products.
• A product cannot exist without components.

More Related Content

PPTX
Introduction to Database Management Systems
DOCX
ERD FOR UC OnlineRequirement Each book has an i.docx
DOCX
ERD FOR UC OnlineRequirement Each book has an i.docx
PPTX
Lecture7.pptx
PPTX
ERD introduction in databases model.pptx
PPTX
Basic building entity relationship model
PPTX
E - R Models.pptx SQL and plsql database
DOCX
The goal of the projects throughout this semester is to implement .docx
Introduction to Database Management Systems
ERD FOR UC OnlineRequirement Each book has an i.docx
ERD FOR UC OnlineRequirement Each book has an i.docx
Lecture7.pptx
ERD introduction in databases model.pptx
Basic building entity relationship model
E - R Models.pptx SQL and plsql database
The goal of the projects throughout this semester is to implement .docx

Similar to Lecture 2.5 ER Diagram and practice in DB.pptx (20)

PDF
Unit 2-Data Modeling.pdf
PPTX
Unit 2 new.pptx for the actual dbms chad
PPTX
Logical Design and Conceptual Database Design
PPTX
13. case study
PPTX
Logical ERD 2022.pptx
PPTX
Database design
PPTX
Database design
PPTX
ER MODEL
PDF
ER diagram is created based on three principal components: entities, attribut...
PPTX
Er diagram
PPT
database1
PDF
DATABASE DESIGNS ER DIAGRAMS REATIONA; ALGEBRA
PDF
Relational data base and Er diagema Normalization
PPTX
Introduction of Database Design and Development
PDF
Comprehensive Guide to Effective ER Diagram Principles
PDF
RDBMS ERD Examples
PPTX
DBMS_Data Model,Keys,Attributes,Relationship.pptx
DOCX
SECTION 1Data Fundamentals OverviewSection Beginning (.docx
ODP
BIS03 Data Modelling - I
PDF
3. Chapter Three.pdf
Unit 2-Data Modeling.pdf
Unit 2 new.pptx for the actual dbms chad
Logical Design and Conceptual Database Design
13. case study
Logical ERD 2022.pptx
Database design
Database design
ER MODEL
ER diagram is created based on three principal components: entities, attribut...
Er diagram
database1
DATABASE DESIGNS ER DIAGRAMS REATIONA; ALGEBRA
Relational data base and Er diagema Normalization
Introduction of Database Design and Development
Comprehensive Guide to Effective ER Diagram Principles
RDBMS ERD Examples
DBMS_Data Model,Keys,Attributes,Relationship.pptx
SECTION 1Data Fundamentals OverviewSection Beginning (.docx
BIS03 Data Modelling - I
3. Chapter Three.pdf
Ad

More from imranahmadrana28 (12)

PPT
06-Pumping Lamma in theory of automata .ppt
PPTX
Lecture 10 DML5CorelatedNested in DB.pptx
PPTX
Lecture 8 DML3 aggregate functions in DB.pptx
PPTX
Lecture 3 Logical Design Mapping in DB.pptx
PPT
Windows Server 2008 Printing in server.ppt
PPT
Port Scanning in computer networks with .ppt
PPT
Packet Filtering in computer networks.ppt
PPTX
Firewall in computer networks and C.pptx
PPT
DHCP sever configration in computer .ppt
PPT
ACTIVE-DIRECTORY in system and network .ppt
PPTX
Lec 1 Compiler Construction (CC) CC.pptx
PPT
Fundamentals of Algorithms in computer G
06-Pumping Lamma in theory of automata .ppt
Lecture 10 DML5CorelatedNested in DB.pptx
Lecture 8 DML3 aggregate functions in DB.pptx
Lecture 3 Logical Design Mapping in DB.pptx
Windows Server 2008 Printing in server.ppt
Port Scanning in computer networks with .ppt
Packet Filtering in computer networks.ppt
Firewall in computer networks and C.pptx
DHCP sever configration in computer .ppt
ACTIVE-DIRECTORY in system and network .ppt
Lec 1 Compiler Construction (CC) CC.pptx
Fundamentals of Algorithms in computer G
Ad

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Electronic commerce courselecture one. Pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
KodekX | Application Modernization Development
PDF
cuic standard and advanced reporting.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
Teaching material agriculture food technology
NewMind AI Weekly Chronicles - August'25 Week I
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Diabetes mellitus diagnosis method based random forest with bat algorithm
Electronic commerce courselecture one. Pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Unlocking AI with Model Context Protocol (MCP)
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Programs and apps: productivity, graphics, security and other tools
KodekX | Application Modernization Development
cuic standard and advanced reporting.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
sap open course for s4hana steps from ECC to s4
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Teaching material agriculture food technology

Lecture 2.5 ER Diagram and practice in DB.pptx

  • 2. Activity 1: Draw an entity relationship diagram for the given senario. Mention keys, cardinality ratios and participation with proper notation. State assumption if any. Please note that after solving this activity there is going to be a class participation activity. Please pay attention and solve this activity with me step by step for good practice .
  • 3. Departmental store database A store wants to keep track of all its musical albums. 1. Musical album have a title, price , a unique identifier as albumId 2. There are artists who create albums. We save artists name and CNIC for our record. 3. One artist can create multiple albums. But one album can only belong to a single artist. 4. One album can be of a single genre. 5. Genre has genereID , name, description. 6. Multiple albums can have a same genre.
  • 4. Step 1: find all entities and their attributes. 1. Musical album have a title, price , a unique identifier as albumId 2. There are artists who create albums. We save artists name and CNIC for our record. 3. One artist can create multiple albums. But one album can only belong to a single artist. 4. One album can be of a single genre. 5. Genre has genereID , name, description. 6. Multiple albums can have a same genre.
  • 5. Step 1: find all entities and their attributes. 1. Musical album have a title, price , a unique identifier as albumId 2. There are artists who create albums. We save artists name and CNIC for our record. 3. One artist can create multiple albums. But one album can only belong to a single artist. 4. One album can be of a single genre. 5. Genre has genereID , name, description. 6. Multiple albums can have a same genre. Album albumid Title Price
  • 6. Step 1: find all entities and their attributes. 1. Musical album have a title, price , a unique identifier as albumId 2. There are artists who create albums. We save artists name and CNIC for our record. 3. One artist can create multiple albums. But one album can only belong to a single artist. 4. One album can be of a single genre. 5. Genre has genereID , name, description. 6. Multiple albums can have a same genre.
  • 7. Step 1: find all entities and their attributes. 1. Musical album have a title, price , a unique identifier as albumId 2. There are artists who create albums. We save artists name and CNIC for our record. 3. One artist can create multiple albums. But one album can only belong to a single artist. 4. One album can be of a single genre. 5. Genre has genereID , name, description. 6. Multiple albums can have a same genre. Album albumid Title Price Artists CNIC Nam e
  • 8. Step 2: find all entities and their attributes. + relationship 1. Musical album have a title, price , a unique identifier as albumId 2. There are artists who create albums. We save artists name and CNIC for our record. 3. One artist can create multiple albums. But one album can only belong to a single artist. 4. One album can be of a single genre. 5. Genre has genereID , name, description. 6. Multiple albums can have a same genre. Album albumid Title Price Artists CNIC Nam e Creat es
  • 9. Step 2: find all entities and their attributes. + relationship 1. Musical album have a title, price , a unique identifier as albumId 2. There are artists who create albums. We save artists name and CNIC for our record. 3. One artist can create multiple albums. But one album can only belong to a single artist. 4. One album can be of a single genre. 5. Genre has genereID , name, description. 6. Multiple albums can have a same genre. Album albumid Title Price Artists CNIC Nam e Creat es
  • 10. Step 2: find all entities and their attributes. + relationship 1. Musical album have a title, price , a unique identifier as albumId 2. There are artists who create albums. We save artists name and CNIC for our record. 3. One artist can create multiple albums. But one album can only belong to a single artist. 4. One album can be of a single genre. 5. Genre has genereID , name, description. 6. Multiple albums can have a same genre. Album albumid Title Price Artists CNIC Nam e Creat es 1 M
  • 11. Step 2: find all entities and their attributes. + Relationship 1. Musical album have a title, price , a unique identifier as albumId 2. There are artists who create albums. We save artists name and CNIC for our record. 3. One artist can create multiple albums. But one album can only belong to a single artist. 4. One album can be of a single genre. 5. Genre has genereID , name, description. 6. Multiple albums can have a same genre. Album albumid Title Price Artists CNIC Nam e Creat es 1 M
  • 12. Step 2: find all entities and their attributes. + relationship 1. Musical album have a title, price , a unique identifier as albumId 2. There are artists who create albums. We save artists name and CNIC for our record. 3. One artist can create multiple albums. But one album can only belong to a single artist. 4. One album can be of a single genre. 5. Genre has genereID , name, description. 6. Multiple albums can have a same genre. Album albumid Title Price Artists CNIC Nam e Creat es 1 M Genre genreid nam e descriptio n Has 1 M
  • 13. Step 3: find all entities and their attributes. + relationship + participation 1. Musical album have a title, price , a unique identifier as albumId 2. There are artists who create albums. We save artists name and CNIC for our record. 3. One artist can create multiple albums. But one album can only belong to a single artist. 4. One album can be of a single genre. 5. Genre has genereID , name, description. 6. Multiple albums can have a same genre. Assumption1 : album cannot be created without artist. But artist can exist without launching an album. Assumption 2: album will have genre but there is possibility that genre exists but there is not album on that genre. Album albumid Title Price Artists CNIC Nam e Creat es 1 M Genre genreid nam e descriptio n Has 1 M
  • 22. Activity # 2 Draw an entity relationship diagram for the given senario. Mention keys, cardinality ratios and participation with proper notation. State assumption if any.  . Consider a MOVIEdatabase in which data is recorded about the movie industry.The data requirements are summarized as follows:  Each movie is identified by title and year of release. Each movie has a length in minutes. Each has a production company, and each is classified under one or more genres (such as horror, action, drama, and so forth). Each movie has one or more directors and one or more actors appear in it.Each movie also has a plot outline.Finally,each movie has zero or more quotable quotes, each of which is spoken by a particular actor appearing in the movie.  Actors are identified by name and date of birth and appear in one or more movies.Each actor has a role in the movie.  Directors are also identified by name and date of birth and direct one or more movies.It is possible for a director to act in a movie (including one that he or she may also direct).  Production companies are identified by name and each has an address.A production company produces one or more movies.
  • 23. Activity # 3 Company database  The company is organized into departments. Each department has a unique name, a unique number, and a particular employee who manages the department. We keep track of the start date when that employee began managing the department. A department may have several locations.  A department controls a number of projects, each of which has a unique name, a unique number, and a single location.  We store each employee’s name, Social Security number,2 address, salary, gender , and birth date. An employee is assigned to one department, but may work on several projects, which are not necessarily controlled by the same department. We keep track of the current number of hours per week that an employee works on each project. We also keep track of the direct supervisor of each employee (who is another employee).  We want to keep track of the dependents of each employee for insurance purposes. We keep each dependent’s first name, gender, birth date, and relationship to the employee. We only need the data of dependent till employee will work for us.
  • 25. Exercise # 4  A manufacturing company produces products. The following product information is stored: product name, product ID and quantity on hand. These products are made up of many components. Each component can be supplied by one or more suppliers. The following component information is kept: component ID, name, description, suppliers who supply them, and products in which they are used. Use Figure B.1 for this exercise.  Create an ERD to show how you would track this information.  Show entity names, primary keys, attributes for each entity, relationships between the entities and cardinality.  Assumptions • A supplier can exist without providing components. • A component does not have to be associated with a supplier. • A component does not have to be associated with a product. Not all components are used in products. • A product cannot exist without components.