SlideShare ist ein Scribd-Unternehmen logo
1 von 14
ERD
Practice
Exercises
Database Design
Exercise 1
Problem
• A company database needs to store information
about employees (identified by ssn, with salary and
phone as attributes), departments (identified by
dno, with dname and budget as attributes), and
children of employees (with name and age as
attributes).
Exercise 1
Problem
• Employees work in departments; each department
is managed by an employee; a child must be
identified uniquely by name when the parent (who
is an employee; assume that only one parent works
for the company) is known. We are not interested in
information about a child once the parent leaves
the company.
• Draw an ER diagram that captures this information.
Exercise 1
Solution
• First, we shall design the entities and relationships.
o “Employees work in departments…”
o “…each department is managed by an employee…”
o “…a child must be identified uniquely by name when the parent (who is
an employee; assume that only one parent works for the company) is
known.”
Exercise 1
Solution
Exercise 1
Solution
o “…each department is managed by an employee…”
o “…a child must be identified uniquely by name when the parent (who is
an employee; assume that only one parent works for the company) is
known. “
o “We are not interested in information about a child once the parent
leaves the company.”
Exercise 2
Problem
• Although you always wanted to be an artist, you
ended up being an expert on databases because
you love to cook data and you somehow confused
database with data baste. Your old love is still there,
however, so you set up a database company,
ArtBase, that builds a product for art galleries. The
core of this product is a database with a schema
that captures all the information that galleries need
to maintain.
Exercise 2
Problem
• Galleries keep information about artists, their names
(which are unique), birthplaces, age,and style of
art. For each piece of artwork, the artist, the year it
was made, its unique title, its type of art (e.g.,
painting, lithograph, sculpture, photograph), and its
price must be stored. Pieces of artwork are also
classified into groups of various kinds, for example,
portraits, still lifes, works by Picasso, or works of the
19th century; a given piece may belong to more
than one group.
Exercise 2
Problem
• Each group is identified by a name (like those just
given) that describes the group. Finally, galleries
keep information about customers. For each
customer, galleries keep that person’s unique
name, address, total amount of dollars spent in the
gallery (very important!), and the artists and groups
of art that the customer tends to like.
• Draw the ER diagram for the database.
Exercise 2
Solution
• Like before, we begin with the entities and
relationships.
• “…artists, their names (which are unique),
birthplaces, age, and style of art.”
• “For each piece of artwork, the artist, the year it
was made, its unique title, its type of art … and its
price must be stored.”
Exercise 2
Solution
• “Pieces of artwork are also classified into groups of
various kinds, … Each group is identified by a name
(like those just given) that describes the group. “
• For each customer, galleries keep that person’s
unique name, address, total amount of dollars
spent in the gallery (very important!), and the artists
and groups of art that the customer tends to like.
Exercise 2
Solution
Exercise 2
Solution
• Now we look at constraints.
o Although not explicitly mentioned in the problem, we assume that each
piece of artwork had to be painted by an artist.
o We also assume that each piece of artwork was created by exactly one
artist.
Exercise 2
Solution
• Suppose we had several piece of artwork with the
same title, and we told them apart by artist?
• Example: “What is Love?” by Cheryl D, “What is
Love?” by Joe Brown, etc.

Weitere ähnliche Inhalte

Was ist angesagt?

Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
tameemyousaf
 
Enhanced E-R diagram
Enhanced E-R diagramEnhanced E-R diagram
Enhanced E-R diagram
Mayank Jain
 
Lecture 01 introduction to database
Lecture 01 introduction to databaseLecture 01 introduction to database
Lecture 01 introduction to database
emailharmeet
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
Komal Singh
 

Was ist angesagt? (20)

1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
 
Database security
Database securityDatabase security
Database security
 
Data models
Data modelsData models
Data models
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMS
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 
Dbms lab questions
Dbms lab questionsDbms lab questions
Dbms lab questions
 
Enhanced E-R diagram
Enhanced E-R diagramEnhanced E-R diagram
Enhanced E-R diagram
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Fundamentals of Database system
Fundamentals of Database systemFundamentals of Database system
Fundamentals of Database system
 
Lecture 01 introduction to database
Lecture 01 introduction to databaseLecture 01 introduction to database
Lecture 01 introduction to database
 
Sql server T-sql basics ppt-3
Sql server T-sql basics  ppt-3Sql server T-sql basics  ppt-3
Sql server T-sql basics ppt-3
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Introduction: Databases and Database Users
Introduction: Databases and Database UsersIntroduction: Databases and Database Users
Introduction: Databases and Database Users
 
Chapter10 conceptual data modeling
Chapter10 conceptual data modelingChapter10 conceptual data modeling
Chapter10 conceptual data modeling
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
 
Er diagrams presentation
Er diagrams presentationEr diagrams presentation
Er diagrams presentation
 
Database Chapter 3
Database Chapter 3Database Chapter 3
Database Chapter 3
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
 

Ähnlich wie Erd practice exercises

Ähnlich wie Erd practice exercises (14)

Ap art
Ap artAp art
Ap art
 
Components of an Art Critique_Contemporary Phi. Arts
Components of an Art Critique_Contemporary Phi. ArtsComponents of an Art Critique_Contemporary Phi. Arts
Components of an Art Critique_Contemporary Phi. Arts
 
Conceptualizing
ConceptualizingConceptualizing
Conceptualizing
 
Surrealismproject
SurrealismprojectSurrealismproject
Surrealismproject
 
Year 7 ceramics families are unique totem-2020 wd
Year 7 ceramics  families are unique totem-2020 wdYear 7 ceramics  families are unique totem-2020 wd
Year 7 ceramics families are unique totem-2020 wd
 
Label work why
Label work whyLabel work why
Label work why
 
Zp term 1
Zp term 1Zp term 1
Zp term 1
 
Marketing Workshop 2 Powerpoint Festivals, Pricing And Presentation
Marketing Workshop 2 Powerpoint  Festivals, Pricing And PresentationMarketing Workshop 2 Powerpoint  Festivals, Pricing And Presentation
Marketing Workshop 2 Powerpoint Festivals, Pricing And Presentation
 
Opencall rules
Opencall rulesOpencall rules
Opencall rules
 
Chapter Four Art Criticism
Chapter Four Art CriticismChapter Four Art Criticism
Chapter Four Art Criticism
 
Wartime Marketing 1942 Smithsonian
Wartime Marketing 1942 SmithsonianWartime Marketing 1942 Smithsonian
Wartime Marketing 1942 Smithsonian
 
KCC Art 211 Ch 5 Critiquing Art
KCC Art 211 Ch 5 Critiquing ArtKCC Art 211 Ch 5 Critiquing Art
KCC Art 211 Ch 5 Critiquing Art
 
Limacon 2014 CC Algebra Activities
Limacon 2014 CC Algebra ActivitiesLimacon 2014 CC Algebra Activities
Limacon 2014 CC Algebra Activities
 
Art Criticism Instructions
Art Criticism InstructionsArt Criticism Instructions
Art Criticism Instructions
 

Mehr von Jennifer Polack

Mehr von Jennifer Polack (20)

Catalogued and student workers database(use cases diagram)
Catalogued and student workers database(use cases diagram)Catalogued and student workers database(use cases diagram)
Catalogued and student workers database(use cases diagram)
 
Trainer use cases
Trainer use casesTrainer use cases
Trainer use cases
 
Umw training program
Umw training programUmw training program
Umw training program
 
Classroom scheduler update
Classroom scheduler updateClassroom scheduler update
Classroom scheduler update
 
Temperature data analyzer requirements
Temperature data analyzer requirementsTemperature data analyzer requirements
Temperature data analyzer requirements
 
Training Programming Description- Morning Section
Training Programming Description- Morning SectionTraining Programming Description- Morning Section
Training Programming Description- Morning Section
 
Training Programming Description- Afternoon Section
Training Programming Description- Afternoon SectionTraining Programming Description- Afternoon Section
Training Programming Description- Afternoon Section
 
Cataloged and student workers database
Cataloged and student workers databaseCataloged and student workers database
Cataloged and student workers database
 
Temperature Analyzer Project
Temperature Analyzer ProjectTemperature Analyzer Project
Temperature Analyzer Project
 
Database design
Database designDatabase design
Database design
 
System Modelling
System ModellingSystem Modelling
System Modelling
 
Software process
Software processSoftware process
Software process
 
Agile software process
Agile software processAgile software process
Agile software process
 
What is software engineering
What is software engineeringWhat is software engineering
What is software engineering
 
Requirements engineering
Requirements engineeringRequirements engineering
Requirements engineering
 
Chapter 11
Chapter 11Chapter 11
Chapter 11
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Ccsc 2015 panel
Ccsc 2015 panelCcsc 2015 panel
Ccsc 2015 panel
 
Chapter 8
Chapter 8Chapter 8
Chapter 8
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 

Erd practice exercises

  • 2. Exercise 1 Problem • A company database needs to store information about employees (identified by ssn, with salary and phone as attributes), departments (identified by dno, with dname and budget as attributes), and children of employees (with name and age as attributes).
  • 3. Exercise 1 Problem • Employees work in departments; each department is managed by an employee; a child must be identified uniquely by name when the parent (who is an employee; assume that only one parent works for the company) is known. We are not interested in information about a child once the parent leaves the company. • Draw an ER diagram that captures this information.
  • 4. Exercise 1 Solution • First, we shall design the entities and relationships. o “Employees work in departments…” o “…each department is managed by an employee…” o “…a child must be identified uniquely by name when the parent (who is an employee; assume that only one parent works for the company) is known.”
  • 6. Exercise 1 Solution o “…each department is managed by an employee…” o “…a child must be identified uniquely by name when the parent (who is an employee; assume that only one parent works for the company) is known. “ o “We are not interested in information about a child once the parent leaves the company.”
  • 7. Exercise 2 Problem • Although you always wanted to be an artist, you ended up being an expert on databases because you love to cook data and you somehow confused database with data baste. Your old love is still there, however, so you set up a database company, ArtBase, that builds a product for art galleries. The core of this product is a database with a schema that captures all the information that galleries need to maintain.
  • 8. Exercise 2 Problem • Galleries keep information about artists, their names (which are unique), birthplaces, age,and style of art. For each piece of artwork, the artist, the year it was made, its unique title, its type of art (e.g., painting, lithograph, sculpture, photograph), and its price must be stored. Pieces of artwork are also classified into groups of various kinds, for example, portraits, still lifes, works by Picasso, or works of the 19th century; a given piece may belong to more than one group.
  • 9. Exercise 2 Problem • Each group is identified by a name (like those just given) that describes the group. Finally, galleries keep information about customers. For each customer, galleries keep that person’s unique name, address, total amount of dollars spent in the gallery (very important!), and the artists and groups of art that the customer tends to like. • Draw the ER diagram for the database.
  • 10. Exercise 2 Solution • Like before, we begin with the entities and relationships. • “…artists, their names (which are unique), birthplaces, age, and style of art.” • “For each piece of artwork, the artist, the year it was made, its unique title, its type of art … and its price must be stored.”
  • 11. Exercise 2 Solution • “Pieces of artwork are also classified into groups of various kinds, … Each group is identified by a name (like those just given) that describes the group. “ • For each customer, galleries keep that person’s unique name, address, total amount of dollars spent in the gallery (very important!), and the artists and groups of art that the customer tends to like.
  • 13. Exercise 2 Solution • Now we look at constraints. o Although not explicitly mentioned in the problem, we assume that each piece of artwork had to be painted by an artist. o We also assume that each piece of artwork was created by exactly one artist.
  • 14. Exercise 2 Solution • Suppose we had several piece of artwork with the same title, and we told them apart by artist? • Example: “What is Love?” by Cheryl D, “What is Love?” by Joe Brown, etc.