Sunteți pe pagina 1din 21

Databases

GCSE

Using a Database
Search and retrieve information or data that has been collected and specially organized.

A Database Management System (DBMS)


System of planning, creating and maintaining a database 1. Tables and relationships 2. Field types

Text Numeric

Real Decimal

Date Boolean Lookup

3.

Field properties file size as small as possible


no wasted storage space. reduces time to process data.

4. 5. 6.

fixed and variable field lengths key field or primary key unique Set up queries and Reports Determine Access rights

Common field types found in databases


Use this field type Text Memo Number (numeric field) Date Currency Autonumber When the field's data is Text - up to 255 characters up to 64000 characters Numbers, for example 12345 Dates, for example 21/04/55 or $
Automatically generates a number every time a new record is created

Object container
Yes/No (also known as a Boolean or logical field)

Picture, video clip, sound file


Yes or No

Calculation

Result of a formula,

Card index becomes a database

Structuring Data
These are the fields there are four fields in each record of this file. ISBN is the key field. This is the field that has a different value in every record. It is used to distinguish one record from another. Some books could have the same title, author or publisher. The ISBN is the only way a particular book can be picked out. A key field uniquely identifies an individual record.

This is one complete record - there are five records in this file.

Fixed Length Records


A fixed length record - the length of the fields in each record has been set to a maximum number of characters long.

M D B 3

r a o 1 m l o d P a r k L a n e n

A set amount of storage space is set aside for each field.

Fixed Length Records


Advantage

start and end of each record is a fixed number of characters apart - much easier to locate records and fields.

Disadvantages: Fields rarely contain maximum number of characters allowed wastes space. Values sometimes cant be entered - too large to fit inside the allowed space in a field.

Variable Length Records


A variable length record the length of a field can change to allow data of any size to fit.
M 3 r 1 # D P a a m r o k n # L B a o n l e d # #

A special marker (# in this example) indicates where each field ends.

Variable Length Records


Advantage: space is not wasted, only the space needed is used. Disadvantage more difficult to locate the start and end of records and fields. When records need to be located the computer counts through the end-of-field markers to locate individual records and fields.

Capturing, Entering and Editing Data

Keyboard, barcode readers Designing a data capture form entry options for fields

data automatically entered into a field much quicker and more accurate to choose from a list, rather than having to type it in - a value list (or combo box ) check box radio buttons / option buttons

Check Boxes

Value List

Data Validation
Is data sensible?

Type the data is in the correct format: e.g. a number in a numeric field. Presence field is not left empty. The user is asked to enter data if it has not been entered. Lookup list Only allows values to be entered from a pre-defined list. Range Only allows values to be entered from a certain range: e.g. from 1 to 10 Check digit That numbers have been entered correctly. An extra number (the check digit) is added and a calculation is made which shows whether the numbers have all been entered correctly. used to verify such things as product codes in shops. .

Data Verification
Is data accurate?

Rechecking for mistakes A second person checking Double entry using software to discover
mismatches

Processing Data

Searching (querying data) - criteria for the search

SQL (structured query language) . SELECT ALL WHERE age > 13 AND name = Smith Joining conditions - AND, OR and NOT. Sorting ascending/descending Importing: from another database, csv files Graphs - data exported to other programs to create graphs Calculations use formulas to add etc

Updating 1
The information stored in computer files must be kept up-to-date When a new record needs to be added, it is inserted. Records are deleted when they are no longer needed. Records are amended when the data in a fields needs to be altered.

Updating 2
Master file main file is updated by comparing it with the transaction file changes made.
Transaction file - details of all the changes that need to be made to a master file are collected for later processing. Three generations of a master file are kept for backup purposes.

Master
New Master New New Master

Transaction

Transaction

Types of Databases

Flat-file databases one table Relational databases More than one table - linked Advantage

smaller file sizes and faster access. data need only be changed in one file if files are linked. If they are not linked.. ? (what needs to be done?)

Tables Linked in a Relational Database

File Access

File organization

Random access file

records are not stored in any particular order records are sorted into some kind of order

sequential file

Accessing files

Serial and sequential files - accessed by going through each record until the required record is found direct access (random access) files, the required record is found straight away (directly) without first going through the other records.

S-ar putea să vă placă și