SlideShare uma empresa Scribd logo
1 de 16
Baixar para ler offline
Modeling
Data Relationships
Topics
● Building Data Relationships
● Entity & Reference Identifiers
● Relationships
○ 1 to 1
○ 1 to Many
○ Many to Many
● Indexes
● Referential Integrity (Delete rule)
● Entity Diagrams
2
Building Data Relationships
Data types are rarely isolated
● A rich data model establishes the relationships between data
● The Relationships can be as important as the data itself
3
An Entity must have an Identifier to allow relationships
● Id attribute is a long integer and automatically numbered by default
● Mandatory
● Possible types
○ Text
○ Integer / Long Integer
○ (Another) Entity Identifier
Represents the database table’s Primary Key
● OutSystems support simple primary keys
● NO composite keys!
Entity Identifier
4
Referencing Data
● Entities can be referenced by their identifier
○ Create an attribute of type Entity Identifier
○ Can be mandatory or not
○ Static Entities can only reference other Static Entities
● Represents the database table’s Foreign Key
● NullIdentifier() is the default value for
reference attributes
5
1-to-1 Relationship
6
1-to-1
● Each Receipt belongs to one Order
● Each Order has at most one Receipt
OrderReceipt is an extension of Order
● OrderReceipt has an identifier of type
Order Identifier
● Is Mandatory is set to Yes
● OrderReceipt Identifier must be explicitly
assigned with the Order identifier when
creating the record
Extension Entity
7
Extension Entity
● Shares its identifier with the base
Entity
● The two Entities could be merged
● Usually split apart due to:
○ Performance issues
○ Base Entity is read only (e.g. User)
1-to-many Relationship
1-to-many
● Each Customer may have many Orders
● An Order was requested by one Customer
A Customer submits multiple Orders
● Order Entity has a reference attribute of
type Customer Identifier (RequestedBy)
● Reference attribute may or may not be
mandatory
○ If not mandatory, some Orders may not
know which Customer requested the Order
8
Master-Detail Entities
Master-Detail
● Detail Entity references the Master Entity
● Detail Entity has a reference attribute of
type MasterEntity Identifier
● An Entity can have multiple reference
attributes
9
Many-to-many Relationship
Many-to-many
● Each Product may be part of many Orders
● Each Order may have many Products
An OrderProduct Junction Entity is
required
● Reference attribute OrderId of type Order
Identifier
● Reference attribute ProductId of type
Product Identifier
10
Junction Entity
Junction Entity
● New Entity with its own unique Id
● One reference attribute per each
Entity of the relationship
○ MasterEntity1 Identifier
○ MasterEntity2 Identifier
● Unique Index with both reference
attributes may be useful
11
Indexes
Speed up data retrieval over certain attributes
● Costs additional writes and storage space
● Reference attributes have automatically created
indexes
● Custom indexes can be created
Avoid duplicates
● Define the Index as Unique
● Combine one or more attributes
12
Referential Integrity
Delete Rule property of the reference attribute
Applied when deleting a record from the referenced
Entity (e.g. Customer)
● Protect - does not allow deleting the record
○ Ex: Customer with Orders is not deleted
● Delete - deletes the record and cascades delete all the
records that reference it
○ Ex: Customer and all its Orders are deleted
● Ignore - does not guarantee referential integrity
○ Ex: Customer is deleted. Orders are kept
13
Entity Diagram
Visual representation of the Data Model
Designed by the developer
The Entity Diagram represents:
● Entities
● Relationships
● Delete Rules
○ Protect
○ Delete
○ Ignore
14
Summary
● Building Data Relationships
● Entity & Reference Identifiers
● Relationships
○ 1 to 1
○ 1 to Many
○ Many to Many
● Indexes
● Referential Integrity (Delete rule)
● Entity Diagrams
15
Modeling Data Relationships
Thank You!

Mais conteúdo relacionado

Semelhante a 4.1 Modeling Data Relationships.pdf

Data Modeling Basics
Data Modeling BasicsData Modeling Basics
Data Modeling Basicsrenuindia
 
Summary data modelling
Summary data modellingSummary data modelling
Summary data modellingNovita Sari
 
Drupalize your data use entities
Drupalize your data use entitiesDrupalize your data use entities
Drupalize your data use entities均民 戴
 
Database.pdf
Database.pdfDatabase.pdf
Database.pdfl235546
 
NoSQL document oriented data access for .net systems with postgresql and marten
NoSQL document oriented data access for .net systems with postgresql and martenNoSQL document oriented data access for .net systems with postgresql and marten
NoSQL document oriented data access for .net systems with postgresql and martenBojan Veljanovski
 
Entities, Bundles, and Fields: You need to understand this!
Entities, Bundles, and Fields: You need to understand this!Entities, Bundles, and Fields: You need to understand this!
Entities, Bundles, and Fields: You need to understand this!tedbow
 
Common Data Model - A Business Database!
Common Data Model - A Business Database!Common Data Model - A Business Database!
Common Data Model - A Business Database!Pedro Azevedo
 
SFDC Database Basics
SFDC Database BasicsSFDC Database Basics
SFDC Database BasicsSujit Kumar
 
MOOC_PRESENTATION_FINAL_PART_1[1].pptx
MOOC_PRESENTATION_FINAL_PART_1[1].pptxMOOC_PRESENTATION_FINAL_PART_1[1].pptx
MOOC_PRESENTATION_FINAL_PART_1[1].pptxmh3473
 
WBC Entity Relationship and data flow diagrams
WBC Entity Relationship and data flow diagramsWBC Entity Relationship and data flow diagrams
WBC Entity Relationship and data flow diagramsArshitSood3
 
ER Digramms by Harshal wagh
ER Digramms by Harshal waghER Digramms by Harshal wagh
ER Digramms by Harshal waghharshalkwagh999
 
ERD introduction in databases model.pptx
ERD introduction in databases model.pptxERD introduction in databases model.pptx
ERD introduction in databases model.pptxImXaib
 
XML Information set
XML Information setXML Information set
XML Information setHoang Nguyen
 
Common Data Service (CDS), a new database?
Common Data Service (CDS), a new database?Common Data Service (CDS), a new database?
Common Data Service (CDS), a new database?Pedro Azevedo
 
5. relational structure
5. relational structure5. relational structure
5. relational structurekhoahuy82
 

Semelhante a 4.1 Modeling Data Relationships.pdf (20)

Data Modeling Basics
Data Modeling BasicsData Modeling Basics
Data Modeling Basics
 
Summary data modelling
Summary data modellingSummary data modelling
Summary data modelling
 
Drupalize your data use entities
Drupalize your data use entitiesDrupalize your data use entities
Drupalize your data use entities
 
Database.pdf
Database.pdfDatabase.pdf
Database.pdf
 
Introduction To Dom
Introduction To DomIntroduction To Dom
Introduction To Dom
 
NoSQL document oriented data access for .net systems with postgresql and marten
NoSQL document oriented data access for .net systems with postgresql and martenNoSQL document oriented data access for .net systems with postgresql and marten
NoSQL document oriented data access for .net systems with postgresql and marten
 
Entities, Bundles, and Fields: You need to understand this!
Entities, Bundles, and Fields: You need to understand this!Entities, Bundles, and Fields: You need to understand this!
Entities, Bundles, and Fields: You need to understand this!
 
8.pptx
8.pptx8.pptx
8.pptx
 
Common Data Model - A Business Database!
Common Data Model - A Business Database!Common Data Model - A Business Database!
Common Data Model - A Business Database!
 
SFDC Database Basics
SFDC Database BasicsSFDC Database Basics
SFDC Database Basics
 
MOOC_PRESENTATION_FINAL_PART_1[1].pptx
MOOC_PRESENTATION_FINAL_PART_1[1].pptxMOOC_PRESENTATION_FINAL_PART_1[1].pptx
MOOC_PRESENTATION_FINAL_PART_1[1].pptx
 
WBC Entity Relationship and data flow diagrams
WBC Entity Relationship and data flow diagramsWBC Entity Relationship and data flow diagrams
WBC Entity Relationship and data flow diagrams
 
ER Digramms by Harshal wagh
ER Digramms by Harshal waghER Digramms by Harshal wagh
ER Digramms by Harshal wagh
 
ERD introduction in databases model.pptx
ERD introduction in databases model.pptxERD introduction in databases model.pptx
ERD introduction in databases model.pptx
 
XML Information set
XML Information setXML Information set
XML Information set
 
Common Data Service (CDS), a new database?
Common Data Service (CDS), a new database?Common Data Service (CDS), a new database?
Common Data Service (CDS), a new database?
 
5. relational structure
5. relational structure5. relational structure
5. relational structure
 
DB2 on Mainframe
DB2 on MainframeDB2 on Mainframe
DB2 on Mainframe
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Unit iv xml
Unit iv xmlUnit iv xml
Unit iv xml
 

Último

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Último (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

4.1 Modeling Data Relationships.pdf

  • 2. Topics ● Building Data Relationships ● Entity & Reference Identifiers ● Relationships ○ 1 to 1 ○ 1 to Many ○ Many to Many ● Indexes ● Referential Integrity (Delete rule) ● Entity Diagrams 2
  • 3. Building Data Relationships Data types are rarely isolated ● A rich data model establishes the relationships between data ● The Relationships can be as important as the data itself 3
  • 4. An Entity must have an Identifier to allow relationships ● Id attribute is a long integer and automatically numbered by default ● Mandatory ● Possible types ○ Text ○ Integer / Long Integer ○ (Another) Entity Identifier Represents the database table’s Primary Key ● OutSystems support simple primary keys ● NO composite keys! Entity Identifier 4
  • 5. Referencing Data ● Entities can be referenced by their identifier ○ Create an attribute of type Entity Identifier ○ Can be mandatory or not ○ Static Entities can only reference other Static Entities ● Represents the database table’s Foreign Key ● NullIdentifier() is the default value for reference attributes 5
  • 6. 1-to-1 Relationship 6 1-to-1 ● Each Receipt belongs to one Order ● Each Order has at most one Receipt OrderReceipt is an extension of Order ● OrderReceipt has an identifier of type Order Identifier ● Is Mandatory is set to Yes ● OrderReceipt Identifier must be explicitly assigned with the Order identifier when creating the record
  • 7. Extension Entity 7 Extension Entity ● Shares its identifier with the base Entity ● The two Entities could be merged ● Usually split apart due to: ○ Performance issues ○ Base Entity is read only (e.g. User)
  • 8. 1-to-many Relationship 1-to-many ● Each Customer may have many Orders ● An Order was requested by one Customer A Customer submits multiple Orders ● Order Entity has a reference attribute of type Customer Identifier (RequestedBy) ● Reference attribute may or may not be mandatory ○ If not mandatory, some Orders may not know which Customer requested the Order 8
  • 9. Master-Detail Entities Master-Detail ● Detail Entity references the Master Entity ● Detail Entity has a reference attribute of type MasterEntity Identifier ● An Entity can have multiple reference attributes 9
  • 10. Many-to-many Relationship Many-to-many ● Each Product may be part of many Orders ● Each Order may have many Products An OrderProduct Junction Entity is required ● Reference attribute OrderId of type Order Identifier ● Reference attribute ProductId of type Product Identifier 10
  • 11. Junction Entity Junction Entity ● New Entity with its own unique Id ● One reference attribute per each Entity of the relationship ○ MasterEntity1 Identifier ○ MasterEntity2 Identifier ● Unique Index with both reference attributes may be useful 11
  • 12. Indexes Speed up data retrieval over certain attributes ● Costs additional writes and storage space ● Reference attributes have automatically created indexes ● Custom indexes can be created Avoid duplicates ● Define the Index as Unique ● Combine one or more attributes 12
  • 13. Referential Integrity Delete Rule property of the reference attribute Applied when deleting a record from the referenced Entity (e.g. Customer) ● Protect - does not allow deleting the record ○ Ex: Customer with Orders is not deleted ● Delete - deletes the record and cascades delete all the records that reference it ○ Ex: Customer and all its Orders are deleted ● Ignore - does not guarantee referential integrity ○ Ex: Customer is deleted. Orders are kept 13
  • 14. Entity Diagram Visual representation of the Data Model Designed by the developer The Entity Diagram represents: ● Entities ● Relationships ● Delete Rules ○ Protect ○ Delete ○ Ignore 14
  • 15. Summary ● Building Data Relationships ● Entity & Reference Identifiers ● Relationships ○ 1 to 1 ○ 1 to Many ○ Many to Many ● Indexes ● Referential Integrity (Delete rule) ● Entity Diagrams 15