Download presentation
Presentation is loading. Please wait.
Published byBrice Booker Modified over 6 years ago
1
IGCSE 4 Cambridge Designing a database table Computer Science
Section 2 Designing a database table Unit 8 System design and databases 4
2
Objectives To discuss some of the many computer systems which may hold data about you or your family on a database To learn how this data is held so that information can be quickly retrieved To learn some database terms: record, field, table, primary key, index To set up a simple table in Access and enter some records
3
Who holds data about you or your family?
From the day you are born, someone holds data about you! What about when you start school? When you go to the doctor or the dentist? When you join a Sports Club or some other organisation? Does your family own a TV, a car, or buy things online?
4
? What other data types are held?
An entity is a category of person or physical thing about which data is held in a database What entities do these organisations hold data about? A supermarket A cinema A Job Centre A secondary school ?
5
Database structure A database contains one or more tables
A table has rows, each row containing one record Columns in the table each contain one field of each record
6
A Film database The screenshot shows a database about films
The database has a single table with rows (records) and columns (fields)
7
MS Access database software
MS Access is a Database Management System (DBMS) The TblFilm table was created using MS Access This software allows you to create new tables, input and validate data, query the database and produce reports Using Access you can create a customised application
8
Structure of a database table
Each field (or attribute) in the table has to be given a name and a data type
9
Creating and amending a table structure
When you create a new database table, you need to specify what type of data is to be stored in each field Data types include: Text, integers, real numbers with a decimal point, dates, currency, and Yes/No fields
10
Choosing data types Data Example Data Type Age 14 Integer Shoe Size
6.5 Float Price 14.99 Date of Birth Height in CM Quantity in Stock Telephone Number
11
Choosing data types - Answers
Attribute Example Data Type Age 14 Integer Shoe Size 6.5 Float Price 14.99 Currency or Real Date of Birth 20/06/1992 Date Height in CM 192 or 192.5 Integer or Real Quantity in Stock 7 Telephone Number 001 (910) Text
12
The primary key field One field in the database has to be designated as the primary key Each record in the table must have a different value in the primary key field It uniquely identifies the record Which field is the primary key field in the TblFilm table?
13
Indexing a field The primary key field is automatically indexed
You can specify that other fields are to be indexed For example, you could specify that the field Title is to be indexed In a very large database, this will speed up searches on that field, just like having an index at the back of a book
14
Worksheet 1 Complete Task 1 to add some records to the Films database
Complete Task 2 to change the structure of the database table
15
Validating fields In order to minimise errors when data is entered into the database, as many fields as possible should be validated This means specifying a rule that the data must obey Validation rules include range checks, type checks, presence checks, format checks, list checks
16
Types of validation Range check: e.g. price must be between £1 and £25
Type check: e.g. A field must be a number data type Presence check: Data must be entered in the field Format check: e.g. Data must be in the format dd-mm-yy, or be an integer, or a valid postcode List check: Data must be one of the items on a predefined list
17
Worksheet 1 Now try Task 3 on the Worksheet
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.