Upload
dennis-rogers
View
215
Download
0
Embed Size (px)
DESCRIPTION
Btec National - IT SYSTEMS ANALYSIS AND DESIGN 3 Entity Relationship Diagrams ERD –An ERD represents the entities and the relationships that exists between them. –An ERD diagram is created to establish what tables within a database are required and what foreign keys are needed
Citation preview
Btec National - IT SYSTEMS ANALYSBtec National - IT SYSTEMS ANALYSIS AND DESIGNIS AND DESIGN
11
IT Systems Analysis and IT Systems Analysis and DesignDesign
Entity Relationship DiagramsEntity Relationship Diagrams
Btec National - IT SYSTEMS ANALYSBtec National - IT SYSTEMS ANALYSIS AND DESIGNIS AND DESIGN
22
AimsAims
Learn about Entity Relationship Diagrams Learn about Entity Relationship Diagrams (ERD) and what they are used for.(ERD) and what they are used for.
Understand the decomposed processUnderstand the decomposed process
Create an ERD diagramCreate an ERD diagram
Btec National - IT SYSTEMS ANALYSBtec National - IT SYSTEMS ANALYSIS AND DESIGNIS AND DESIGN
33
Entity Relationship DiagramsEntity Relationship Diagrams
ERDERD
– An ERD represents the entities and the An ERD represents the entities and the relationships that exists between them.relationships that exists between them.
– An ERD diagram is created to establish what An ERD diagram is created to establish what tables within a database are required and tables within a database are required and what foreign keys are neededwhat foreign keys are needed
Btec National - IT SYSTEMS ANALYSBtec National - IT SYSTEMS ANALYSIS AND DESIGNIS AND DESIGN
44
Entity Relationship DiagramsEntity Relationship Diagrams
ERD – EntitiesERD – Entities
– Real world things that are part of the system Real world things that are part of the system under investigation.under investigation.
– Examples include Products, Customers, Examples include Products, Customers, Orders.Orders.
Btec National - IT SYSTEMS ANALYSBtec National - IT SYSTEMS ANALYSIS AND DESIGNIS AND DESIGN
55
Entity Relationship DiagramsEntity Relationship Diagrams
ERD – RelationshipERD – Relationship– Relationships illustrate how two entities share Relationships illustrate how two entities share
information in the database structure. information in the database structure. – Relationships exists between each of the Relationships exists between each of the
entities examples are shown below:entities examples are shown below:1 M
M M
1 1
Btec National - IT SYSTEMS ANALYSBtec National - IT SYSTEMS ANALYSIS AND DESIGNIS AND DESIGN
66
Entity Relationship DiagramsEntity Relationship Diagrams
Products EmployeeOrderM M M 1
Makesinvolves
A many to many relationship as shown above is not allowed because it will create duplicate data, and repeating groups. For more information use the link below:
http://www.cms.livjm.ac.uk/johnwillitts/RelDBDes/13Norm/SuppRepeatingGrp/repeating_groups.htm
Btec National - IT SYSTEMS ANALYSBtec National - IT SYSTEMS ANALYSIS AND DESIGNIS AND DESIGN
77
Entity Relationship DiagramsEntity Relationship DiagramsOrderIDOrderID EmployeeIDEmployeeID ProductIDProductID OrderDateOrderDate DeliverbyDeliverby CommentsComments
11 100100 A1A1 29/03/200929/03/2009 29/04/200929/04/2009 Ring the bellRing the bell
11 100100 A2A2 29/03/200929/03/2009 29/04/200929/04/2009 Ring the bellRing the bell
11 100100 A3A3 29/03/200929/03/2009 29/04/200929/04/2009 Ring the bellRing the bell
Order table
This is the result of a many to many relationship, as you can see there is repeating groups of data (A1, A2,A3), the OrderID primary key has lost it’s uniqueness and there is loads of redundancy i.e. the order date 29/03/2009 is stored more than once.
Btec National - IT SYSTEMS ANALYSBtec National - IT SYSTEMS ANALYSIS AND DESIGNIS AND DESIGN
88
Entity Relationship DiagramsEntity Relationship Diagrams
Products EmployeeOrderM 1
Makes
To resolve this many to many relationship we have to add another table which is a decomposed table of order and products, called Order Products.
Order Products
M 1
Consists
M
Included
1
Btec National - IT SYSTEMS ANALYSBtec National - IT SYSTEMS ANALYSIS AND DESIGNIS AND DESIGN
99
Entity Relationship DiagramsEntity Relationship DiagramsOrderIDOrderID ProductIDProductID
11 A1A1
11 A2A2
11 A3A3
Order Products
By using the decomposed table it reduced redundancy and removed repeating groups from the Order table, this results in a better functioning database.
OrderIDOrderID EmployeeIDEmployeeID OrderDateOrderDate DeliverbyDeliverby CommentsComments
11 100100 29/03/200929/03/2009 29/04/200929/04/2009 Ring the bellRing the bell
Order table
Btec National - IT SYSTEMS ANALYSBtec National - IT SYSTEMS ANALYSIS AND DESIGNIS AND DESIGN
1010
Entity Relationship DiagramsEntity Relationship Diagrams
ERD – AttributeERD – Attribute– An attribute is a specification that defines a property An attribute is a specification that defines a property
of an entity. An attribute of an entity usually consists of an entity. An attribute of an entity usually consists of a name and a value for example:of a name and a value for example:
OrderIDOrderID EmployeeIDEmployeeID OrderDateOrderDate DeliverbyDeliverby CommentsComments
11 100100 29/03/200929/03/2009 29/04/200929/04/2009 Ring the bellRing the bell
These are all attributes, they have a name and a value.
Btec National - IT SYSTEMS ANALYSBtec National - IT SYSTEMS ANALYSIS AND DESIGNIS AND DESIGN
1111
ConclusionConclusion
Learnt about Entity Relationship Diagrams Learnt about Entity Relationship Diagrams (ERD) and what they are used for.(ERD) and what they are used for.
Discussed the decomposed processDiscussed the decomposed process
Created an ERD diagramCreated an ERD diagram