Information Technology
Grade 11
Topic: Database Management
Specific Objectives
Students should be able to:
• Create a database
Prepared by Ms. A. Cole
Creating a database
• A database is an organized set of records (data) held in tables that
can be easily managed.
• It is collection of data organized in a manner that allows access,
retrieval, and use of that data
Lets get started!!
1. Start up Microsoft Access
2. Select blank desktop database
3. Give your database the name Bookshop. Note this database will be
saved in your Documents if you do not specify another location
4. Click create
Now that you have created the Bookshop database, it is time to learn
how to create a table. Depending on the database program you are
using an empty table labelled Table 1 may be created for you. If so
right-click on its label to close or delete it.
Creating tables
For ALL tables in a database you should consider the following components:
• Field name
• Field Type also called data type
• Field length
• Field description
• Field properties
Challenge yourself!!
For EACH table components given on the previous slide give a description and an
example.
Record your answers in your notebooks to be shared at the appropriate time.
Create a table called Customer
1 Select the Create tab, locate the Table group, then click
the Table Design command. For now the table is called Table 1.
2
Click in the first Field Name box and type ‘CID’, then press Enter. In the data type column,
choose the Text type, press Enter, then Type the Description as ‘Customer ID Number’.
Now for the Field Properties:
Field Size: 4
Validation Rule : >999
Validation Text: Customer IDs start at 1000
3
Now add the remaining field names, data type and description
to your table
Field Name Data Type Description
CID Text Customer ID Number
Last Name Text Customer’s Last Name
First Name Text Customer’s First Name
Primary Key
A unique identifier (Primary Key), as its name suggests, is a way of
uniquely identifying each record in the database
Challenge yourself!!
There are other keys that may be present in a database table. Define the other keys
listed below and identify when they are most suitable to be used.
• Candidate key
• Composite key
• Foreign Key
Record your answers in your notebooks to be shared at the appropriate time.
Let’s now choose a field that will uniquely identify each record. If a primary
key is not chosen Microsoft Excel will ask you if you would like to create one
when you save the table
4 For this exercise. Make the CID field the primary key, meaning that every item has 4
digits and no two are the same.
1. Select CID Field
2. Select the Primary Key icon
5
Click the Save icon or ctrl + S to save the table.
Name the table as Customer and click OK to close the
dialogue box
Put your brain to work!!
In the same Bookshop database create the following tables
Field Name Data Type Description
PR-ID Text Product ID
Description Text Description of the Product
Cost Currency Unit cost of the Product
Make PR-ID the primary key and save the table as Product.
Field Name Data Type Description
CID Text Customer ID
PR-ID Text Product ID from Inventory
Qty Number Quantity ordered
Discount Yes/No 10% discount offered on
Product
Make CID and PR-ID the composite primary key
• Select the CID row, then while holding down the shift key, select
PR-ID row
• Then select the Primary key icon
• Both keys will have the primary key icon beside them
Save the table as Order table
What is the purpose of creating the composite key?
Tables should be join, so that
• Information can be accessed and coordinated in all the fields of the connected tables
• Save you from having to enter the same information in several tables
• Allows you to create forms, queries and reports from the related tables in the database file
Joining Multiple Tables
Tables should be join, so that
• Information can be accessed and coordinated in all the fields of the connected tables
• Save you from having to enter the same information in several tables
• Allows you to create forms, queries and reports from the related tables in the database file
Challenge yourself!!
The linking of two tables can occur in one of two ways:
• one-to-one
• one-to-many
Explain EACH type of relationship and provide examples of each.
Record your answers in your notebooks to be shared at the appropriate time.
Linking tables in a database
Put your brain to work!!
• Open the Bookshop database. Create a relationship among the
tables.
Is your relationship a one-to-one OR one-to-many
Remember
to save
your work
Capturing and Entering data in a database
You can start entering data once you have completed the table design.
Design view: allows you to enter field names, data type
and description into your database table.
Datasheet view: allows you to enter raw data into each
field of your database table
1 Open the Bookshop database.
2 Double click the customer table to open it.
3 To switch views between the Datasheet and the Design view, simply
click the button in the top left hand corner.
4 Click the Datasheet view and enter the data shown below into the customer
table and save it. CID Last First
1122 John Rich
1124 Aks Todd
1128 Tedd Lou
Put your brain to work!!
In the Bookshop database populate the following tables with the information
provided below
PR-ID Description Cost
P3122 Pocket Diary $8.95
P3429 Jumbo Clips $4.15
P3430 Small Clips $2.75
Product Table
Customer ID Product-ID QTY Cost
1128 P3430 10
1128 P3639 500 Y
1128 P3902 50
Order Table
Manipulate data in a database (Forms)