20
© Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains activities created in Flash. These activities are not editable.

© Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

Embed Size (px)

Citation preview

Page 1: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 20041 of 20

Databases

Software

For more detailed instructions, see the Getting Started presentation.

This icon indicates the slide contains activities created in Flash. These activities are not editable.

Page 2: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 20042 of 20

What does it do?

Page 3: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 20043 of 20

Because databases can get very big, it is important to decide exactly what is going to be stored in each field.

What are its basic features?

Fields can be text, number, date, time, currency,logical (Yes/No) or look-up (choice from a selected list of words).

Page 4: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 20044 of 20

Some databases also allow the user to create an image field. This can be very useful, for example in the student file, as it would allow a photo of each student to be added to each record.

Another type of field is a calculated field. This is usually the result of a calculation based on numbers in another field.

Page 5: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 20045 of 20

It is usually a good idea to have a primary key field – a field which is different for every record, such as a customer number.

This helps to identify each record, because there can be no two records with an identical key field.

The database can automatically give each new record a number by setting the field type to autonumber.

Page 6: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 20046 of 20

Can I have a go?

This database shows records of students joining a college. Can you match the data type to the field name?

Page 7: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 20047 of 20

Validation is where the database looks for mistakes in data being entered.

What else can it do?

The database checks the data against the validation rules, and if the data is not valid, it gives the user an error message.

Validation cannot prevent all data entry mistakes, but it can find some.

Page 8: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 20048 of 20

In our database, one way we could validate the Date of Birth field is so that it only accepts dates after 1910.

We could validate the Number of GCSE Passes field to be less than 20.

That wouldn’t stop us entering Jerome’s passes as 1 instead of 7, because 1 and 7 would both be valid.

To find that mistake, we would have to verify the data by checking it against the source.

Page 9: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 20049 of 20

Format check – e.g. 2 letters then 2 numbers – PR15 would be valid.

Types of validation

Presence check – checking that the field contains data.

Range check – data is between certain numbers or letters, e.g. A–E.

Lookup check – only values from a set list can be entered, e.g. M or F.

Size check – checking data is more or less than a minimum or maximum number of characters.

Page 10: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 200410 of 20

If data is entered which breaks the validation rules, the database can give an error message to explain what is wrong.

It’s best if error messages are written in plain language to help the user understand what is wrong. For instance, if a field can only contain the data “M” or “F”, the message:

Entry not valid

is not nearly as helpful as:

Please enter M or F

Not telling!

Page 11: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 200411 of 20

Can I have a go?

The college database needs extra fields added. How would you validate them?

Page 12: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 200412 of 20

schools store information about pupils

What would it be used for?

Databases are used in many organizations to store information, for example:

banks store information about customers

the police store information about criminals and cases

shops store information about products they sell

directory enquiries companies store telephone numbers.

Page 13: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 200413 of 20

Forms and reports

Forms are designed to be viewed on screen. They make it easier for users to enter data into a database.

Reports are designed to be printed.

Page 14: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 200414 of 20

data can quickly be sorted into order

it is quick to search for information, and you can search on any field

you can even use a wildcard search if you only know part of the record. For instance, if you are looking for a person’s name, and you know the name begins with with Black, a wildcard search for Black* would return Blackham and Blackstock as well as Black.

Why?

Databases are used because:

Page 15: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 200415 of 20

Database tables

The college library lends Books

to Students.

Book ID Title Author Publisher

0001 Fishing J P Jones Bookit

0002 Sewing P R Green Morebook

0003 Football G K Singh Bookit

Student ID Last name First name Form

0103 Simons Michael 12H

0104 Chan Peggy 12N

Page 16: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 200416 of 20

Relational databases

In a simple flat file database system, when a student wanted to borrow a book, all the information about that book would need to be typed into the student’s record.That would take ages, and probably create lots of mistakes.

Loan

Instead, a relational database can be created. A new table called Loan is added and the tables are then linked together.

Page 17: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 200417 of 20

Student table

Student ID*

Last name

First name

Form

Book table

Book ID*

Title

Author

Publisher

* primary key field

Primary keys

To make sure we don’t get two students with the same name muddled up, each student is given a unique ID number. This is called a primary key field.

The same thing needs to happen to the book table, so each book is given a unique ID number.

Page 18: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 200418 of 20

The Loan table is linked to the Student table using the Student ID as the primary key field.

Loan table

Student ID

Book ID

Date issued

Date due

Relational links

It is also linked to the loan table using Book ID as the primary key field.

Now the information about the book and the student can be looked up from the other tables instead of being entered each time.

Student table

Student ID*

Last name

First name

Form

Book table

Book ID*

Title

Author

Publisher

* primary key field

Page 19: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 200419 of 20

A loan record

Book ID Title Author Publisher

0002 Sewing P R Green Morebook

Student ID Last name First name Form

0104 Chan Peggy 12N

Student ID Book ID Date loaned Date due

0104 0002 1/5/04 15/5/04

Data entered Data looked up

Page 20: © Boardworks Ltd 2004 1 of 20 Databases Software For more detailed instructions, see the Getting Started presentation. This icon indicates the slide contains

© Boardworks Ltd 200420 of 20

Summary

Databases are used to store data.

A database file is made up of records.

Records are made up of fields.

Fields can be text, number, date, time, currency or logical.

Validation checks data entered for mistakes.

Databases can search and sort information.

Forms are viewed on screen, reports are printed.

Relational databases link two or more files using key fields to save having to enter duplicated data.

Databases that don’t have relational links are called flat file databases.