SlideShare a Scribd company logo
Lecture 9:
Conceptual Database Design
January 27th
, 2003
Building an Application with a
DBMS
• Requirements modeling (conceptual, pictures)
– Decide what entities should be part of the application and
how they should be linked.
• Schema design and implementation
– Decide on a set of tables, attributes.
– Define the tables in the database system.
– Populate database (insert tuples).
• Write application programs using the DBMS
– way easier now that the data management is taken care of.
Database Design
• Why do we need it?
– Agree on structure of the database before
deciding on a particular implementation.
• Consider issues such as:
– What entities to model
– How entities are related
– What constraints exist in the domain
– How to achieve good designs
Database Design Formalisms
1. Object Definition Language (ODL):
– Closer in spirit to object-oriented models
– I don’t teach it anymore.
2. Entity/Relationship model (E/R):
– More relational in nature.
• Both can be translated (semi-automatically) to
relational schemas
• ODL to OO-schema: direct transformation (C++
or Smalltalk based system).
2. Entity / Relationship Diagrams
Entities
Attributes
Relationships between entities
Product
address
buys
Keys in E/R Diagrams
• Every entity set must have a key
Product
name category
price
address name ssn
Person
buys
makes
employs
Company
Product
name category
stockprice
name
price
What is a Relation ?
• A mathematical definition:
– if A, B are sets, then a relation R is a subset of
A x B
• A={1,2,3}, B={a,b,c,d},
R = {(1,a), (1,c), (3,b)}
- makes is a subset of Product x Company:
1
2
3
a
b
c
d
A=
B=
makes Company
Product
Multiplicity of E/R Relations
• one-one:
• many-one
• many-many
1
2
3
a
b
c
d
1
2
3
a
b
c
d
1
2
3
a
b
c
d
address name ssn
Person
buys
makes
employs
Company
Product
name category
stockprice
name
price
What does
this say ?
Multi-way Relationships
How do we model a purchase relationship between buyers,
products and stores?
Purchase
Product
Person
Store
Can still model as a mathematical set (how ?)
Q: what does the arrow mean ?
A: if I know the store, person, invoice, I know the
movie too
Rental
VideoStore
Person
Movie
Invoice
Arrows in Multiway
Relationships
Q: what do these arrow mean ?
A: store, person, invoice determines movie and store,
invoice, movie determines person
Rental
VideoStore
Person
Movie
Invoice
Arrows in Multiway
Relationships
Q: how do I say: “invoice determines store” ?
A: no good way; best approximation:
Q: Why is this incomplete ?
Rental
VideoStore
Person
Movie
Invoice
Arrows in Multiway
Relationships
Roles in Relationships
Purchase
What if we need an entity set twice in one relationship?
Product
Person
Store
salesperson buyer
Attributes on Relationships
Purchase
Product
Person
Store
date
Converting Multi-way
Relationships to Binary
Purchase
Person
Store
Product
StoreOf
ProductOf
BuyerOf
date
From E/R Diagrams
to Relational Schema
• Entity set  relation
• Relationship  relation
Entity Set to Relation
Product
name category
price
Product(name, category, price)
name category price
gizmo gadgets $19.99
Relationships to Relations
makes Company
Product
name category
Stock price
name
Makes(product-name, product-category, company-name, year)
Product-name Product-Category Company-name Starting-year
gizmo gadgets gizmoWorks 1963
Start Year
price
(watch out for attribute name conflicts)
Relationships to Relations
makes Company
Product
name category
Stock price
name
No need for Makes. Modify Product:
name category price StartYear companyName
gizmo gadgets 19.99 1963 gizmoWorks
Start Year
price
Multi-way Relationships to
Relations
Purchase
Product
Person
Store
name price
ssn name
name address
Purchase( , , )
3. Design Principles
Purchase
Product Person
What’s wrong?
President Person
Country
Moral: be faithful!
Design Principles:
What’s Wrong?
Purchase
Product
Store
date
personName
personAddr
Moral: pick the right
kind of entities.
Design Principles:
What’s Wrong?
Purchase
Product
Person
Store
date
Dates
Moral: don’t
complicate life more
than it already is.
Modeling Subclasses
The world is inherently hierarchical. Some entities are
special cases of others
• We need a notion of subclass.
• This is supported naturally in object-oriented
formalisms.
Products
Software
products
Educational
products
Product
name category
price
isa isa
Educational Product
Software Product
Age Group
platforms
Subclasses in E/R Diagrams
Understanding Subclasses
• Think in terms of
records:
– Product
– SoftwareProduct
– EducationalProduct
field1
field2
field1
field2
field1
field2
field3
field4
field5
Subclasses to Relations
Product
name category
price
isa isa
Educational Product
Software Product
Age Group
platforms
Name Price Category
Gizmo 99 gadget
Camera 49 photo
Toy 39 gadget
Name platforms
Gizmo unix
Name Age Group
Gizmo todler
Toy retired
Product
Sw.Product
Ed.Product
Modeling UnionTypes With
Subclasses
FurniturePiece
Person
Company
Say: each piece of furniture is owned either
by a person, or by a company
Modeling Union Types with
Subclasses
Say: each piece of furniture is owned either by a
person, or by a company
Solution 1. Acceptable, imperfect (What’s wrong ?)
FurniturePiece
Person Company
ownedByPerson ownedByPerson
Modeling Union Types with
Subclasses
Solution 2: better, more laborious
isa
FurniturePiece
Person Company
ownedBy
Owner
isa
Constraints in E/R Diagrams
Finding constraints is part of the modeling process.
Commonly used constraints:
Keys: social security number uniquely identifies a person.
Single-value constraints: a person can have only one father.
Referential integrity constraints: if you work for a company, it
must exist in the database.
Other constraints: peoples’ ages are between 0 and 150.
Keys in E/R Diagrams
address name ssn
Person
Product
name category
price
No formal way
to specify multiple
keys in E/R diagrams
Underline:
Single Value Constraints
makes
makes
v. s.
Referential Integrity Constraints
Company
Product makes
Company
Product makes
Other Constraints
Company
Product makes
<100
What does this mean ?
Weak Entity Sets
Entity sets are weak when their key comes from other
classes to which they are related.
University
Team affiliation
number
sport name
Handling Weak Entity Sets
University
Team affiliation
number
sport name
Convert to a relational schema (in class)

More Related Content

Similar to Database Design in web and web database design (20)

PPT
ER_model
Qasim Zahid
 
PPTX
lecture-4-Data Base Mangement System and its types
DimpyJindal4
 
PPTX
rdbms3, dbms,dbms,rdbmssssssssssssssssssssssssssssssssss
VaibhavSrivastav52
 
PPT
Week 4 The Relational Data Model & The Entity Relationship Data Model
oudesign
 
PPTX
ch3 final.pptx
munnamicheal
 
PPT
RDBMS.ppt What is RDBMS RDBMS stands for Relational Database Management System.
SHAKIR325211
 
PPTX
Entity Relationship Model
Slideshare
 
PPT
Erd chapter 3
Nargis Ehsan
 
PPTX
ER modeling
Dabbal Singh Mahara
 
PDF
Mathematics MAT 122 (Coding in Mathematics 2)
victorabioye124
 
PPTX
E - R Models.pptx SQL and plsql database
ironman82715
 
PPT
10287 lecture5(2)
Universitas Bina Darma Palembang
 
PPT
DBMS UNIT1
CHANDRA BHUSHAN
 
PPT
Entity Relationship Diagram
Shakila Mahjabin
 
PDF
L7 er2
Tianlu Wang
 
PPTX
DATA MODEL PRESENTATION UNIT I-BCA I.pptx
JasmineMichael1
 
PPTX
Entityrelationshipmodel
Enes Bolfidan
 
PPTX
Unit 2 new.pptx for the actual dbms chad
sanketkashyap6
 
ER_model
Qasim Zahid
 
lecture-4-Data Base Mangement System and its types
DimpyJindal4
 
rdbms3, dbms,dbms,rdbmssssssssssssssssssssssssssssssssss
VaibhavSrivastav52
 
Week 4 The Relational Data Model & The Entity Relationship Data Model
oudesign
 
ch3 final.pptx
munnamicheal
 
RDBMS.ppt What is RDBMS RDBMS stands for Relational Database Management System.
SHAKIR325211
 
Entity Relationship Model
Slideshare
 
Erd chapter 3
Nargis Ehsan
 
ER modeling
Dabbal Singh Mahara
 
Mathematics MAT 122 (Coding in Mathematics 2)
victorabioye124
 
E - R Models.pptx SQL and plsql database
ironman82715
 
DBMS UNIT1
CHANDRA BHUSHAN
 
Entity Relationship Diagram
Shakila Mahjabin
 
L7 er2
Tianlu Wang
 
DATA MODEL PRESENTATION UNIT I-BCA I.pptx
JasmineMichael1
 
Entityrelationshipmodel
Enes Bolfidan
 
Unit 2 new.pptx for the actual dbms chad
sanketkashyap6
 

More from hannahroseline2 (9)

PPTX
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
PPTX
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
PPTX
introduction of HTML canvas and styles .pptx
hannahroseline2
 
PPTX
UNIX OPERATING SYSTEM Internals and Architecture.pptx
hannahroseline2
 
PPT
wholeness of data analytics in cyber security.ppt
hannahroseline2
 
PPT
What is data analytics ,Data science,Data processing chain,regression,decisio...
hannahroseline2
 
PPT
OOPs concept and java Environment decsion making statement looping array and ...
hannahroseline2
 
PPTX
Cyberstalking CyberstalkingCyberstalking
hannahroseline2
 
PPT
Unit 1- Basic concept of object-oriented-programming.ppt
hannahroseline2
 
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
introduction of HTML canvas and styles .pptx
hannahroseline2
 
UNIX OPERATING SYSTEM Internals and Architecture.pptx
hannahroseline2
 
wholeness of data analytics in cyber security.ppt
hannahroseline2
 
What is data analytics ,Data science,Data processing chain,regression,decisio...
hannahroseline2
 
OOPs concept and java Environment decsion making statement looping array and ...
hannahroseline2
 
Cyberstalking CyberstalkingCyberstalking
hannahroseline2
 
Unit 1- Basic concept of object-oriented-programming.ppt
hannahroseline2
 
Ad

Recently uploaded (20)

PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PPTX
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PPTX
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
PPTX
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
Dimensions of Societal Planning in Commonism
StefanMz
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Ad

Database Design in web and web database design