View
236
Download
2
Tags:
Embed Size (px)
Citation preview
Database Design ConceptsInfo1408
Lecture 4
Prevalent Database Models
Objectives
To introduce the main methods of organising data for applications. Flat file Hierachical database Network Database Relational database Object oriented database
FLAT file system
Ordinary operating system filesContain no information to communicate the file structure or any relationship between filesThis information must be provided by the … ..or the user. Do not meet the definitions of a database we identified earlier.Flat Files are often used to store information that could be stored in a database.
Address File House number Street Town
FLAT file system (2)
If flat files are used to store database data the DBMS has ‘ ’ to allow it to translate data from the physical (flat file) into the logical layer formatFlat file systems quickly become cumbersome and difficult to maintain
Flat FilesHere are some flat files grouped together by type … you can see the repeating format?
Database modelsThe Hierarchical Model (1)
Similar to an chartThink of the way we structure our personal computer files into directories and subdirectories
Hierarchical Model (2)
Records are connected using ‘ ’The pointer tells the system where the related record is physically stored ….. Much as a street address tells us where a particular building is ….. Or a URL directs us to a particular webpageEach pointer establishes a ‘parent-child relationship’
Hierarchical Model (3)
Parent child relationship also known as the ‘one-to-many relationship’One parent can have many childrenEach child can only have one parent(a manager is responsible for many employees but each employee has only one manager)
Hierarchical Model (4)There are problems associated with setting up and maintaining this type of database caused by the ‘parent-child relationship’(see the text book for a detailed explanation)
Hierarchical model (5)
Consider this typical business situation:-a customer can place many ordersAn order can contain many detailsThese are known as one-to-many
CUSTOMER
ORDER
ORDERDETAIL
Hierarchical Model (6)
But most business would also recognise that:-An employee can be associated with many ordersA product can be specified in many order details
CUSTOMER
ORDER
ORDERDETAIL
EMPLOYEE
PRODUCT
Hierarchical Model (7)
But if we try and show this logical linkage we break one of the fundamental rules of the parent child relationship ….each child can only have one parentThere are ways of resolving this dilemma, but they introduce complexity into the construction and maintenance of the database …. Something we want to avoid(see the text book for a detailed explanation)
CUSTOMER
ORDER
ORDERDETAIL
EMPLOYEE
PRODUCT
Database ModelsThe Network Model (2)
In some ways similar to the hierarchical model in that pointers are used to link files.Pathways are more numerous and can be thought of as circular which quickly leads to
Rather like walking through a forest – with multiple pathways to get to the desired destination.Maintenance overhead for technicians in keeping the ‘route map’ up to date becomes prohibitive
Network Modelbeware of complex pathways!
CUSTOMER
ORDER
EMPLOYEE
ORDERDETAILS
PRODUCTS
NEXTCUSTOMER
NEXT ORDER FOR
THIS EMPLOYEE
OTHER ORDERS FOR
THIS PRODUCT
(see the text book for a detailed explanation)
Database Models The RELATIONAL Model (3)
Was a truly revolutionary approachFlexible, no pre-defined pathwaysIdeal for ‘ ‘ queriesRelates records as they are neededInstead of pointers locating physical file locations common data items (keys) are used to identify logical links between recordsUses the one-to-many concept
The RELATIONAL Model
The diagramming technique is known as the (ERD) CUSTOMER
ORDER
ORDERDETAIL
CUSTOMER
CUSTOMER
These are the entities ….. Things that the business wishes to keep information about
The RELATIONAL Model
CUSTOMER
ORDER
ORDERDETAIL
EMPLOYEE
PRODUCT
The lines show the connections between the entities … and express the ‘one-to-many’ relationship
The M denotes the ‘many’ end of the relationship
The M denotes the ‘many’ end of the relationship
1
m
1m
1
m
m
1
The RELATIONAL Model
This introductory module will focus around the RELATIONAL modelWe will look at how to draw ERD’sRefine themImplement them as databases that can function to supply real information from raw data.
Database ModelsThe Object Oriented model (4)
This is a newer model that uses the idea of objects to store data.This model is not yet fully implemented but much research is going into it’s development.
Summary
We have looked at the four database modelsHierachicalNetworkRelationalObject oriented
References
Databases Demystified By Andy Oppel Published by McGraw Hill.