Monday, March 21, 2011

TYPES OF DATABASE

There are Three main types of database: Flat-file, Hierarchical  Files & Relational Files .
Which is the best one to use for a particular job will depend on factors such as the type and the amount of data to be processed; not to mention how frequently it will be used.


Flat-File
  • Ideal for small amounts of data that needs to be human readable or edited by hand.
  • Used for storing the more complex data types, are also likely to render the file unreadable and un-editable to anyone looking after the database.
  • Split up using a common delimiter.
  • If the data is simple enough, this could be a comma, but more complex strings are usually split up using tabs, new lines or a combination of characters.
  • One of the main problems with using flat files for even a semi-active database is the fact that it is very prone to corruption.
  • There is no inherent locking mechanism that detects when a file is being used or modified, and so this has to be done on the script level.
  •  Even if care is taken to lock and unlock the file on each access, a busy script can cause a "race condition" and it is possible for a file to be wiped clean by two or more processes that are fighting for the lock; the timing of your file locks will become more and more important as a site gets busy.






 Hierarchical Files
  • Store data in more than one type of record.
  • Described as a "parent-child, one-to-many" relationship. One field is key to all records, but data in one record does not have to be repeated in another.
  • This system allows records with similar attributes to be associated together. The records are linked to each other by a key field in a hierarchy of files.
  • Each record, except for the master record, has a higher level record file linked by a key field "pointer". In other words, one record may lead to another and so on in a relatively descending pattern.






Relational Files
  • Connect different files or tables (relations) without using internal pointers or keys.
  •  Instead a common link of data is used to join or associate records. The link is not hierchical. A "matrices of tables" is used to store the information.
  • The tables have a common link they may be combined by the user to form new inquires and data output.
  • This is the most flexible system and is particularly suited to SQL (structured query language).
  • Have functions "built in" that help them to retrieve, sort and edit the data in many different ways.
  • These functions save script designers from having to worry about filtering out the results that they get, and so can go quite some way to speeding up the development and production of web applications.
  • A description of how drives, directories, and files are displayed on an operating system that allows for a large quantity of files and directories to be listed in a small area.










Flat, Hierarchical, and Relational Files Compared



StructureAdvantagesDisadvantages 
Flat Files
  • Fast data retrieval
  • Simple structure and easy to program
  • Difficult to process multiple values of a data item
  • Adding new data categories requires reprogramming
  • Slow data retrieval without the key
Hierarchical Files
  • Adding and deleting records is easy
  • Fast data retrieval through higher level records
  • Multiple associations with like records in different files
  • Pointer path restricts access
  • Each association requires repetitive data in other records
  • Pointers require large amount of computer storage
Relational Files
  • Easy access and minimal technical training for users
  • Flexibility for unforeseen inquiries
  • Easy modification and addition of new relationships, data, and records
  • Physical storage of data can change without affecting relationships between records
  • New relations can require considerable processing
  • Sequential access is slow
  • Method of storage an disks impacts processing time
  • Easy to make logical mistakes due to flexibility of relationships between records

No comments:

Post a Comment