21
Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

  • View
    236

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

Database Design ConceptsInfo1408

Lecture 4

Prevalent Database Models

Page 2: Database Design Concepts Info1408 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

Page 3: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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

Page 4: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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

Page 5: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

Flat FilesHere are some flat files grouped together by type … you can see the repeating format?

Page 6: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

Database modelsThe Hierarchical Model (1)

Similar to an chartThink of the way we structure our personal computer files into directories and subdirectories

Page 7: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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’

Page 8: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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)

Page 9: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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)

Page 10: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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

Page 11: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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

Page 12: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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

Page 13: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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

Page 14: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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)

Page 15: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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

Page 16: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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

Page 17: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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

Page 18: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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.

Page 19: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

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.

Page 20: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

Summary

We have looked at the four database modelsHierachicalNetworkRelationalObject oriented

Page 21: Database Design Concepts Info1408 Lecture 4 Prevalent Database Models

References

Databases Demystified By Andy Oppel Published by McGraw Hill.