SlideShare a Scribd company logo
Introduction to Data Modeling
CS 146
What is a Data Model?
 Definition: precise description of the data content in a
system
 Types of data models:
1. Conceptual: describes WHAT the system contains
2. Logical: describes HOW the system will be implemented,
regardless of the DBMS
3. Physical: describes HOW the system will be implemented
using a specific DBMS
Why do we need to create data models?
 To aid in the development of a sound database design
that does not allow anomalies or inconsistencies
 Goal: to create database tables that do not contain
duplicate data values that can become inconsistent
Types of Data Models
 Entity-Relationship (E-R) Models
 Only addresses data and relationships
 Classic, simplest
 Best for deriving a sound table design
 Many extensions/variations exist
 Basis for most other modeling approaches
 UML (unified modeling language)
 Class models
 Goes beyond data, also models behaviors
Creating an Entity-Relationship Model
1. Identify entities
2. Identify entity attributes and primary keys
3. Specify relationships
Data Entities
 Entity
 A "thing" about which you want to store data in an
application
 Multiple examples (instances) of the entity must exist
 Goal:
 Store data about each entity in a separate table
 Do not store duplicate data in multiple tables or records
 Examples: CUSTOMER, PRODUCT
Data Model Naming Conventions
 Entity names are short, descriptive, compound word
singular nouns
 UWEC_STUDENT, CANDY_PRODUCT,
 Entity names will ultimately correspond to table names
 Why singular?
 Makes more sense when you start talking about relationships
Data Entity Instances
 Entity instance
 A specific occurrence (data value) of an entity
 An entity must have multiple entity instances or it is not
really an entity!
 Examples: Davey Jones, Celestial Cashew Crunch
ER Model Attributes
 Attribute
 A characteristic (data field) of an entity that you want to
store in the database
 Examples: CUST_ID, PROD_DESC
 Attribute value
 The value of a particular attribute for a particular entity
instance
 Examples: 42, "Nuts Not Nachos"
Data Model Naming Conventions
(continued)
 Attribute names are descriptive compound words
that correspond to the entity name
 Attribute names will ultimately correspond to field names
 Every attribute name within the database should be unique
ER Model Notation
 Represent entities as rectangles
 List attributes within the rectangle
Entity
Attributes
Primary key
Attributes Selection Issues
 Primary key
 Atomic
 Composite
 Multi-valued
 Derived
Primary Key Attributes
 Attribute whose value is unique for every entity instance
 Every entity MUST have a PK
 Designate by:
 Placing as first attribute in the entity
 Underline
 Label using "PK"
Selecting Primary Keys
 Must be values that are:
 Unique for every possible record
 Do not change
 Best practice: numeric with no blank spaces or
formatting characters
 Often you need to create a surrogate key
 ID value that serves only to identify the object in
the database
 Exception: objects with "natural" primary keys
 SKU
 ISBN
 VIN
Atomic and Composite Attributes
 Atomic attribute: represents a single data value
 15, “Daniel", 12/25/2009
 Composite attribute: can be decomposed into atomic
attributes
 "James B. Brown"
 "5580 Pinewood Road, Eau Claire, WI 54701"
 Should you ever allow a composite attribute in a database?
Composite Attributes
 Decompose into atomic components for:
 Sorting
 Searching
 Formatting
Student
Student_ID
Student_Name
Student_Address
Student_DOB
Student_Class
Student_First_Name
Student_MI
Student_Last_Name
Student_Address_Line_1
Student_Address_Line_2
Student_City
Student_State
Student_Country
Student_Postal_Code
Multi-Valued Attributes
 Can have multiple values for the same entity
Student
Student_ID (PK)
Student_First_Name
Student_Last_Name
Student_Address
Student_DOB
Student_Class
Student_Phone1
Student_Phone2
Employee
Employee_ID (PK)
Employee_First_Name
Employee_Last_Name
Employee_Address
Employee_DOB
Employee_Dependent1
Employee_Dependent2
Handling Multi-valued Attributes
 If it has a definite maximum number, leave as a repeating
attribute
 If the upper limit is variable, make a new entity
Student
Student_ID
Student_First_Name
Student_Last_Name
Student_Address
Student_DOB
Student_Class
Student_Phone1
Student_Phone2
Employee
Employee_ID
Employee_First_Name
Employee_Last_Name
Employee_Address
Employee_DOB
Employee_Dependent1
Employee_Dependent2
Dependent
Dependent_ID
Dependent_Namehas
Derived Attributes
 Value that can be derived from other attributes
 Student_Age = 22 (DOB = 11/20/1986, current date is
11/13/2009)
 Order_Total = $500 (Item 1 cost = $200, Item 2 cost = $300)
Handling Derived Attributes
 Store the underlying data values from which you can
derive the attribute value …
 Examples:
 DOB => Age
 CurrentPrice and UnitsSold of an item (for a sales order)
 … unless the underlying values can change!
 PRODUCT_PRICE, COURSE_CREDITS
Creating an Entity-Relationship Model
1. Identify entities
2. Identify entity attributes and primary keys
3. Specify relationships
Data Model Relationships
 Specify the number of instances of one entity that can
be associated with instances of a related entity
 Types:
 1:M
 1:1
 M:M
 “M” denotes some value greater than 1 whose upper bound
is undetermined
 This is called relationship cardinality
Example 1:M Relationship
Video_ID Video_Title Video_Format
1000 The Princess Bride DVD
1001 Sideways Bluray
1002 Just Visiting DVD
1003 Crash Bluray
Store_ID Store_Name Store_Address
1 Northside 3233 Wisconsin St.
2 Southside 4211 Golf Road
Store
Store_ID
Store_Name
Store_Address
Video
Video_ID
Video_Title
Video_Format
Rents
Example 1:1 Relationship
Spouse_ID Spouse_Name
52 Ryan, Judy
53 Redmann, Rudy
Customer_
ID
Customer_
Name
Customer_Address
1 Ryan, Paul 5454 Hyde Court
2 Myers, Mary 112 Birch Place
Customer
Customer_ID
Customer_Name
Customer_Address
Spouse
Spouse_ID
Spouse_Name
Has
Example M:M Relationship
Customer
Customer_ID
Customer_Name
Customer_Address
Video
Video_ID
Video_Title
Rents
Example ER Model
Summary: The Data Modeling
Process
 Define entities
 Define attributes
 Define relationships
 Identify relationship cardinality (1:1, 1:M, M:M)

More Related Content

What's hot

Object oriented database model
Object oriented database modelObject oriented database model
Object oriented database model
PAQUIAAIZEL
 
Object relationship mapping and hibernate
Object relationship mapping and hibernateObject relationship mapping and hibernate
Object relationship mapping and hibernate
Joe Jacob
 
Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database language
Jafar Nesargi
 
Lecture 07 relational database management system
Lecture 07 relational database management systemLecture 07 relational database management system
Lecture 07 relational database management system
emailharmeet
 

What's hot (20)

Bt0066 dbms
Bt0066 dbmsBt0066 dbms
Bt0066 dbms
 
Introduction to odbms
Introduction to odbmsIntroduction to odbms
Introduction to odbms
 
Object oriented database model
Object oriented database modelObject oriented database model
Object oriented database model
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database concepts
 
Object relationship mapping and hibernate
Object relationship mapping and hibernateObject relationship mapping and hibernate
Object relationship mapping and hibernate
 
Islamic University Previous Year Question Solution 2019 (ADBMS)
Islamic University Previous Year Question Solution 2019 (ADBMS)Islamic University Previous Year Question Solution 2019 (ADBMS)
Islamic University Previous Year Question Solution 2019 (ADBMS)
 
ER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMS
 
Chapt 1 odbms
Chapt 1 odbmsChapt 1 odbms
Chapt 1 odbms
 
Encapsulation of operations, methods & persistence
Encapsulation of operations, methods & persistenceEncapsulation of operations, methods & persistence
Encapsulation of operations, methods & persistence
 
Object oriented database
Object oriented databaseObject oriented database
Object oriented database
 
COMPUTERS Database
COMPUTERS Database COMPUTERS Database
COMPUTERS Database
 
Object database standards, languages and design
Object database standards, languages and designObject database standards, languages and design
Object database standards, languages and design
 
Database Design and Normalization Techniques
Database Design and Normalization TechniquesDatabase Design and Normalization Techniques
Database Design and Normalization Techniques
 
Types of keys in database management system by Dr. Kamal Gulati
Types of keys in database management system by Dr. Kamal GulatiTypes of keys in database management system by Dr. Kamal Gulati
Types of keys in database management system by Dr. Kamal Gulati
 
Oodbms ch 20
Oodbms ch 20Oodbms ch 20
Oodbms ch 20
 
ICS Part 2 Computer Science Short Notes
ICS Part 2 Computer Science Short NotesICS Part 2 Computer Science Short Notes
ICS Part 2 Computer Science Short Notes
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Entity relationship diagram for dummies
Entity relationship diagram for dummiesEntity relationship diagram for dummies
Entity relationship diagram for dummies
 
Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database language
 
Lecture 07 relational database management system
Lecture 07 relational database management systemLecture 07 relational database management system
Lecture 07 relational database management system
 

Viewers also liked (6)

1 Blue Card Estrategia
1   Blue Card Estrategia1   Blue Card Estrategia
1 Blue Card Estrategia
 
La noticia de hoy 13 febrero - 2014
La noticia de hoy  13   febrero - 2014La noticia de hoy  13   febrero - 2014
La noticia de hoy 13 febrero - 2014
 
Karina Martinez Olguin Red PAN
Karina Martinez Olguin Red PANKarina Martinez Olguin Red PAN
Karina Martinez Olguin Red PAN
 
Ppt la didáctica pedagógica
Ppt la didáctica pedagógicaPpt la didáctica pedagógica
Ppt la didáctica pedagógica
 
El compuntador
El compuntadorEl compuntador
El compuntador
 
Tarjeta halloween.
Tarjeta halloween.Tarjeta halloween.
Tarjeta halloween.
 

Similar to Data modelingpresentation

Hibernate Training Session1
Hibernate Training Session1Hibernate Training Session1
Hibernate Training Session1
Asad Khan
 
Chapter 1 - Concepts for Object Databases.ppt
Chapter 1 - Concepts for Object Databases.pptChapter 1 - Concepts for Object Databases.ppt
Chapter 1 - Concepts for Object Databases.ppt
Shemse Shukre
 

Similar to Data modelingpresentation (20)

Free video lectures for mca
Free video lectures for mcaFree video lectures for mca
Free video lectures for mca
 
3. Chapter Three.pdf
3. Chapter Three.pdf3. Chapter Three.pdf
3. Chapter Three.pdf
 
Data modeling
Data modelingData modeling
Data modeling
 
Presentation
PresentationPresentation
Presentation
 
data base u2 dfhjhdbgjhbfxjjkgfbjkg.pptx
data base u2 dfhjhdbgjhbfxjjkgfbjkg.pptxdata base u2 dfhjhdbgjhbfxjjkgfbjkg.pptx
data base u2 dfhjhdbgjhbfxjjkgfbjkg.pptx
 
Summary data modelling
Summary data modellingSummary data modelling
Summary data modelling
 
Dbms
DbmsDbms
Dbms
 
Chap08
Chap08Chap08
Chap08
 
Export ERD | SQL Database Modeler.pptx
Export ERD  |  SQL Database Modeler.pptxExport ERD  |  SQL Database Modeler.pptx
Export ERD | SQL Database Modeler.pptx
 
Unit 2-Data Modeling.pdf
Unit 2-Data Modeling.pdfUnit 2-Data Modeling.pdf
Unit 2-Data Modeling.pdf
 
BIS08 Application Development - II
BIS08 Application Development - IIBIS08 Application Development - II
BIS08 Application Development - II
 
8.pptx
8.pptx8.pptx
8.pptx
 
Ch8
Ch8Ch8
Ch8
 
ch3 final.pptx
ch3 final.pptxch3 final.pptx
ch3 final.pptx
 
Hibernate Training Session1
Hibernate Training Session1Hibernate Training Session1
Hibernate Training Session1
 
Sq lite module3
Sq lite module3Sq lite module3
Sq lite module3
 
Data models
Data modelsData models
Data models
 
Data models
Data modelsData models
Data models
 
Chapter 1 - Concepts for Object Databases.ppt
Chapter 1 - Concepts for Object Databases.pptChapter 1 - Concepts for Object Databases.ppt
Chapter 1 - Concepts for Object Databases.ppt
 
ICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdfICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdf
 

Recently uploaded

Recently uploaded (20)

Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 

Data modelingpresentation

  • 1. Introduction to Data Modeling CS 146
  • 2. What is a Data Model?  Definition: precise description of the data content in a system  Types of data models: 1. Conceptual: describes WHAT the system contains 2. Logical: describes HOW the system will be implemented, regardless of the DBMS 3. Physical: describes HOW the system will be implemented using a specific DBMS
  • 3. Why do we need to create data models?  To aid in the development of a sound database design that does not allow anomalies or inconsistencies  Goal: to create database tables that do not contain duplicate data values that can become inconsistent
  • 4. Types of Data Models  Entity-Relationship (E-R) Models  Only addresses data and relationships  Classic, simplest  Best for deriving a sound table design  Many extensions/variations exist  Basis for most other modeling approaches  UML (unified modeling language)  Class models  Goes beyond data, also models behaviors
  • 5. Creating an Entity-Relationship Model 1. Identify entities 2. Identify entity attributes and primary keys 3. Specify relationships
  • 6. Data Entities  Entity  A "thing" about which you want to store data in an application  Multiple examples (instances) of the entity must exist  Goal:  Store data about each entity in a separate table  Do not store duplicate data in multiple tables or records  Examples: CUSTOMER, PRODUCT
  • 7. Data Model Naming Conventions  Entity names are short, descriptive, compound word singular nouns  UWEC_STUDENT, CANDY_PRODUCT,  Entity names will ultimately correspond to table names  Why singular?  Makes more sense when you start talking about relationships
  • 8. Data Entity Instances  Entity instance  A specific occurrence (data value) of an entity  An entity must have multiple entity instances or it is not really an entity!  Examples: Davey Jones, Celestial Cashew Crunch
  • 9. ER Model Attributes  Attribute  A characteristic (data field) of an entity that you want to store in the database  Examples: CUST_ID, PROD_DESC  Attribute value  The value of a particular attribute for a particular entity instance  Examples: 42, "Nuts Not Nachos"
  • 10. Data Model Naming Conventions (continued)  Attribute names are descriptive compound words that correspond to the entity name  Attribute names will ultimately correspond to field names  Every attribute name within the database should be unique
  • 11. ER Model Notation  Represent entities as rectangles  List attributes within the rectangle Entity Attributes Primary key
  • 12. Attributes Selection Issues  Primary key  Atomic  Composite  Multi-valued  Derived
  • 13. Primary Key Attributes  Attribute whose value is unique for every entity instance  Every entity MUST have a PK  Designate by:  Placing as first attribute in the entity  Underline  Label using "PK"
  • 14. Selecting Primary Keys  Must be values that are:  Unique for every possible record  Do not change  Best practice: numeric with no blank spaces or formatting characters  Often you need to create a surrogate key  ID value that serves only to identify the object in the database  Exception: objects with "natural" primary keys  SKU  ISBN  VIN
  • 15. Atomic and Composite Attributes  Atomic attribute: represents a single data value  15, “Daniel", 12/25/2009  Composite attribute: can be decomposed into atomic attributes  "James B. Brown"  "5580 Pinewood Road, Eau Claire, WI 54701"  Should you ever allow a composite attribute in a database?
  • 16. Composite Attributes  Decompose into atomic components for:  Sorting  Searching  Formatting Student Student_ID Student_Name Student_Address Student_DOB Student_Class Student_First_Name Student_MI Student_Last_Name Student_Address_Line_1 Student_Address_Line_2 Student_City Student_State Student_Country Student_Postal_Code
  • 17. Multi-Valued Attributes  Can have multiple values for the same entity Student Student_ID (PK) Student_First_Name Student_Last_Name Student_Address Student_DOB Student_Class Student_Phone1 Student_Phone2 Employee Employee_ID (PK) Employee_First_Name Employee_Last_Name Employee_Address Employee_DOB Employee_Dependent1 Employee_Dependent2
  • 18. Handling Multi-valued Attributes  If it has a definite maximum number, leave as a repeating attribute  If the upper limit is variable, make a new entity Student Student_ID Student_First_Name Student_Last_Name Student_Address Student_DOB Student_Class Student_Phone1 Student_Phone2 Employee Employee_ID Employee_First_Name Employee_Last_Name Employee_Address Employee_DOB Employee_Dependent1 Employee_Dependent2 Dependent Dependent_ID Dependent_Namehas
  • 19. Derived Attributes  Value that can be derived from other attributes  Student_Age = 22 (DOB = 11/20/1986, current date is 11/13/2009)  Order_Total = $500 (Item 1 cost = $200, Item 2 cost = $300)
  • 20. Handling Derived Attributes  Store the underlying data values from which you can derive the attribute value …  Examples:  DOB => Age  CurrentPrice and UnitsSold of an item (for a sales order)  … unless the underlying values can change!  PRODUCT_PRICE, COURSE_CREDITS
  • 21. Creating an Entity-Relationship Model 1. Identify entities 2. Identify entity attributes and primary keys 3. Specify relationships
  • 22. Data Model Relationships  Specify the number of instances of one entity that can be associated with instances of a related entity  Types:  1:M  1:1  M:M  “M” denotes some value greater than 1 whose upper bound is undetermined  This is called relationship cardinality
  • 23. Example 1:M Relationship Video_ID Video_Title Video_Format 1000 The Princess Bride DVD 1001 Sideways Bluray 1002 Just Visiting DVD 1003 Crash Bluray Store_ID Store_Name Store_Address 1 Northside 3233 Wisconsin St. 2 Southside 4211 Golf Road Store Store_ID Store_Name Store_Address Video Video_ID Video_Title Video_Format Rents
  • 24. Example 1:1 Relationship Spouse_ID Spouse_Name 52 Ryan, Judy 53 Redmann, Rudy Customer_ ID Customer_ Name Customer_Address 1 Ryan, Paul 5454 Hyde Court 2 Myers, Mary 112 Birch Place Customer Customer_ID Customer_Name Customer_Address Spouse Spouse_ID Spouse_Name Has
  • 27. Summary: The Data Modeling Process  Define entities  Define attributes  Define relationships  Identify relationship cardinality (1:1, 1:M, M:M)