44
Database Design and Development

Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Embed Size (px)

Citation preview

Page 1: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Database Design and Development

Page 2: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

 A database is a structured collection of similar information that you can search through.  A database package is a program for storing information on a computer. 

FIELD one piece of information RECORD a collection of fields about one person or subject FILE a group of record cards on the same topic

Name Joe BloggsClass 3GSubject Maths

Record

File

Fields

Page 3: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

A database package is an example of a General Purpose Package, a PROGRAM. Its job is to store large amounts of data which is organised into fields and records so that information can be obtained.

Click here for more on data and information

There is a much greater need for information nowadays, in fact some people say we are living in the Information Age. However you can also suffer from information overload as there is so much about.

Page 4: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

There are many advantages in storing data on a computer rather than using a manual system.

The trouble with a manual system is that

records easily get lost,

only one person can use a record at one time

it takes up a of lot space.

it can be slow to find things

records can only be in one order

Page 5: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Computerised records solve these problems because computer databases:

Take up little space

Records don’t get lost

Fast to search

Can be sorted into any order

On a network many users can view a record at once.

Page 6: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

BUT

Expensive hardware

Cost of software

Staff have to be trained

Worries about hackers / viruses

However the advantages far outweigh the disadvantages and every organisation uses computers nowadays to store their data.

Bill….….

Page 7: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Exercise 1 Do this in your jotter:

1. Here is some information from a database storing pupil records

(a) How many fields are shown here?

(b) How many records are shown here?

(c) What order are the records in? Are they in order?

2. The phone book is a database:

(a) How many fields are there?

(b) Are the records in any order?

(c) If you find a phone number but can’t remember whose it is, could you use the phone book to find whose number is it?

(d) If the phone book was stored in a database package, do you think you could find it now?

…. continued

Name Class Gender

J. Brown 2A male

A. Clark 4B male

P. Thomson 3C female

R. Singh 3D male

S. McLean 2B female

Page 8: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

 Exercise 1 (continued) 3. Give 2 reasons why many databases are stored on computer instead of on bits of paper or card.  4. Mary wants to set up a database to store details about her 10 best friends. She wants to keep their name and telephone number. (a) Suggest a suitable filename for this database.(b) How many fields should Mary put in each record?(c) How many records should Mary put in her database? 5. Give two disadvantages of using computers to store data.

…. continued

Page 9: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

 Exercise 1 (continued) 6. What is a database? 7. What is the difference between a database and a database package?

8. What is a : 

(a) file?(b) record?(c) field?

9. Why do you think people say we live in the ‘Information Society’?

10. What is the difference between data and information?

Page 10: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

In the ‘old’ days, many database packages were command driven, you just had a blank screen, you typed in commands which you had to know, they were not very helpful.

These were replaced by menu driven programs where you choose from a list of options. These were a lot easier for inexperienced users.

However you often had to go through lots of menus to get to the command you wanted, experienced users preferred the old system as they found it quicker.

Page 11: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Data is very important to companies, they would go out of business if they lost it. So they must have a reliable system of backups. A backup is just another copy. This copy can be on :

disk

Tape

CD R/W.

The backups must be made regularly and kept in a secure place.

Click here for more on backups

Page 12: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

You have all your data on computer, so how do you find the information.

To find something you must SEARCH.(or Filter or Query)

You search ON A FIELD. This field is the piece of information that you know -- a keyword which will identify the record(s) you want.

To find all pupils in 4L2, you would SEARCH the CLASS field for 4L2

Page 13: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

To find all the Smiths in a phone book, you would SEARCH the SURNAME field for Smith.

To find every pupil who passed an exam out of 100, you would SEARCH the MARK field for >49

To find all of Dr. Smith’s appointments on 3rd June you would SEARCH the DOCTOR field for Smith and the APPOINTMENT DATE field for 3/6.

Page 14: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

To find the biggest / oldest / cheapest etc. you have to SORT the database.

You can sort ASCENDING to put the smallest first (this is also alphabetical)

You can sort DESCENDING to put the biggest first.

To find the highest mountain, SORT the file on the HEIGHT field, descending .

To find the youngest, SORT the file on the AGE field, ascending.

Click here for more on searching and sorting

Page 15: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Exercise 2 Do this in your jotter:

 1.  Anne has all her customer’s details on a database and is worried that she might lose the data if her computer breaks down. What would you advise her to do?

2. A school has a computer database of all the pupils in school storing fields like firstname, surname, age, reg class, gender, address, etc. Show how you would search or sort to find:

a) All pupils in 3M1

b) All pupils who live in Kilmarnock Road

c) All girls in 4S2

d) All boys called Miller

e) The oldest pupils in the school.

f) All pupils in the school in alphabetical order of surname.

3. Explain the difference between command and menu driven programs.

Page 16: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Legal Requirements

Many people worry about having personal data stored all over the place on computers. Because of this Parliament has passed the Data Protection Act which requires companies to keep their data accurate and secure. Also if someone asks to see their record they must show them it.

Another problem is with hacking and viruses and there is a law called the Computer Misuse Act to deal with this.

Click here for more on these Acts

Page 17: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Security is a big problem for organisations storing personal data and under the Data Protection Act they must take all reasonable steps to secure their data.

Login Ids and passwords are the basic steps in security. Firewalls – programs that filter anyone trying to access a network from outside – are another step. Internally all employees should wear ID badges, network servers should be in a locked room, nobody must ever write down a password are other steps in security. Using data encryption to code all their data would also help.

Page 18: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Fields in a database can be of many different types.

The two basic ones are text and numeric. Text can contain numbers (eg in an address) and is sometimes called alphanumeric.

You can also get graphic fields, yes/no fields, memo fields (which contain large amounts of text) etc.

Credit should be able to calculate file size:

Page 19: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Exercise 3

1. John has been refused a loan and the bank won’t tell him why. He asks to see his bank records, what must the bank say?

2. The Data Protection Act requires companies who hold personal data to ensure certain things. Give two examples of what they must do regarding their data.

3. Give two examples of offences under the Computer Misuse Act.

4. Give two ways companies can help to keep their data secure

5. Would these fields be text or numeric:

a) Name b) Age c) Address d) Post code

Page 20: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Raw data is not of much use and has to be organised. Processed data becomes information.

An example of data is 310789What is it? We don’t really know.If it is processed in some way: My DOB is 31/07/89 Then it is information.

Data is the raw facts, information tells us something, it is meaningful.

InformationData

Click here to return

Page 21: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Exercise 1 Answers

 1.  (a) There are three fields

(b) There are five records.

(c) They are not in any order

2. (a) There are three fields in a phone book: Name (surname first), Address, Number

(b) They are in surname order.

(c) No, there are thousands to look through, you would never find it.

(d) Yes, you can search a computer database on any field.

3. With computer databases you don’t lose records, you can change records on screen, it is fast to find things etc.

4. (a) Friends etc.

(b) Two fields (you could have address as well, but the question didn’t say that, also you could split name into firstname and surname)

(c) There will be ten records.

Page 22: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

 Exercise 1 Answers (continued) 5. The hardware / software is expensive, staff have to be trained, staff might be worried about losing jobs etc.

6. A database is an organised collection of information.

7. A database package is the program that stores the database on a computer.

8. (a) The file is the whole collection of data.(b) A record is the information about one person or thing(c) A field is one piece of information.

9. Information has become so important in the modern world, there is so much of it and storing and processing it is very big business.

10. Data is the raw facts and figures, information is processed data that tells us something.

Click here to return

Page 23: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

One system of backups is called Grandparent – Parent – Child.

Monday’s file is the Grandparent

Tuesday’s the Parent

Wednesday’s the Child

On Thursday the grandparent copy will become the child, the child becomes the parent and the parent a grandparent and so it goes round each day.

Continued

Page 24: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Wait and watch!

Monday’s Tuesday’s Wednesday’s

work work work

Click here to return

Page 25: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Searching on more than one field is called a COMPLEX SEARCH.

To find all pupils in 5A who passed Credit at Standard Grade Maths:

SEARCH the CLASS field for 5A AND the MATHS GRADE field for <3.

If you want to find all girls who passed General Computing:

SEARCH the GENDER field for female and the COMPUTING GRADE field for >2 and <5

continued

Page 26: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

You can do a complex sort as well. This is quite common for putting a file in alphabetical order of name.

If there are separate fields for firstname and surname, you would sort first by firstname then by surname (both ascending)

You can sort on many fields, if you want a pupil file in reg class order (from S6 to S1) and in name order by class, SORT the FIRSTNAME field ascending, then the SURNAME field ascending then the CLASS field descending.

Click here to return

Page 27: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

 Exercise 2 Answers  

1. Should make regular backups of her data and keep them in a safe place. (You could also describe a method like granparent, parent, child).

2.

a) SEARCH the REG CLASS field for 3M1

b) SEARCH the ADDRESS field to include Kilmarnock Road.

c) SEARCH the GENDER field for female AND the REG CLASS field for 4S2 .

d) SEARCH the GENDER field for male AND the SURNAME field for Miller.

e) SORT on the AGE field descending.

f) SORT on the SURNAME field ascending. (it is better to say sort the firstname first)

3. With command driven you have to know the commands and type them in, preferred by experienced users. Menu driven you choose from a list, better for beginners.

Click here to return

Page 28: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Data Protection ActThis is a law (first passed 1984, updated 1998), that ensures Data Controllers (the people who keep the information on computer) and Data Processors (the people who process the information for the controllers) give rights to the Data Subjects (that’s us). The reason you have Data Processors is because a lot of companies have their IT outsourced, that is another company handles the computing for them.

Exemptions apply to Doctors, schools, police and national security services.

continued

Page 29: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Data Protection ActData Controllers must register with the Data Protection Registrar ( a Government office). Data Subjects have the right to see any information about themselves and have it corrected if it is wrong.

There are eight enforceable principals that says data must be:

fairly and lawfully processed

processed for limited purposes

adequate and relevant, not excessive

accurate

not kept longer than necessary

processed in accordance with the subject’s rights

secure

not transferred to countries without adequate protection

continued

Page 30: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Computer Misuse Act (1990)This governs the access to and use of computer systems and information within them.

It is an offence to gain unauthorised access (hacking) or perform a function with intent to gain access (eg trying to find out someone’s password).

It is an offence to cause unauthorised modification of data eg delete a file. This also covers viruses.

continued

Page 31: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Copyright Design & Patents Act

This makes it illegal to copy someone else’s work unless they have put it in the public domain or they have been dead for 50 years.

Even though you have bought a CD, it does not give you any right to tape it or copy it onto a CD R/W.

This is a civil law and gives the owner the right to sue for damages.

Click here to return

Page 32: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

You might estimate the maximum field length as:

Fieldname Length

Firstname 20

Surname 25

Address 40

Town 25

Postcode 10

Total: 100 bytes

If each record takes 100 bytes and there are 2000 records that gives 100 x 2000 = 20 000 bytes which is 20 000 / 1024 = 19.5Kb

Click here to return

Page 33: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Mail merge

This uses a word processor and database to produce personalised letters.

You create a standard letter with some data missing like name and address.

You put pointers in the letter where this data should go.

You create a data file with the missing data.

Perform a mail merge and the letter will be produced for everyone in the data file.

Page 34: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

<fname><sname>

<address>

Dear <fname>,

Blah blah blah blah

Yours

Me

Standard letter Datafile

MERGE

Page 35: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

Computed field

This is a field in a database that calculates something from the other fields.

To create a calculated field you enter a formula, just like a spreadsheet.

See example on next page

Page 36: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

A teacher records marks on a database. The fields are:

Name, Class, Test1, Test2, Test3, Test4, Average

No data will be entered in the Average field, instead there will be a formula:

=(Test1 + Test2 + Test3 + Test4)/4

Then when the test marks are entered, the Average will appear automatically in that field.

Click here to return

Page 37: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

 Exercise 3 Answers

1. They must let him see his record.

2. They must keep their data accurate and up to date, secure etc.

3. Hacking and spreading viruses.

4. Passwords, locking computer room, firewalls etc.

5. Would these fields be text or numeric:

a) text b) numeric c) text d) text

6. With serial access you have to wind your way through the tape to reach the data you want, with random access you go straight to it.

Click here to return

Page 38: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

 Exercise 3 National 5 Answers

7. A calculated field is a field that is calculated from other field(s) in the record.

8. Create standard letter with missing data, put field markers in the letter to show where the missing data will go, create data file that holds the missing data, perform a mail merge.

9. Field name Size

Fname 20

Sname 25

Age 2

Class 3

Gender 6

Total 56 bytes 56 x 1200 = 67200

67200 / 1024 = 65.6 Kb.

Click here to return

You can have different sizes -- they are just guesses.

Page 39: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

1. An estate agent uses a computer database to store information about houses. Here is an example of a record from the database. 

Town Newtown

House Type Semi

  Number of bedrooms 3

Price(£) 34000

Year built 1934 Photograph

 

  a) From this record, give an example of a field which contains

i)   a number ii)  text iii)    graphic

b) The estate agent uses the computer to get information about the houses. For example, to find all the flats, she would search on the House Type field. Complete the sentences below, write either sort or search in the first blank and the name of the field in the second.

i)To find all the flats: _____ on the ____ field

ii) To find the oldest house _______ on the ____ field

 iii) To find the most expensive house ____ on the _______ field

iv) To find all the houses in Newtown: _____ on the _____ field.

Page 40: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

2. Joe stores information about football players:

a) How many records are shown here. b) How many fields?

Use these words to copy and complete these sentences:

adds sorts record cost deletes field searches file

c) If Joe wants a list of all the Pollok players :

Joe ________ the team _________ for Pollok.

d) If Joe wants to add a new player e) If a player retires

Joe adds a new _________ Joe ________ the record

f) If Joe wants to know the most expensive player

Joe ________ the file on the _________ field.

Player Team Cost Years with club

Jim Dunn Arthurlie £2 500 3

Bill Smith Pollok £7 500 2

Ken Brown Petershill Free 1

Click here to return

Page 41: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

1. A school stores pupil information on a database:

Name: Joe Bloggs Class: 3L1 DOB: 1/2/1990

Reg Teacher: Ms. Martin Primary: Langside etc. etc.

a) Explain how you could get a list of all pupils in class order.

b) How would you find all the pupils in 2B that went to Battlefield primary?

c) The database contains private information. Give two ways the school could ensure that no unauthorised people get access to the data.

d) The school is worried that they might lose the data if something goes wrong with the computer. What should they do about this?

e) Joe Bloggs’ parent would like to see the data held about him. What should the school do about this?

Click here to return

Page 42: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

1. A company uses a database to store orders. There is a field called outstanding debt that works out how much each customer owes.

a) What kind of field is this?

b) There are eight fields in each record and the total number of characters for these fields is 200. If there are 1000 records, how many kilobytes would it take to store this database?

c) A floppy disc stores 1.4Mb, could this be used to backup the database?

d) The company want a printout of all customers who owe more than £500 in order of outstanding debt. Explain how they would do this.

e) The company are worried about hackers. a) What is a hacker? b) Which law made hacking illegal?

f) There is some personal information held about customers, what are the companies main responsibilities under the Data Protection Act?

g) The company uses the database to send personalised letters to customers. Explain the main steps in doing this.

Click here to return

Page 43: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

1.   a) i)   price or no. of bedrooms or year built. ii)  town or house type iii)    photograph

b) i) search on the house type field ii) sort on the year built field iii) sort on the price field iv) search on the town field.

2. a) 3 records b) 4 fields

c) Joe searches the team field for Pollok.

d) Joe adds a new record

e) Joe deletes the record

f) Joe sorts the file on the cost field.

Click here to return

Page 44: Database Design and Development. A database is a structured collection of similar information that you can search through. A database package is a program

1. A school stores pupil information on a database:

Name: Joe Bloggs Class: 3L1 DOB: 1/2/1990

Reg Teacher: Ms. Martin Primary: Langside etc. etc.

a) Sort the file on the class field ascending..

b) Search the class field for 2B and the Primary field for Battlefield.

c) Use passwords, lock the computer away etc.

d) They should make regular backup copies and keep them in a safe place.

e) Under the Data Protection Act they should let them see their son’s record as long as it does not contain any information about anyone else. (school’s have some exemption under the Act, but are still held to the main principals)

Click here to return