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
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 … ..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 format Flat file systems quickly become cumbersome and difficult to maintain
Flat Files Here are some flat files grouped together by type … you can see the repeating format?
Database models The Hierarchical Model (1) Similar to an chart Think 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 webpage Each 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 children Each 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:- CUSTOMER Consider this typical business situation:- a customer can place many orders An order can contain many details These are known as one-to-many ORDER ORDER DETAIL
Hierarchical Model (6) But most business would also recognise that:- CUSTOMER But most business would also recognise that:- An employee can be associated with many orders A product can be specified in many order details ORDER EMPLOYEE ORDER DETAIL PRODUCT
Hierarchical Model (7) CUSTOMER 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 parent There 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) ORDER EMPLOYEE ORDER DETAIL PRODUCT
Database Models The 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 Model beware of complex pathways! (see the text book for a detailed explanation) ORDER ORDER DETAILS CUSTOMER EMPLOYEE PRODUCTS NEXT ORDER FOR THIS EMPLOYEE NEXT CUSTOMER OTHER ORDERS FOR THIS PRODUCT
Database Models The RELATIONAL Model (3) Was a truly revolutionary approach Flexible, no pre-defined pathways Ideal for ‘ ‘ queries Relates records as they are needed Instead of pointers locating physical file locations common data items (keys) are used to identify logical links between records Uses the one-to-many concept
The RELATIONAL Model The diagramming technique is known as the (ERD) CUSTOMER These are the entities ….. Things that the business wishes to keep information about CUSTOMER ORDER ORDER DETAIL CUSTOMER
The RELATIONAL Model The lines show the connections between the entities … and express the ‘one-to-many’ relationship The M denotes the ‘many’ end of the relationship CUSTOMER 1 m EMPLOYEE ORDER 1 m 1 m ORDER DETAIL PRODUCT m 1
The RELATIONAL Model This introductory module will focus around the RELATIONAL model We will look at how to draw ERD’s Refine them Implement them as databases that can function to supply real information from raw data.
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 it’s development.
Summary We have looked at the four database models Hierachical Network Relational Object oriented
References Databases Demystified By Andy Oppel Published by McGraw Hill.