Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Files and databases Suppose a school stores information about its students on record cards. Each student has their own card; this is their record. Record.

Similar presentations


Presentation on theme: "1 Files and databases Suppose a school stores information about its students on record cards. Each student has their own card; this is their record. Record."— Presentation transcript:

1 1 Files and databases Suppose a school stores information about its students on record cards. Each student has their own card; this is their record. Record Field The individual pieces of information recorded on each card, such as name and date of birth, are called fields.

2 2 These are the fields. There are fields in each record of the file. Video_ID is the Key Field. This is the only field that has a different value in every record. It is used to distinguish one record from another. Some videos could have the same Title, Supplier, etc. The Video_ID is the only way a particular video can be picked out. A uniquely identifies an individual record. This is one complete record. There are records in this file. Keyfield SEVEN

3 3 Fixed and variable length records A fixed length record is one where the length of the fields in each record has been set to be a certain maximum number of characters long. A set amount of memory storage space is set aside for each field. If the contents of a field don’t fill the memory completely it is remains empty and is wasted.

4 4 The problems with fixed length records are:- Fields very rarely contains the maximum number of characters allowed which wastes memory. Values sometimes can’t be entered because they are too large to fit inside the allowed memory space in a field. The advantage of fixed length records is that they make file processing less complicated because the start and end of each record is always a fixed number of characters apart. This makes it much quicker to locate both individual records and fields.

5 5 A variable length record is one where the length of a field can change to allow data of any size to fit. A special marker (# in this example) indicates where each field ends. The length of a field depends upon the data that is placed in it. Only the memory space needed for a field is ever used — so none is wasted.

6 6 The advantage of variable length records is that space is not wasted, only the space needed is ever used. The main problem with variable length records is that it is much more difficult to locate the start and end of individual records and fields. To separate variable length records each field has a special character to mark where it ends — called an ‘end- of-field marker’. When records need to be located the computer must count through the end-of-field markers to locate individual records and fields.

7 7 Computerised databases A database is a organised collection of related files. Use a database when you need to store lots of data Key Field In this table, each column is a different field Each row is a record Data is organised into FIELDS and RECORDS. The KEY FIELD contains an item of data that is UNIQUE to that record.

8 8 FLAT-FILE or RELATIONAL?  A Flat-file database has all the data organised into ONE table.  Many modern databases are described as being relational.  A relational database stores data in tables that are linked together using common fields.

9 9 Linked data tables in a relational database

10 10 Most databases are set-up using a database package. A typical database package will allow a user to: Create a file by entering their own field definitions. Automatic validation checks for fields. Add new or delete unwanted fields Add, edit and delete records Simple searches and complex searches Sorts (ascending and descending) Electronic data entry forms Import and export of data Database packages

11 11 Details of all the changes that need to be made to a master file are often collected together in a transaction file. The master file is updated by comparing it with the transaction file and making changes to any records that appear in both files. Normally at least three ‘generations’ of a master file are kept for backup purposes. If the latest version of the master file is damaged it can be recreated by re-running the previous update using the old master and transaction files.

12 12 The grandfather-father-son method of updating Grandfather Father Son

13 13 The sale of an item in a shop, the hire of a video, the delivery of new stock to a supermarket are all examples of transactions. A file of these transactions (transaction file) is usually kept and used to update a master file of data. Example Application : Faye's Catalogue Faye's Catalogue receives an order To Faye's Catalogue From: Mrs Thompson 3, Elm Street Bridgend Account No. 15244Date : 12 03 98 Please supply the goods shown below: DescriptionStock No.Quantity Grey SkirtS321991 Red SweaterS481052 White ShirtS621772

14 14 Account No. Date Order No. Stock No. Qty Stock No. Qty Stock No. Qty 152441203981812S321991S481052S621772 A record from the order file looks like this

15 15. To produce an Invoice, two other files are needed : The Customer File : Accoun t No. Customer Name Address Credit Limit Amou nt Owed Discount Level 15244Mrs Thompson3, Elm Street Bridgend100005 The Stock File : Stock No. Product Name Price No in Stock S32199Grey Skirt12.9914

16 16 Faye's Catalogue then produces this invoice and sends it together with the goods ordered to Mrs Thompson.... Faye's CatalogueINVOICE 12, Book Road, Fayeville, Kent Please return this invoice with your payment. DateAccount No.Order No. 15/03/98152441812 DescriptionStock No.QuantityPriceCharge Grey SkirtS321991£12.99 Red SweaterS481052£24.99£49.98 White ShirtS621772£18.00£36.00 Total Charge£98.97 Less 5% Discount£94.02 Click here to return to revision slides Click here to return to revision slides


Download ppt "1 Files and databases Suppose a school stores information about its students on record cards. Each student has their own card; this is their record. Record."

Similar presentations


Ads by Google