Presentation is loading. Please wait.

Presentation is loading. Please wait.

Slide 1 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Databases Computing Science Level - National 4 / 5.

Similar presentations


Presentation on theme: "Slide 1 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Databases Computing Science Level - National 4 / 5."— Presentation transcript:

1 Slide 1 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Databases Computing Science Level - National 4 / 5

2 Slide 2 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science What is a Database A database is a structured collection of similar information on one topic. Examples: –Phone book, library catalogue, criminal records, dictionary A database can be ordered either in ascending (A to Z) or descending (Z to A) order and on one or more fields. Example: –A phone book can be sorted by last name and first name in ascending order (A to Z)

3 Slide 3 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Important Elements A database contains 3 important elements: –Fields –Records –Files

4 Slide 4 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Field A field holds one piece of information Example: ForenameHelen Date of Birth12/12/95 TownCoatbridge

5 Slide 5 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Record A record is a collection of fields on one person or thing. Example: Your record in school would contain: your name; date of birth; your address.

6 Slide 6 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science File A file is a collection of records on the same topic. Examples: - The Police National Computer - Customer records in a bank - Pupil files held on school computers

7 Slide 7 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Create and Add Records Firstly the basic record structure is created by deciding on the fields names and field types. Secondly you must add new records –You can add records through a form or just entering data straight to the table

8 Slide 8 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Alter Records Once you have created your database, you must ensure the data is correct. You can alter the records through a form, or through the table. You can also alter the record format.

9 Slide 9 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Field A field is one single piece of information Example: - “name”, is one field this would be a text field. - “date of birth”, is another field and this would be a date field.

10 Slide 10 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Types of Fields Textholds letters, numbers and symbols Numerichold numbers for calculations Dateholds a date Timeholds a time Graphicholds a picture Calculated fieldperforms a calculation on the contents of one or more fields

11 Slide 11 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Types of Fields (contd.) LinkStores a reference to an external media file or a connection to a related database table BooleanOnly allows one of two values: yes/no true/false male/female

12 Slide 12 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Field Validation Validation ensures data entered is allowable and sensible Range check:-Ensures the data entered in the field is between a lower and upper limit: e.g. Cost > £0 AND < £100 Time > 1 minAND < 5 mins Length check:-Ensures that the data entered in the field has a restricted number of characters: e.g.PIN=4 chars Password>=6 chars Comments<200 chars

13 Slide 13 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Field Validation (cont’d) Restricted choice Gives the user a list of options to choose from. Prevents the user from typing in errors. e.g. Available dress sizes 8, 10, 12, 14, 16. Presence checkEnsures that the field is not left blank. Unique checkEnsures that the data entered in the field is different from any other record.

14 Slide 14 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Creating a new Field Fields can be added at any time. When on the table view, select the design view option This view will allow you to enter a new field.

15 Slide 15 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Searching The search facility allows you to look for information in the database. A search may be: SimpleLook for records with a match on one field ( They have one thing in common.) Eg Hair = “Brown” ComplexLook for records with a match on more than one item in one or more fields. Eg Hair = “Brown” AND Eyes = “Blue”

16 Slide 16 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Eg. To find all records for 1st to 3rd year in a school database you could search for: Year <= 3 Comparison operators <Less than < =Less than or equal to =Equal to > =Equal to or greater than >Greater than Not equal to Contains

17 Slide 17 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Sorting Sorting allows you to arrange the records in a database in alphabetic or numeric order. This can be ascending (A to Z or 1 to 9) or descending (Z to A or 9 to 1) Sorting on More than one field When two items are the same in one field they can be separated using a second field for sorting. For example, it is common to sort lists of names first by surname and then by first name

18 Slide 18 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Question Time Complete the questions below from the Standard Grade Computing J Walsh book chapter 4, pages 63 and 64. NAT 4: Foundation KU 1-3 and PS 1-5 General KU 1-3 and PS 1 OR NAT 5: Complete the booklet Page 1 - 4 Finish the questions above for next day.

19 Slide 19 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Calculated Field/ Computed Field A calculated field allows you to carry out a calculation on another field or fields and return the answer in the calculated field (similar to formulae in a spreadsheet). Example:Field 1: Date of birth Field 2: Today's date Field 3: Age Field 3 is a calculated field and contains the formula: Today’s date - Date of birth Other examples of calculated fields often used in reports include totals and sub-totals.

20 Slide 20 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Report Any information on your database that you print out is a report. You would normally do a search and / or a sort, and then select which fields you want to print.

21 Slide 21 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science This is the total number of characters, including spaces, needed to hold the information in a field. Eg. A Field containing the data ‘Computing Department’ Would have a field size of 20. Examples of databases include:- Telephone directory Police National Computer A personal Christmas card list. Size of a field

22 Slide 22 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Calculating the storage requirements of a database file FieldSize of field 130 24 325 424 58 64 748

23 Slide 23 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science FieldSizeBytes required 13030 244 32525 42424 588 644 744 888 Total for one record= 107 bytes If a database has 50 records the storage space required= 107 X 50 = 5350 bytes 5350 / 1024 = 5.22 Kilobytes

24 Slide 24 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Keywords This is the text used to search a file for a particular entry. Key Field This is a field which contains unique information for each record. That is, each record has a different number or text in the key field. Doing a search for an item on a unique field will only give one record. Example: SQA has a database of all pupils attempting Standard Grade Exam. Each pupil has a unique candidate number because there will be more than one pupil with the same name and date of birth.

25 Slide 25 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Types of Database Flat File database Used to store information about one topic Relational or Linked Database Used to store information about several related topics. Each topic stored as a separate file or table. Database tables linked to create one large database. The tables are linked through a key field, referred to as a primary key in one table and a foreign key in the other table. e.g. Pupils database

26 Slide 26 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Linked/Relational Database Example Pupils Database Pupils tableRegistration Classes table Forename Surname Date of Birth Registration Class Room Registration teacher Room phone number The two tables are linked by the same field being in both tables. This must be a key field in one of the tables. Registration Class is the key field in the Registration Classes table because it uniquely identifies a single class. This is also referred to as the primary key. The Registration Class field in the Pupils table is regarded as the foreign key.

27 Slide 27 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Data Protection Act Definitions: Data User is a person who holds and uses personal data about others or controls the use of it. Data Subject is a person about whom personal data is stored by a data user.

28 Slide 28 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science The Data subjects have the following rights: to know if data is held about them on a computer to see a copy of this personal data to make corrections if necessary to ask for compensation if data is inaccurate or access given to an unauthorised person.

29 Slide 29 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Under the Data Protection Act (1984) data users must: get and process the information fairly and lawfully register what reason they hold it for hold only relevant information hold only accurate and up to date information not keep information any longer than needed give individuals access to information about themselves and, where necessary, correct or remove wrong information take appropriate security measures.

30 Slide 30 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Exceptions to the Act There are exceptions to people’s right to see data held about them. The public are denied access to data held by the Police or security forces.

31 Slide 31 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Misuse of Computers The Computer Misuse Act is intended to protect all types of information (not just personal) stored on computer systems. Hacking This is the act of trying to gain unauthorised entry to files. This is done by using a wide area network and passwords.

32 Slide 32 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Viruses Some people enjoy writing and distributing computer viruses which destroy data and cause computers to crash or take up processor time in meaningless calculations. Viruses are usually spread by copying files (from unofficial sources). To prevent viruses spreading: Don’t share disks. Don’t copy software. Use an anti-virus program to check disks regularly.

33 Slide 33 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Mail Merge A database is the second general purpose package (along with a word processor) required to produce a mail merged document. Having studied both these packages, we are now in a better position to understand how a mail merge works. Mail merging is the process of combining details from a database with a standard letter in a word processing package, to produce personalised letters - as many letters as there are records in the database.

34 Slide 34 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science NameFlossie Year S1 NameJosie YearS5 NamePhyllis YearS4 Database Having created your database and your standard letter, you are ready to combine the two, filling the gaps in the standard letter with information from the database. Dear Parent, I am pleased to inform you that your child ___________ has won a prize for the best Computing student in __________ Head Teacher. Word Processed Standard Letter

35 Slide 35 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Dear Parent, I am pleased to inform you that your child > has won a prize for the best Computing student in > Head Teacher. Word Processed Standard Letter with database fields inserted ready for mail merge. When the mail merge is performed the field names in brackets are replaced with the appropriate fields from the database. This is done for every record in the database. The database field names are used to mark where in the standard letter information from the database will be inserted. These are shown in brackets like so > to mark them.

36 Slide 36 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Question Time Complete the questions below from the Standard Grade Computing J Walsh book chapter 4, pages 63 and 64. Credit KU 1 and PS 1-2 and Page 5 and 6 from the Database Booklet Complete questions for next day. Copy key points into your jotter.


Download ppt "Slide 1 Computing Science: Databases Revised May 2012 St Andrew’s High School Computing Science Databases Computing Science Level - National 4 / 5."

Similar presentations


Ads by Google