week 4 advantages over flat file

Upload: qieqie133

Post on 07-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Week 4 Advantages Over Flat File

    1/19

    Prevalent Database Models

    (Advantages of a database over

    flat files)

  • 8/6/2019 Week 4 Advantages Over Flat File

    2/19

    FLAT file system

    Ordinary operating system files

    Contain no information to communicate the file

    structure or any relationship between files

    This information must be provided by the

    application programme..or the user.

    Do not meet the definitions of a database we

    identified earlier. Flat Files are often used to store database

    information

    Address File House number Street Town

  • 8/6/2019 Week 4 Advantages Over Flat File

    3/19

    FLAT file system (2)

    If flat files are used to store database data

    the DBMS has metadata to allow it to

    translate data from the physical (flat file)into the logical layer format

    Flat file systems quickly become

    cumbersome and difficult to maintain

    (see pages 7, 8 and 9 of course text book)

  • 8/6/2019 Week 4 Advantages Over Flat File

    4/19

    Flat Files

    Here are someflat files grouped

    together by type

    you can see

    the repeatingformat

  • 8/6/2019 Week 4 Advantages Over Flat File

    5/19

    The Hierarchical Model (1)

    Similar to an organisation chart

    Think of the way we structure our personal

    computer files into directories andsubdirectories

  • 8/6/2019 Week 4 Advantages Over Flat File

    6/19

    Hierarchical Model (2)

    Records are connected using pointers

    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 webpage

    Each pointer establishes a parent-child

    relationship

  • 8/6/2019 Week 4 Advantages Over Flat File

    7/19

  • 8/6/2019 Week 4 Advantages Over Flat File

    8/19

    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)

  • 8/6/2019 Week 4 Advantages Over Flat File

    9/19

    Hierarchical model (5)

    Consider this typical

    business situation:-

    a customer can placemany orders

    An order can contain

    many details

    These are clearly one-to-many relationships

    CUSTOMER

    ORDER

    ORDER

    DETAIL

  • 8/6/2019 Week 4 Advantages Over Flat File

    10/19

    Hierarchical Model (6)

    But most business

    would also recognise

    that:-

    An employee can be

    associated with many

    orders

    A product can bespecified in many order

    details

    CUSTOMER

    ORDER

    ORDER

    DETAIL

    EMPLOYEE

    PRODUCT

  • 8/6/2019 Week 4 Advantages Over Flat File

    11/19

    Hierarchical Model (7)

    But if we try and show thislogical linkage we break one ofthe fundamental rules of theparent child relationship.each child can only haveone parent

    There are ways of resolving thisdilemma, but they introducecomplexity into the constructionand maintenance of the

    database . Something wewant to avoid

    (see the text book for a detailedexplanation)

    CUSTOMER

    ORDER

    ORDER

    DETAIL

    EMPLOYEE

    PRODUCT

  • 8/6/2019 Week 4 Advantages Over Flat File

    12/19

    Network Model

    In some ways similar to the hierarchical model inthat pointers are used to link files.

    Pathways are more numerous and can bethought of as circular which quickly leads tocomplexity

    Rather like walking through a forest withmultiple pathways to get to the desireddestination.

    Maintenance overhead for technicians inkeeping the route map up to date becameprohibitive

  • 8/6/2019 Week 4 Advantages Over Flat File

    13/19

    Network Model

    beware of complex pathways!

    CUSTOMER

    ORDER

    EMPLOYEE

    ORDERDETAILS

    PRODUCTS

    NEXT

    CUSTOMER

    NEXT ORDER

    FOR

    THIS EMPLOYEE

    OTHER ORDERS

    FOR

    THIS PRODUCT

    (see the text book for a detailed explanation)

  • 8/6/2019 Week 4 Advantages Over Flat File

    14/19

    The RELATIONAL Model

    Was a truly revolutionaryapproach

    Flexible, no pre-defined pathways

    Ideal for ad hoc queries Relates records as they are needed

    Instead of pointers locating physical filelocations common data items (keys) are

    used to identify logical links betweenrecords

    Uses the one-to-many concept

  • 8/6/2019 Week 4 Advantages Over Flat File

    15/19

    The RELATIONAL Model

    The diagramming technique is known as

    the entity-relationship diagram (ERD)

    CUSTOMER

    ORDER

    ORDER

    DETAIL

    CUSTOMER

    CUSTOMER

    These are the

    entities .. Things

    that the business

    wishes to keep

    information about

  • 8/6/2019 Week 4 Advantages Over Flat File

    16/19

    The RELATIONAL Model

    CUSTOMER

    ORDER

    ORDER

    DETAIL

    EMPLOYEE

    PRODUCT

    The lines show the connections between the entities and

    express the one-to-many relationship

    The M denotes

    the many end ofthe relationship1

    m

    1

    m1

    m

    m 1

  • 8/6/2019 Week 4 Advantages Over Flat File

    17/19

    The RELATIONAL Model

    This introductory module will focus around

    the RELATIONAL model

    We will look at how to draw ERDs Refine them

    Implement them as databases that can

    function to supply real information fromraw data.

  • 8/6/2019 Week 4 Advantages Over Flat File

    18/19

    Database Models

    The 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 its

    development.

  • 8/6/2019 Week 4 Advantages Over Flat File

    19/19

    Summary We have looked at the four database

    models

    Hierachical

    Network

    Relational Object oriented