databases - bh

Upload: safa-aslam

Post on 04-Jun-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Databases - BH

    1/21

    Databases

    GCSE

  • 8/13/2019 Databases - BH

    2/21

    Using a Database

    Search and retrieveinformation or data that

    has been collected andspecially organized.

  • 8/13/2019 Databases - BH

    3/21

    A Database Management System

    (DBMS)

    System of planning, creating and maintaining a database1. Tables and relationships2. 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.

    fixed and variable field lengths4. key field or primary keyunique5. Set up queries and Reports6. Determine Access rights

  • 8/13/2019 Databases - BH

    4/21

    Common field types found in databasesUse this field type When the field's data is

    Text Text - up to 255 characters

    Memo up to 64000 characters

    Number (numeric field) Numbers, for example 12345

    Date Dates, for example 21/04/55

    Currency or $Autonumber Automatically generates a number every

    time a new record is created

    Object container Picture, video clip, sound file

    Yes/No (also known as aBoolean or logical field)

    Yes or No

    Calculation Result of a formula,

  • 8/13/2019 Databases - BH

    5/21

    Card index becomes a database

  • 8/13/2019 Databases - BH

    6/21

    These are the fields

    there are fourfields in each record of this file.

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

    ISBN is the key field. This is the field that has a different value in everyrecord. It is used to distinguish one record from another. Some bookscould have the same title, author or publisher. The ISBN is the only way aparticular book can be picked out.

    A key field uniquely identifies an individual record.

    Structuring Data

  • 8/13/2019 Databases - BH

    7/21

    Fixed LengthRecords

    A fixed length record - the length of the fields in each record has been

    set to a maximum number of characters long.

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

    M r

    B o l d

    D a m o n

    3 1 P a r k L a n e

  • 8/13/2019 Databases - BH

    8/21

    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.

    Fixed Length Records

  • 8/13/2019 Databases - BH

    9/21

    Avariable length recordthe length of a field can change

    to allow data of any size to fit.

    Aspecial marker (#in this example) indicates where eachfield ends.

    M r # D a m o n # B o l d #

    3 1 P a r k L a n e #

    Variable Length Records

  • 8/13/2019 Databases - BH

    10/21

    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 countsthrough the end-of-field markers to locate individual

    records and fields.

    Variable Length Records

  • 8/13/2019 Databases - BH

    11/21

    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 alist, rather than having to type it in - a value list (orcombo box )

    check box

    radio buttons / option buttons

  • 8/13/2019 Databases - BH

    12/21

    Check Boxes

  • 8/13/2019 Databases - BH

    13/21

    Value List

  • 8/13/2019 Databases - BH

    14/21

    Data Validation

    Type the data is in the correct format: e.g. a number in a numericfield.

    Presencefield is not left empty. The user is asked to enter data if

    it has not been entered. Lookup listOnly allows values to be entered from a pre-defined

    list.

    RangeOnly allows values to be entered from a certain range: e.g.from 1 to 10

    Check digitThat numbers have been entered correctly. An extranumber (the check digit) is added and a calculation is made whichshows whether the numbers have all been entered correctly. used

    to verify such things as product codes in shops. .

    Is data sensible?

  • 8/13/2019 Databases - BH

    15/21

    Data Verification

    Rechecking for mistakes

    A second person checking Double entry using software to discover

    mismatches

    Is data accurate?

  • 8/13/2019 Databases - BH

    16/21

    Processing Data

    Searching(querying data) - criteria for the search

    SQL (structured query language) . SELECT ALLWHERE

    age > 13 AND name = Smith

    Joining conditions - AND,ORand NOT.

    Sortingascending/descending

    Importing: from another database,csv files

    Graphs- data exported to other programs to creategraphs

    Calculationsuse formulas to add etc

  • 8/13/2019 Databases - BH

    17/21

    The information stored in computer files must be keptup-to-date

    When a new record needs to be added, it is inserted.

    Records are deletedwhen they are no longer needed.

    Records are amendedwhen the data in a fields needsto be altered.

    Updating 1

  • 8/13/2019 Databases - BH

    18/21

    Master filemain fileis updated by comparing it with thetransaction filechanges made.

    Transaction file- details of all the changes that need to bemade to a master file are collected for later processing.

    Three generations of a master file are kept for backup

    purposes.

    Updating 2

    Master Transaction

    New

    Master

    New New

    Master

    Transaction

  • 8/13/2019 Databases - BH

    19/21

    Types of Databases

    Flat-file databasesone 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. Ifthey are not linked.. ? (what needs to be done?)

    http://d/XML/glossary.xmlhttp://d/XML/glossary.xml
  • 8/13/2019 Databases - BH

    20/21

    Tables Linked in a Relational

    Database

  • 8/13/2019 Databases - BH

    21/21

    File Access

    File organization Random access file

    records are not stored in any particular order

    sequential file records are sorted into some kind of order

    Accessing files Serial and sequentialfiles- 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 theother records.