0% found this document useful (0 votes)
93 views

Exploring CAT Grade 12 - Hardware HTML Normalisation

Exploring CAT: Grade 12 is an educational book that covers various topics related to computer hardware, software, and database management. It includes detailed learning units on hardware components, HTML, and database normalization, providing exercises and activities for practical understanding. The book is part of the Exploring CAT series and is available for purchase online.

Uploaded by

oleratomotsepe07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views

Exploring CAT Grade 12 - Hardware HTML Normalisation

Exploring CAT: Grade 12 is an educational book that covers various topics related to computer hardware, software, and database management. It includes detailed learning units on hardware components, HTML, and database normalization, providing exercises and activities for practical understanding. The book is part of the Exploring CAT series and is available for purchase online.

Uploaded by

oleratomotsepe07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 75

Exploring CAT:

Grade 12
The title is a field that is used in the header.
The title will be covered by the front cover image.
Exploring CAT: Grade 12

Copyright © 2021
First Edition
All rights reserved

Further copies of this book and the books in this series may be ordered from [email protected] or
purchased online at www.funworks.co.za.
Exploring IT series also available at www.funworks.co.za.

Other books in the Exploring CAT series:


Grade 10
• Exploring CAT: Grade 10
Grade 11 (2020)
• Exploring CAT: Grade 11
Grade 12 (2021)
• Exploring CAT: Grade 12

Acknowledgements
The front cover and illustrations were inspired by the creative genius of Caroline Hills.
Thanks to Funworks publishers for assistance with editing this book.
Thanks to Kiara White for her incredible front cover design of both the Exploring IT and Exploring CAT
series.

Dedications
For my late mother, Leah, with all my Love.
Gary Blieden
For Andy, Robyn and Zachary – Love you to the moon and back, a thousand times, Mom.
Lyneth Crighton

Packages with Versions

• Windows 10 Version 1810


• Office 365 Version 1811
• Microsoft Office 365 Products are equivalent to Microsoft Office 2019 Products
Exploring CAT: Grade 12
Exploring CAT: Grade 12

Table of Contents

Learning Unit 1 Hardware .................................................... 1


1.1 Modular Design......................................................................................................................1
1.2 Components and Devices that Affect Computer Performance ...............................................2
1.2.1 CPU ................................................................................................................................2
1.2.2 RAM ...............................................................................................................................2
1.2.3 Graphics Card ................................................................................................................3
1.2.3.1 Integrated Graphics .....................................................................................................................3
1.3 Secondary Storage ................................................................................................................3
1.3.1 M.2 Format .....................................................................................................................4
1.3.2 M.2 vs. SATA ..................................................................................................................4
1.3.3 PCIe NVMe M.2 SSDs ....................................................................................................5
1.3.4 SATA SSDs ....................................................................................................................6
1.4 Choosing Input Devices .........................................................................................................6
1.5 Choosing Output Devices ......................................................................................................8
1.5.1 Monitors ..........................................................................................................................8
1.5.1.1 Touch Screens .............................................................................................................................9
1.5.2 Printers ...........................................................................................................................9
1.5.2.1 Multifunction Printer ...................................................................................................................10
1.5.2.2 Photo Printers ............................................................................................................................10
1.5.2.3 Speed and Volume ....................................................................................................................10
1.5.2.4 Resolution and Colour ...............................................................................................................10
1.5.2.5 Paper Type and Duplex Printing ................................................................................................11
1.5.2.6 Laser vs Inkjet ............................................................................................................................11
1.5.2.7 Network and Wireless Printers ..................................................................................................12
1.6 Upgrade vs Replace ............................................................................................................12
1.6.1 Upgrading RAM ............................................................................................................12
1.6.2 Upgrading Secondary Storage ......................................................................................12
1.7 Typical Computer Systems ..................................................................................................13
1.8 Newer Technologies ............................................................................................................13
1.8.1 Drones ..........................................................................................................................13
1.8.1.1 Advantages ................................................................................................................................14
1.8.1.2 Disadvantages ...........................................................................................................................14
1.8.2 Head-Mounted Displays................................................................................................14
CHECK POINT 1 ........................................................................................................................15

Learning Unit 5 HTML ........................................................ 18


5.1 HTML Table Tags ................................................................................................................18
Quick Reference A – HTML Table Tags .........................................................................................18
ACTIVITY 1 ................................................................................................................................18
Create a Table .......................................................................................................................................19
Change the Thickness of the Table's Border ........................................................................................19
ACTIVITY 2 ................................................................................................................................20
Insert Table Headings ............................................................................................................................20
ACTIVITY 3 ................................................................................................................................20
Change the Cellpadding and Cellspacing Attributes .............................................................................20
ACTIVITY 4 ................................................................................................................................21
Merge Rows and Columns Using Colspan and Rowspan Attributes ....................................................21
ACTIVITY 5 ................................................................................................................................22
Change the Table's Border Colour and Background .............................................................................22
ACTIVITY 6 ................................................................................................................................23
Change the Width and Height Attributes ...............................................................................................23
ACTIVITY 7 ................................................................................................................................24
Add a Caption to a Table .......................................................................................................................24
Centre the Table ....................................................................................................................................24

i
CHECK POINT 1........................................................................................................................ 25
EXERCISE 1 .............................................................................................................................. 27
EXERCISE 2 .............................................................................................................................. 28
EXERCISE 3 .............................................................................................................................. 29
EXERCISE 4 .............................................................................................................................. 30

Learning Unit 8 Database Normalisation ......................... 32


8.1 Database Terminology ........................................................................................................ 32
8.2 Relational Database Design ................................................................................................ 32
8.3 More About Keys ................................................................................................................. 32
8.3.1 Primary Keys ................................................................................................................ 33
8.3.2 Composite/Compound/Concatenated Keys .................................................................. 33
8.3.3 Choosing a Primary Key for a Table ............................................................................. 33
Example 1 ............................................................................................................................................. 33
Example 2 ............................................................................................................................................. 34
EXERCISE 1 .............................................................................................................................. 35
8.4 Derived Data ....................................................................................................................... 36
Example 3 ............................................................................................................................................. 36
Example 4 ............................................................................................................................................. 37
8.5 Non-Atomic Data ................................................................................................................. 37
Example 5 ............................................................................................................................................. 38
Example 6 ............................................................................................................................................. 38
EXERCISE 2 .............................................................................................................................. 39
8.6 Repeating Groups ............................................................................................................... 39
8.6.1 Repeating Groups – Type 1 ......................................................................................... 39
8.6.2 Repeating Groups – Type 2 ......................................................................................... 40
8.6.3 Data Redundancy ........................................................................................................ 40
8.7 Anomalies ........................................................................................................................... 41
8.7.1 Update Anomaly........................................................................................................... 41
8.7.2 Deletion Anomaly ......................................................................................................... 41
8.7.3 Insertion Anomaly ........................................................................................................ 41
8.8 Duplicate Data ..................................................................................................................... 41
EXERCISE 3 .............................................................................................................................. 42
CHECK POINT 1........................................................................................................................ 42
8.9 Relationships ....................................................................................................................... 43
8.9.1 One-to-One (1 : 1) ........................................................................................................ 43
8.9.2 One-to-Many (1 : n) ...................................................................................................... 44
8.9.3 Many-to-Many (m : n) ................................................................................................... 44
EXERCISE 4 .............................................................................................................................. 44
ACTIVITY 1 ................................................................................................................................ 45
8.10 Examples of Normalisation .................................................................................................. 46
8.10.1 Example 1: Car Repairs ............................................................................................... 46
8.10.1.1 Identify Different Tables ........................................................................................................ 46
8.10.1.2 Give Each Table a Primary Key ............................................................................................ 46
8.10.1.3 Analyse the Relationships Between the Tables ................................................................... 46
8.10.1.4 Link the Tables Using the Primary and Foreign keys ........................................................... 46
EXERCISE 5 .............................................................................................................................. 47
8.10.2 Example 2: Playlists ..................................................................................................... 47
8.10.2.1 Identify the Tables ................................................................................................................. 47
8.10.2.2 Give Each Table a Primary Key ............................................................................................ 47
8.10.2.3 Analyse the Relationship Between the Tables ..................................................................... 47
8.10.2.4 Link the Tables Using the Primary and Foreign Keys .......................................................... 48
8.10.3 Example 3: Recipe database ........................................................................................ 48
8.10.3.1 Identify the Tables ................................................................................................................. 48
8.10.3.2 Give Each Table a Primary Key ............................................................................................ 48
8.10.3.3 Analyse the Relationship Between the Tables ..................................................................... 48
8.10.3.4 Link the Tables Using the Primary and Foreign Keys .......................................................... 48
EXERCISE 6 .............................................................................................................................. 50
8.10.4 Example 4: Back to the Playlists................................................................................... 50
8.10.5 Example 5: Appointments............................................................................................. 50

ii
EXERCISE 7 ..............................................................................................................................51
EXERCISE 8 ..............................................................................................................................52
8.11 A More Complex Example – Running Club ..........................................................................53
8.11.1 Identify the Tables ........................................................................................................53
8.11.2 Give each Table a Primary Key ....................................................................................53
8.11.3 Analyse the Relationships Between the Tables ............................................................54
8.11.4 Link the Tables Using the Primary and Foreign Keys ....................................................54
8.11.5 Populate the Tables with Data ......................................................................................54
8.11.6 Refine the Tables to Eliminate Redundancy and Extra Data .........................................55
8.11.7 Apply Normalisation Rules ............................................................................................57
8.12 Referential Integrity ..............................................................................................................58
ACTIVITY 2 ................................................................................................................................58
8.12.1 Implement Referential Integrity in MS Access ...............................................................58
8.12.2 Check Referential Integrity ............................................................................................59
ACTIVITY 3 ................................................................................................................................60
8.13 Alternative Method of Normalisation ....................................................................................60
8.13.1 Characteristics of Normal Forms ...................................................................................60
8.13.2 Dependencies ...............................................................................................................60
8.13.3 Partial Dependency ......................................................................................................61
8.13.4 Transitive Dependency .................................................................................................61
CHECK POINT 2 ........................................................................................................................61
8.14 Normalising a Database to Third Normal Form ....................................................................62
8.14.1 First Normal Form (1NF) - it is not all it is cracked up to be ...........................................62
8.14.2 Second Normal Form (2NF) ..........................................................................................62
8.14.3 Third Normal Form (3NF) ..............................................................................................64
ACTIVITY 4 ................................................................................................................................64
EXERCISE 9 ..............................................................................................................................65

Learning Unit 1 Hardware Page 3


Learning Unit 1 Hardware
1.1 Modular Design
Purchasing a computer can be quite a daunting task. Fortunately, computers are built with a Modular
Design, which means that the computer you buy can be put together in pieces with your requirements in
mind, instead of consisting of a single unit in which all the hardware is fixed. Smaller technologies
(Laptops, Netbooks, Smartphones and Tablets) are less modular, and parts are not easily replaceable.
Each of the hardware parts are separate modules and are connected via the motherboard, using the
ports or the slots. For example, RAM, PCI cards and hard drives are easily interchangeable if they are
compatible with the motherboard.
http://www.snakebytez.com/other/introduction-computer-components

https://medium.com/computing-technology-with-it-fundamentals/system-hardware-component-motherboard-8e3d44e29f74

Learning Unit 1 Hardware Page 1


Modular Design has the following advantages:

• Repairs. Consider, due to load shedding, your power supply blows a fuse and your computer no
longer has electricity. In the early days of personal computers, the whole computer would have to
be sent in for repairs. This would lead to disruptions in your use of the computer (although it would
be a great excuse for not having completed your homework). In the modern computer, it is a
simple task to remove the offending power supply and replace it with a working unit.
• Upgrades. Modular Design simplifies the upgrading of the computer with better hardware. For
example, a gamer who wants to play extensive video games can buy a powerful desktop (fast
multiple processors with large cache and lots of RAM) but will need to include a high end card
designed for the gaming needs.
• Flexibility. Modular design allows for a variety of components to be added to the mother board
depending on the user's needs. The CPU, amount of RAM, secondary storage and graphics card
all contribute to the type of computer the user can choose. Laptops, tablets and mobile phones are
not as easy to upgrade and repair as their parts are highly integrated and are not easily
removeable.

1.2 Components and Devices that Affect Computer


Performance
1.2.1 CPU
Technique Description
Multiprocessing is having multiple CPUs, called cores, on a single
CPU chip. By having multiple cores, many processes can execute at
Multiprocessing the same time improving performance. For multiprocessing to be
effective, it must be supported by the motherboard and the operating
system.
The speed of the processor is much faster that the speed of RAM. For
example, a CPU's speed is 4.0 GHz whilst RAM is 1866MHz
(1.866Ghz) meaning that the processor can process instructions at
Processor Cache more than double the speed of RAM. Cache memory runs at a similar
speed as the CPU. It stores blocks of program instructions and data
that have been pre-fetched from slower RAM in the hope that these
instructions or data will be needed next by the CPU.

1.2.2 RAM
RAM is the main memory in chips on modules attached to
dedicated slots on the motherboard. RAM stores the programs
currently in use and the data associated with them.
The type of RAM used is commonly Double Data Rate (DDR)
SDRAM.
https://www.crucial.com/usa/en/differences-among-ddr2-ddr3-and-ddr4-memory

Page 2 Learning Unit 1 Hardware


Different types of RAM can have a big impact on the performance of a computer system as data has to
be moved in and out of RAM; the quicker this data can be
accessed and moved the faster the processor can get to
processing it. The higher the speed of RAM, the faster it can
deliver instructions and data to the cache.
The larger the cache, the more instructions can be stored at
any time and less direct access to slower RAM is required.
When choosing RAM, consider the frequency of the RAM and
the amount of RAM. The higher the frequency, the data can
to and from RAM and the larger the amount of RAM, means
that more can be stored without requiring virtual memory on
slower secondary storage.
An example of the RAM specification in a gaming laptop is
16GB DDR4 2666MHz RAM where 16GB refers to the
amount of RAM, which is 16 Gigabytes, DDR4 is the type of
RAM and 2666MHz is the speed of the RAM.
http://d2lupdnmi5p5au.cloudfront.net/i__src0079013440be134d6a916e8e177aa423_par089961214e4a6509d42cf95fd0a3a58f.jpeg

1.2.3 Graphics Card


A graphics card consists of a specialised processor called a Graphics Processing Unit (GPU). This
processor is housed on a separate card that connects to the motherboard via a slot such as PCIe. The
GPU processes (renders) images stored in the graphics card RAM, called Video RAM (VRAM). The
GPU allows the CPU to offload the burden of image processing freeing up the CPU to perform other
tasks.
At the time of writing, GDDR5 is the most popular and commonly used VRAM used in budget, mid-
range, and high-end graphics cards. GDDR5X is used in a few high-end graphics cards and is almost
twice as fast as GDDR5.

1.2.3.1 Integrated Graphics


For the average user, integrated graphics is more than adequate as opposed to a separate graphics
card, designed for gamers, who require more realistic images. The term "integrated" means that instead
of a separate GPU, the GPU is embedded into the CPU and instead of separate VRAM, the GPU shares
system RAM.

1.3 Secondary Storage


At the high-end of processing (video editing, 3D rendering or gaming), a faster HDD or SSD will
significantly improve the ability of the processing components (CPU/GPU) to access the data on
secondary storage as quickly as possible. A summary of the comparison between SSD and HDD are
highlighted here:

Learning Unit 1 Hardware Page 3


• SSDs have no moving mechanical components; HDDs contain spinning disks and movable
read/write heads.
• Compared with electromechanical drives (HDDs), SSDs are typically more resistant to physical
shock, run silently, have quicker access time and lower latency.
• SSDs are still more expensive per unit of storage than HDDs.
• SSDs take around three times less boot up time than HDDs.
• SSDs consume less power, also averaging about three times less than that of an HDD.
• Storage capacity of SSDs are typically not larger than 1TB for laptops; 4TB for desktops. HDDs are
typically around 500GB and 2TB maximum for laptops, 10TB maximum for desktops.
• SSDs have no vibration, no sound and no moving parts; HDDs have spinning of platters that can
sometimes result in vibration and noise.
• SSDs file opening speeds are up to 30% faster than HDDs.
• SSDs are safe from the effects of magnetism, but magnetic interference can erase data on HDDs.
ref:https://www.geekboots.com/story/hdd-vs-ssd

As SSDs become more affordable, there are a variety of SSDs available. We will discuss M.2, PCIe
NVMe and SATA SSDs.

1.3.1 M.2 Format


M.2 is a form factor – it describes the shape and size of a hardware device. The M.2 connector can
access the PCI-express 3.0, SATA 3.0 and USB 3.0 bus, depending on the type of M.2 device.
M.2 SSD are small drives connected directly to an M.2 socket on the motherboard as opposed to SATA
based drives that use cables to connect to the motherboard and provide power. The innovative lack of
cables makes M.2 drives ideal for Small Form Factor (SFF) systems that have little room for cable
routing.
There are two main types of M.2 SSDs, the first uses the PCIe bus (known as NVMe SSDs) and those
that use the SATA bus.

1.3.2 M.2 vs. SATA


M.2 SSDs and SATA SSDs are both SSDs but with different sizes and connectors. M.2 is a small form
factor and SATA is a bus type. SATA SSDs come in two form factors: 2.5 inch and M.2. The 2.5 inch
form factor needs two cables (data and power) to connect the SSD to the motherboard. M.2 SSDs has

Page 4 Learning Unit 1 Hardware


the same performance as their 2.5 inch counterparts and plug directly into the motherboard, eliminating
the need for cables.

https://www.performance-computer.com/learn/ssds-compared/

1.3.3 PCIe NVMe M.2 SSDs


An exciting feature of M.2 based SSDs are the Non-Volatile Memory express (NVMe) that connect via
PCI-express. SSDs are essentially high-speed memory, but since SATA 3.0 was only capable of 6GB/s,
the access speeds of SSDs were limited. By accessing the PCI-express bus, instead of the aging SATA
bus, NVMe drives can run at much faster speeds.

SATA III Hard Drive SATA III SSD NVMe SSD


~100 MB/s Read 530 MB/s Read 3,500 MB/s Read
~100 MB/s Write 500 MB/s Write 3,000 MB/s Write

NVMe SSDs produce a significant increase in speed over SATA SSDs. By upgrading a mechanical hard
drive to an SSD increases performance in tasks from boot speeds to file load speeds; however,
upgrading to an NVMe SSD will
produce even more significant
performance gains. Most modern
motherboards support NVMe
connections via the PCIe bus, but
some older boards provide a M.2
slot connected to the SATA bus
limiting the speed of the SSD
drive. To achieve these speeds
from your NVMe SSD, make sure
your operating system is installed
on the SSD drive together with
frequently used programs, games
and data.

https://www.performance-computer.com/learn/ssds-compared/

Learning Unit 1 Hardware Page 5


1.3.4 SATA SSDs
SATA is an older, slower bus technology found in desktop and laptop PCs. SATA drives require a SATA
power cable as well as a separate SATA data cable unless you are using an M.2 SATA based SSD.
Common SATA devices include 2.5 inch SSDs, 3.5 inch mechanical hard drives and 5.25 inch
optical/Blu-ray drives.
https://www.performance-computer.com/learn/ssds-compared/

1.4 Choosing Input Devices


Device Description Purpose and
Use
Keyboard Keyboards are the most common input Input
device which allows a user to type data to be alphabetical,
entered into a computer. Unfortunately, data numeric and
entered via a keyboard is highly prone to special
errors. Users often make mistakes when characters one
typing in data, requiring this data to be character at a
validated. time.

https://www.tutorialspoint.com/computer_
fundamentals/images/keyboard.jpg

Mouse The most popular pointing device. Most have Select icons,
a have a left and right button along with a menus,
scroll wheel to allow the user to select icons dropdown
on the screen. Laptops provide a track pad boxes.
to serve the same purpose as a mouse.
Most mobile devices have touch screens
where users can select icons.

https://www.tutorialspoint.com/computer_
fundamentals/images/mouse.jpg

Scanner Scanners convert captured images to a Suitable to


digital format. Most scanners can scan A4 convert printed
pages and can be combined with a printer. pages to an
Scanners can use Optical Character image or a text
Recognition (OCR) to convert the images to format.
a text editable format.

https://www.tutorialspoint.com/computer_
fundamentals/images/scanner.jpg

Page 6 Learning Unit 1 Hardware


Device Description Purpose and
Use
Bar Code and QR Code Readers Bar code readers read data encoded as a Read prices,
series of lines. Instead of a bar code a QR ISBN
code can be used as it contains more data numbers, links
than a bar code. Bar code and QR code to web sites
scanners are useful to limit a user's input. (QR Code).

https://cdn.shopify.com/s/files/1/0005/2907/2172/
products/51o6le6JPVL._AC_SX466_1024x.jpg
?v=1587314783

Biometric Scanners Biometric scanners capture biometric data Access control


(fingerprint, iris, facial features) for to a building,
verification of a person's identity. The scans user
match the inputted data against previously authentication
saved database to approve or deny access for a device.
to the system.

https://www.famoco.com/wp-
content/uploads/2019/07/product-table-FP201-
fingerprint.jpg

Microphone Converts sound to a digital form that can be Suitable for


stored as a file. video
conferences,
recording
messages and
songs.

https://www.tutorialspoint.com/computer_
fundamentals/images/microphone.jpg

Webcam A webcam is usually a small video camera Video


connected to a computer or built into the conferences
computer hardware that streams an image or
video in real time to a computer network or
the Internet.

https://m.media-
amazon.com/images/I/4161GwR8l4L.jpg

Learning Unit 1 Hardware Page 7


Device Description Purpose and
Use
Headphones and Headset Headphones are useful to hear sound from Gaming, video
the computer without disturbing others. The conferences.
sound is usually of a higher quality than the
computer can produce with its internal
speaker. If a microphone is included with
headphones it is called a headset and can
both input and output sounds.

https://in.toshibaaudio.com/wp-
content/uploads/sites/4/2019/03/game-blue-1-
600x600.jpg
https://www.tutorialspoint.com/computer_fundamentals/computer_input_devices.htm

1.5 Choosing Output Devices


1.5.1 Monitors
A monitor is described using:

• screen size,
• aspect ratios,
• resolution, and
• refresh rate.
Screen size is measured diagonally across opposite corners in
inches. Laptops have screens are usually 15", monitors
normally range between 17” and 43” but some monitors can be
up to 80". Screen resolution is the number of pixels on a
screen measured in width and height.
https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Display_size_measurements.png/220px-
Display_size_measurements.png

Page 8 Learning Unit 1 Hardware


Aspect ratio is the monitor's width in relation to the screen’s height.

https://cdn5.vectorstock.com/i/1000x1000/54/64/icon-monitor-sizes-vector-18095464.jpg

If you pack more pixels in the same size monitor with the same aspect ratio, the image will be sharper
and clearer since there are more pixels are packed into the same aspect ratio. Ultra-wide monitors are
useful as their extra width can be used to view two applications side by side on one monitor instead of
using two separate monitors.
Refresh rate is the number of frames that are displayed in a second. Monitors with a high refresh rate
require a graphics card and are usually necessary for high-end users like gamers.
There are many different types of monitors available. The monitor that you choose is usually dependant
on three categories:

• general or business use monitors are found at home or work offices and display Microsoft Office
applications, web browsers, or computer programs that do not need graphics processing. These
monitors are fairly low in price and the PC will not need a graphics card.
• professional visuals such as a digital artist, require monitors that that display the images in the
correct colour and to a higher resolution so that the finished product will look similar on other
screens. These professionals work on applications such as Adobe Photoshop for image editing or
Corel VideoStudio for video editing.
• gaming requires monitors with a high refresh rates and a PC with a powerful graphics card.
https://www.newegg.com/insider/how-to-choose-the-best-computer-monitor-buying-guide/

1.5.1.1 Touch Screens


Touch screens are both an input and output device eliminating the need for a keyboard and mouse
saving physical space. Touch screens are easier to use, easier to clean and sterilize making them ideal
for environments such as restaurants, hotels, hospital and other medical healthcare settings.

1.5.2 Printers
When choosing a printer many factors need to be considered since there is a large variety of printers
available each suitable to a specific situation. It goes without saying that documents should only be
printed if absolutely necessary to save the environment. Before settling on a printer, the purpose of the
printer needs to be considered. Is the printer for home or small office use, or a large office? Will the
nature of the business change which could influence printing features and functions?

Learning Unit 1 Hardware Page 9


1.5.2.1 Multifunction Printer
A MultiFunction Printer (MFP) combines scanning,
faxing with printing. The printer can be either an inkjet or
a laser. For use in a home or small office a multifunction
printer will be cheaper than buying a separate scanner
and printer. Most homes or offices need to scan and
print documents; however, a fax is seldom required as it
has become obsolete.
A single unit to print and scan will save desk space.
Multifunction are common and are of a reasonable price.

https://mobile.smallbusinesscomputing.com/imagesvr_ce/9832/Epson%20ET-4550%20EcoTank.jpg

1.5.2.2 Photo Printers


Photo printers are useful to immediately print photos without waiting
for the photos to be professionally developed. These printers can
produce prints of a higher quality and great colour accuracy, but the
cost of the printer is higher than a typical multifunction printer. A
photo printer is smaller is size printing photos usually between 4 to 6
inches wide. The cost of the paper and the cartridges are generally
more expensive.
https://www.makro.co.za/sys-master/images/h56/h9c/9885271457822/silo-
MIN_346490_EAA_large

1.5.2.3 Speed and Volume


The speed at which a printer can print pages is called Pages Per Minute (PPM). Printers tend to print
black and white pages faster than colour pages. The speed at which a printer can print is not critical for
home or small business use but can be a factor to consider for businesses that print many documents.
Today, an effort should be made to reduce the amount of paper printed but this is not always possible.
The frequency at which you will need to use your printer daily and the number of pages printed will
indicate whether the volume is high or low. Buying a heavy duty printer for a low volume will be
unnecessary if you seldom use the printer.
https://www.digitaltrends.com/buying-guides/printer-buying-guide/

1.5.2.4 Resolution and Colour


Dots Per Inch (DPI) refers to the number of dots of ink the printer can apply to a square inch of paper.
DPI is useful to determine the printer's ability to create high-resolution, high-detail images.

https://99designs-blog.imgix.net/blog/wp-content/uploads/2019/07/DPI-RESOLUTION.jpg

Monitors, television screens, digital cameras and scanners use a combination of Red Green Blue (RGB)
light to produce a variety of colours. When all are combined white is produced. Printers use Cyan
Magenta Yellow and Black (CMYK) in "4-color process printing". When all four pigments are combined

Page 10 Learning Unit 1 Hardware


black is produced making it physically impossible for the printing press to reproduce the colours we see
on monitors.

https://99designs-blog.imgix.net/blog/wp- https://99designs-blog.imgix.net/blog/wp-
content/uploads/2019/06/RBG-2- content/uploads/2019/06/CMYK-
column.png?auto=format&q=60&fit=max&w=930 915x915px.png?auto=format&q=60&fit=max&w=930

1.5.2.5 Paper Type and Duplex Printing


Printers with duplex printing provide an option to print on both sides of the paper. When combined with
printing two pages per sheet, four pages can effectively be printed on one piece of paper. This feature
may not be necessary for small companies or home use where the volume of printing is low but can save
paper in large businesses with a high printing volume
The type of paper handled by the printer is influenced by the function of the business. A4 is the most
common paper size and printers that can handle this size tend to be cheaper. Heavier paper such as
certificates, index card or envelopes are normally printed from a bypass tray which can be time
consuming to constantly refill. Consider a printer that can support heavy paper from the standard trays.
https://www.soscanhelp.com/blog/what-to-look-for-when-shopping-for-new-printers
https://www.printingforless.com/color.html

1.5.2.6 Laser vs Inkjet


Today laser and inkjet printers are similar in speed and quality. There are a few key points to consider
when choosing between the two:

• Laser printers use toner unlike inkjet printers which use ink. Toner tends to last longer than ink
reducing the running cost of the printer.
• The initial cost of an inkjet printer is usually quite cheap, but the cost of the cartridges can be more
expensive. If you have low printing volumes, an inkjet can be more cost effective.
• Inkjet printers are more suitable for printing photos and color documents and laser printers are
more suitable for printing documents. There are colour laser printers available but are more costly.
• A laser printer would be a more cost effective option if you have high printing volumes since it will
be cheaper when it comes to the average cost per page.
• Inkjet printers are usually smaller and take up less space which can be advantageous for a small
home office.
https://introstat.co.za/news/tips-for-choosing-the-right-printer-for-your-needs/

Learning Unit 1 Hardware Page 11


1.5.2.7 Network and Wireless Printers
Network printers are connected to the local network allowing many printers to computers to the single
printer saving the cost of buying a printer for each user. Network printers are compatible with a variety of
operating systems such as Windows, Android, IOS and Mac. Network printers can be connected through
wired or wireless connections.
A wireless printer has the printing information sent to the printer via wireless connection. A wireless
printer can be connected to a network and used by multiple computers or it can also serve as a
standalone printer for one computer. Wireless printers save the cost of cables to connect the printer to
the network and can easily be moved.
https://smallbusiness.chron.com/primary-difference-between-peertopeer-clientserver-architectures-76966.html

https://756388.smushcdn.com/1373136/wp-content/uploads/2019/05/Connect-printer-to-router.jpg?lossy=1&strip=1&webp=1

Some printers have USB ports allowing a user to print from a flash drive that is plugged directly into the
printer.

1.6 Upgrade vs Replace


A computer should be replaced if:

• your computer is more than eight years old,


• there are few compatible components available, or
• the price of the components you need to replace is close to or more the cost of a new computer.
When looking for a new computer choose one that will last for many years and can be easily upgraded.
Investigate the warrantees and guarantees offered with the computer. A three year onsite warrantee may
seem costly but will be beneficial should your computer breakdown as it can be repaired at you home or
business. Sending a computer in for repairs can leave you without a computer for weeks which can be
inconvenient.

1.6.1 Upgrading RAM


If you are experiencing trouble opening new Internet browser tabs or there is a delay when you are
working with large documents, you might need more RAM. You can either add more RAM to what you
currently have provided there are available slots on the motherboard and the new RAM is similar to
existing RAM; or you can update all the RAM in your system to a faster speed and more capacity that is
compatible. Adding more RAM will reduce the amount of virtual memory needed as more programs and
data can be stored in RAM at one time.

1.6.2 Upgrading Secondary Storage


If opening large files and documents is problematic, or if your computer is displaying messages stating
you do not enough space when you save photos, music, or movies, you need more secondary storage
space. A simple solution would be to move your photos, music and movies to another storage device like
an external hard drive or to the cloud, alternatively you could buy a larger hard drive.

Page 12 Learning Unit 1 Hardware


When buying a new a hard drive, consider upgrading to a solid state drive to improve access time when
saving and loading files. A faster hard drive will speed up virtual memory when the computer runs out of
RAM.
https://www.crucial.com/articles/pc-builders/what-to-do-with-an-old-computer

1.7 Typical Computer Systems


Type of Computer Example Specifications Typical User
Slowest CPU, minimum This PC will adequately perform Web
amount of RAM, storage surfing, email, word processing and basic
and lowest screen business tasks. It would suit home or small
Laptop or Desktop
resolution: Celeron business users that do not need high
PC (entry level)
Processor (2 to 2.7GHz); performance or graphics capabilities.
4GB RAM; 500GB Hard
Drive; HD Graphics card.
I3, (usually 2 cores, may be As this category fits between the previous
4); 2 to 3GHz Processor; 4, and next suiting users that need faster
Laptop or Desktop 6 or 8GB RAM; 1TB HDD or processing and better graphics capabilities
PC (mid-level) up to 512GB SSD; for business or gaming, but do not need the
UHD Graphics card. expense of the fastest and best. They can
be used in small networks.
I5 (4 to 6 cores); 2.4 to These computers are for power users who
3.4GHz Processor; 8GB utilise the most advanced features of
RAM; 1 to 2TB HDD or 256 applications requiring the most capable
to 480GB SSD; GPU. machines that are optimised for their work
I7 (4 to 8 cores); 3.2GHz purposes. Power users include video-editing
Laptop or Desktop
Processor; 8GB RAM; 1 to professionals, high-end graphic designers,
PC (high level)
2TB HDD or 256 to 480GB audio producers, and those who use their
SSD; GPU. computers for scientific research.
Professional gamers are included in this
category are they require machines that will
play their games at a high frame rate..

1.8 Newer Technologies


1.8.1 Drones
Drones, more formally known as Unmanned Aerial
Vehicles (UAVs), are aircraft devices that fly above
the ground and are not piloted. They perform
actions that are either controlled remotely by a
human operator or are pre-programmed to respond
to sensors and make decisions.

https://www.equinoxsdrones.com/blog/10-major-pros-cons-of-unmanned-aerial-vehicle-uav-drones

Learning Unit 1 Hardware Page 13


1.8.1.1 Advantages
• Maintain a safe environment – Drones can monitor dangerous or hard-to-reach locations such as
radiation sites, bomb sites, oil and gas refineries, pipelines and high-voltage lines. They can be
used to obtain real-time data to create and preserve a safe environment.
• Cost saving – As drone's are becoming more readily available they are more economical to buy,
maintain, and fuel than airplanes.
• Quality of arial imaging - UAVs can take high quality photographs, videos which can be
transformed into detailed 3D maps and 3D models to discover cracks, damages, or other
hazardous elements in disaster areas. When combined with high-resolution images or videos it can
be used to live stream events such as entertainment, personal, political, and global affairs.
• Precision – Using GPS a drone can be guided
to precise locations. For example, a drone can
perform precision tasks such as spray crops
with pesticides, identify weeds and monitor
crop health.
• Easy to control and deploy - operators can
quickly deploy and operate drones with a
relatively minimal technical background.
Drones have a wider range of movement, can
fly lower in all directions, and can navigate
easily compare to a crewed aircraft.
• Package delivery – drones can be used to
deliver packages reducing traffic. They can
deliver vital medicines and vaccines to places
not easily accessible.
https://geospatialmedia.s3.amazonaws.com/wp-content/uploads/2018/10/d-in-retail.jpg

1.8.1.2 Disadvantages
• Privacy and spying– drones can be used to trespass or spy on a group or individual's privacy.
Drones are small and are fairly quiet making them difficult to notice. They are used by paparazzi to
photograph celebrities and by criminals to track their targets. The rules regarding regulation of
drone movement and property protection from aerial trespassing need to be clarified.
• Vulnerable to wild animals - drones are frequently attacked by wild animals such as large flying
birds like eagles. Poachers make use of drones to locate animals for exotic trade in rhino horn,
elephant tusks and pangolin scales amongst others.
• Easy to hack - hackers can take control of the drone's central control system to access private
information, corrupt or damage the files, and leak data to third parties.
• Weather dependant - drones are more vulnerable to weather conditions compared to traditional
aircraft.
https://www.equinoxsdrones.com/blog/10-major-pros-cons-of-unmanned-aerial-vehicle-uav-drones

1.8.2 Head-Mounted Displays


A Head-Mounted Display (HMD) is worn on the head or is embedded in a helmet with a small display for
one or both eyes and is used in gaming, aviation, engineering, and medicine. The first HMD used a
standard LCD screen to display images, movies, and 3D videos. For example, Google Cardboard used a
low cost cardboard design combined with a smartphone. Augmented Reality (AR) creates an effect of
digital content interacting with the world by overlaying projected images on top of a pair of see-through
glasses. Virtual Reality (VR), such as Oculus Rift, increases user participation bringing the user into a
complete different virtual world.

Page 14 Learning Unit 1 Hardware


https://www.glassup.com/en/augmented-reality-virtual-reality/

CHECK POINT 1

1. What does modular design mean?


2. Name three advantages of modular design.
3. Explain how more than one processor can affect the computers performance.
4. How does cache memory improve processor performance?
5. What factors should be considered when buying new RAM?
6. Explain why a graphics card is better than an integrated graphics card for rendering images?
7. List four advantages of an SSD.
8. What is M.2 format?
9. Which is the best bus to attach to an SSD?
10. Name the two most commonly used input devices.
11. Give an example of a scenario that would require the following types of scanners.
11.1. A4 scanner with OCR
11.2. Bar code scanner
11.3. QR code scanner
11.4. Biometric scanner
12. If a laptop has its own webcam, give a situation when a second separate webcam would be useful.
13. What is the difference between headsets and headphones.
14. Name four factors that describe a monitor.
15. Provide the specifications of a monitor for the following scenarios:
15.1. A personal assistant that types documents, sends and receives emails and updates her
calendar.
15.2. A professional gamer.

Learning Unit 1 Hardware Page 15


15.3. A digital artist.
16. Name and describe four factors to consider when choosing a printer.
17. List three factors to be considered when choosing to upgrade or replace a computer.
18. Name three components or devices that have a significant impact on the computer's performance
when upgraded.
19. List three advantages and disadvantages of drones.
20. Explain the difference between AR and VR.

Page 16 Learning Unit 1 Hardware


Learning Unit 1 Hardware Page 17
Learning Unit 5 HTML
5.1 HTML Table Tags
In Learning Unit 7 of Exploring CAT: Grade 11, HTML was introduced to create webpages using
Notepad++. A later version of Notepad++ was installed in Learning Unit 2. In this Learning Unit, we will
cover how to insert tables in HTML using the HTML table tags.

Quick Reference A – HTML Table Tags


TAG Description Example
<table></table> Creates a table. <table></table>
<tr></tr> Creates a row in a table. <tr></tr>
<td></td> Creates a cell in a table. <td></td>
<th></th> Creates a table header (a cell with <th></th>
bold, centred text).
<table width=" "> Sets the width of the table. <table width="50">
<table border=" "> Sets the width of the border around <table border="1">
the table cells.
<table cellspacing=" "> Sets the space between the table <table cellspacing="1">
cells.
<table cellpadding=" "> Sets the space between a cell <table cellpadding="1">
border and its contents.
<tr align=" "> Sets the alignment for cell(s) ("left", <tr align="left">
can also be "center" or "right").
<tr valign=" "> Sets the vertical alignment for <tr valign="top">
cell(s) ("top", can also be "middle"
or "bottom").
<td colspan=" "> Sets the number of columns a cell <td colspan="2">
should span.
<td rowspan=" "> Sets the number of rows a cell <td rowspan="4">
should span.
<caption> </caption> Defines a table caption. <caption>My
The <caption> tag must be Timetable</caption>
inserted immediately after the
<table> tag.
<center> </center> Centres a table to the webpage. <center> </center>

ACTIVITY 1
In Notepad++, create a new document with the file name tables.html.
Save the document in LU 5 of the Learner Files folder.

Page 18 Learning Unit 5 HTML


Create a Table
Type the following text into the blank tables.html as shown:
<html>
<head>
<title>HTML Tables</title>
</head>

<body>
<table border = "1">
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>

<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>

</body>
</html>
Open tables.html in a web browser to see that the webpage is created with two rows and two
columns.

Change the Thickness of the Table's Border


Remove the table border by changing the table border to 0.
<table border = "0">
Save the document and open in a web browser. The
border should be removed.
Now change the border from 0 to 3.
<table border = "3">
Save the document and open in a web browser. The
border will thicker and bevelled to that the top and left
lines are lighter than the bottom and right are darker.
NOTE: The thickness of the outside border is changed by the table border command. It does not affect
the borders of the internal cells.

Learning Unit 5 HTML Page 19


ACTIVITY 2
Insert Table Headings
Using tables.html in Notepad++, add the code in bold to create headings.
<html>

<head>
<title>HTML Table Header</title>
</head>

<body>
<table border = "1">
<tr>
<th>Column 1 Heading</th>
<th>Column 2 Heading</th>
</tr>
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>

<tr>
<td>Row 1, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
</body>

</html>
Save the document as headings.html in LU 5 of the Learner Files folder.
Open headings.html in a web browser to see that the table has a row of headings included above
the two rows.

ACTIVITY 3
Change the Cellpadding and Cellspacing Attributes
Using headings.html in Notepad++, add the code in bold to change the cell padding and cell
spacing.
<html>

<head>
<title>HTML Table Cellpadding</title>
</head>

<body>
<table border = "1" cellpadding = "5" cellspacing = "5">
<tr>
<th>Column 1 Heading</th>
<th>Column 2 Heading</th>
</tr>

Page 20 Learning Unit 5 HTML


<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>

<tr>
<td>Row 1, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
</body>

</html>
Save the document as cellpad.html in LU 5 of the Learner Files folder.
Open cellpad.html in a web browser to see there is a space between each cell in the table (cell
spacing) and there is a space between the text and the border of each cell (cell padding).

ACTIVITY 4
Merge Rows and Columns Using Colspan and Rowspan Attributes
Using cellpad.html in Notepad++, add the code in bold to change the cell padding and cell
spacing.
<html>

<head>
<title>HTML Table Colspan/Rowspan</title>
</head>

<body>
<table border = "1">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
<tr>
<td rowspan = "2">Row 1 Cell 1</td>
<td>Row 1 Cell 2</td>
<td>Row 1 Cell 3</td>
</tr>
<tr>
<td>Row 2 Cell 2</td>
<td>Row 2 Cell 3</td>
</tr>
<tr>
<td colspan = "3">Row 3 Cell 1</td>
</tr>
</table>
</body>

Learning Unit 5 HTML Page 21


</html>
Save the document as columnspan.html in LU 5 of the Learner Files folder.
Open columnspan.html in a web browser to see that the cell Row 1 Cell 1 is merged across two
rows and Row 3 Cell 1 is merged across three columns.

ACTIVITY 5
Change the Table's Border Colour and Background
Using columnspan.html in Notepad++, add the code in bold to change the colour of the cell
borders and the table background.
<html>

<head>
<title>HTML Table Background</title>
</head>

<body>
<table border = "1" bordercolor = "red" bgcolor = "yellow">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
<tr>
<td rowspan = "2">Row 1 Cell 1</td>
<td>Row 1 Cell 2</td>
<td>Row 1 Cell 3</td>
</tr>
<tr>
<td>Row 2 Cell 2</td>
<td>Row 2 Cell 3</td>
</tr>
<tr>
<td colspan = "3">Row 3 Cell 1</td>
</tr>
</table>
</body>

</html>
Save the document as background.html in LU 5 of the Learner Files folder.
Open background.html in a web browser to see that the table's background is yellow, and all the
borders are red.

Page 22 Learning Unit 5 HTML


ACTIVITY 6
Change the Width and Height Attributes
Open tables.html from ACTIVITY 1 in Notepad++ and add the code in bold to change the width
and height of the table.
<html>

<head>
<title>HTML Table Width/Height</title>
</head>

<body>
<table border = "1" width = "400" height = "150">
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>

<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
</body>

</html>
Save the document as tablesize.html in LU 5 of the Learner Files folder.
Open tablesize.html in a web browser and check that the table's width and height has increased
although the size of the text has remained the same.

NOTE: Changing the width or height of the table does not increase the size of the text in the table.

Learning Unit 5 HTML Page 23


ACTIVITY 7
Add a Caption to a Table
Using tablesize.html in Notepad++, add the code in bold to add a caption to the table and set the
width of the table to 60% of the browser window.
<html>

<head>
<title>HTML Table Caption</title>
</head>

<body>
<table border = "1" width = "60%">
<caption>This is the caption</caption>
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>

<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
</body>

</html>
Save the document as captions.html in LU 5 of the Learner Files folder.
Open captions.html in a web browser to see that the table has a caption and is 60% of the web
browser window.

Click the Minimise button (Google Chrome) or Restore Down button (Windows Edge) in the top
left hand corner of the browser window to reduce the size of the window.
Check that the table automatically adjust to 60% of the smaller window.
Centre the Table
Add the code in bold to centre the table in the browser window:
<html>

<head>
<title>HTML Table Caption</title>
</head>

<body>
<table border = "1" width = "60%" align="center">

<caption>This is the caption</caption>

Page 24 Learning Unit 5 HTML


<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>

<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
</body>

</html>
Save the document and then open it in a web browser to check that the table has been centred.

CHECK POINT 1

1. Explain the difference between cell spacing and cell padding.


2. What is the purpose of cell spacing and cell padding?
3. Is it possible to have a table with the outside border thicker than the cell borders?
4. Can you use the \ character in a HTML title since the \ character cannot be used in file names? For
example, <title>HTML Table Colspan\Rowspan</title>
5. Explain the difference between the <caption> <\caption> and <th> <\th> HTML tags.
6. A website was designed using the following code:
<html>
<head>
<title>Web Design</title>
</head>
<body>
<h1>< font style="Arial">Designing Websites></font>
<p> How to code a webpage using HTML</p>
</body>
<html>

There are errors in the code, since the web page displays as follows:

Learning Unit 5 HTML Page 25


The designer wanted the code to display:

6.1. Suggest a change to the code so that all the text in the body section will display in Arial font.
6.2. Suggest a change to the code so that the text “How to code a webpage using HTML” will NOT
appear formatted as a heading.
6.3. Where will the text “Web Design” appear when the page is displayed in a browser?
7. A website was designed using the following code:
<table border=“10”>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
<tr>
<td>Cell 3</td>
<tr>
</table>

Displays the following table in the browser:

8.
8.1. How would you correct the highlighted (bold) line (the third line of code)
so that the table will be displayed as shown alongside?

8.2. Suggest a change in code so that the table has a border colour of blue and a background
colour of yellow.

Page 26 Learning Unit 5 HTML


EXERCISE 1

1. You have been asked to create a webpage for your school website that lists the public holidays in
South Africa in a table. In Notepad++, create a new webpage.
2. Save the webpage with the name sapublicholidays.html in LU 5 of the Learner Files folder.
3. Create a heading "South African Public Holidays" in the table as follows:
3.1. Heading level 1.
3.2. Text colour red.
3.3. Text centred.
4. Add the following rows table in the body of the page:

Public holidays in South Africa (2021)


1 January New Year’s Day
21 March Human Rights Day
22 March Public holiday **
2 April Good Friday *
5 April Family Day *
27 April Freedom Day
1 May Workers' Day
16 June Youth Day
9 August National Women’s Day
24 September Heritage Day
16 December Day of Reconciliation
25 December Christmas Day
26 December Day of Goodwill
27 December Public holiday **
* The dates on which Good Friday and Easter Sunday fall are determined according to the
ecclesiastical moon. These vary each year but they fall at some point between late March
and late April.
**The Public Holidays Act (Act No 36 of 1994 [PDF]) determines whenever any public
holiday falls on a Sunday, the Monday following on it shall be a public holiday.

The updated list of public holidays for the current year can be found on the following webpage:
https://www.gov.za/about-sa/public-holidays
5. Format the table as follows:
5.1. Table width must be 70% of the webpage.
5.2. Table borders must be set to 2.
5.3. Table cell spacing must be set to 3.
5.4. Table cell padding must be set to 3.
6. Save and close the webpage in LU 5 of the Learner Files folder.
7. Open sapublicholidays.html in a web browser to see that webpage is coded correctly.

Learning Unit 5 HTML Page 27


EXERCISE 2

1. You have been asked to create a page to advertise the WildEarth live safaris. In Notepad++,
create a new webpage.
2. Save the webpage with the filename mywildearth.html in LU 5 of the Learner Files folder.
2. Add a title to the page to read “WildEarth LIVE”.
3. Modify the background colour of the page to be “#e1d4b3”.
4. Add an image to the website as follows:
4.1. Add the image logo.png to the top of the page.
4.2. Set the image to hyperlink to: https://wildearth.tv/live-safaris/
5. Add the following rows to the table in the body of the page:
Monday to Sunday
LIVE Safaris Sunrise Safari Central African Time (CAT) 05:30am – 09:00am
Sunset Safari Central African Time (CAT) 15:30pm – 19:00pm

6. Save and close the webpage in LU 5 of the Learner Files folder.


7. Open mywildearth.html in a web browser to see that webpage is coded correctly.

Page 28 Learning Unit 5 HTML


EXERCISE 3

1. A web page has been created to provide facts about the most endangered turtle species, the
threats faced by them and the ways to save the turtles. In Notepad++, open the incomplete
save_us.html webpage, in LU 5 of the Learner Files folder. Question numbers are inserted as
comments in the coding as guidelines to show approximately where the answer(s) should be
inserted.
2. Add HTML code so that the text "Save Sea Turtles" appears in the browser tab.
3. Change the size of the horizontal lines that comes within the heading “7 Things You Can Do To Save
Sea Turtles” to 6.
4. Insert the image baby_turtle.jpg after the heading “7 Things You…” so that the width and the height
of the image is 100 and 45 percent and the text “Baby Turtle” to display if the image does not
display in the browser.
5. Change the word “SEVEN” in the first paragraph to bold.
6. Change the unordered list displayed after the first paragraph to a square pattern bullet.
7. Insert a caption at the end of the table displayed in the webpage so that it displays “Table 1: List Of
Endangered Turtle Species”.
8. Change the heading “Most Endangered…” so that it becomes the heading for the whole table.
9. Make the following changes to the second row of the table containing the headings “Turtle Name”
and “Scientific name” so that:
9.1. The row colour is green.
9.2. The font colour is white for both the headings.
10. Correct the hyperlink tag created to the word “SEETurtles.org” found in the last paragraph so that it
links to the “www.SEETURTLES.ORG” website.
11. Save and close the webpage in LU 5 of the Learner Files folder.
12. Open save_us.html in a web browser to see that webpage is coded correctly.

Learning Unit 5 HTML Page 29


EXERCISE 4

1. A website was created for a quiz for Computer Applications Technology. In Notepad++, open the
incomplete quiz.html webpage, in LU 5 of the Learner Files folder. Question numbers are inserted
as comments in the coding as guidelines to show approximately where the answer(s) should be
inserted.
2. Change the font of the heading “Computer Applications Technology Quiz” to Forte AND the font size
to 10 pt.
3. Change the top row of the table which contains the text “Quiz for Computer Applications Technology”
as follows:
3.1. Merge the cells over the four columns.
3.2. Vertically align the data to the top of the cell.
4. Change the shading of the column headings in the second row to white.
5. Change the bullets of the answers to the first question, “1. Which ONE of the following…”, to
numbering in the format A, B and C.
6. The tag <input type="text"> is used to provide a space to enter data. A space to enter
answers is provided for every question, except the first question. Enter the tags to provide a space
to enter the answer to the first question.

Page 30 Learning Unit 5 HTML


7. Insert a hyperlink on the word “Look” in the third row and fourth column to link to the Storage image
in the in LU 5 of the Learner Files folder.
8. Modify the HTML code for the second question, “2. A process whereby one can speed up…”, to appear
in the same format as all the other questions.
9. Correct the tags for the image in the fourth column of the fourth question, “4. Which ONE of the
following refers to software…”, to display correctly.
10. Even though all the elements for the sixth question have been added to the HTML file, they do not
display in the browser. Add the necessary tags to display the sixth question correctly.
11. Find the CAT image at the bottom of the web page. Set the height of the image to 55 and width of
the image to 60.
12. Save and close the webpage in LU 5 of the Learner Files folder.
13. Open quiz.html in a web browser to see that webpage is coded correctly.

Learning Unit 5 HTML Page 31


Learning Unit 8 Database
Normalisation
8.1 Database Terminology
In database theory, a relational database consists of many tables, a table consists of many records
and a record consists of many fields; where a field stores a single data item. A relation is another word
for a table and table definitions are often written as a list of field's names in what is called relational
notation. The primary key is normally underlined.
For a Student table, with fields to store the StudentID, Name, Class and House, as shown below, the
relation is written as follows:
Student (StudentID, Name, Class, House)
The primary key field StudentID is underlined. This method will be used to represent tables in this
Learning Unit. The table Student is shown below with data.

StudentID Name Class House


1 Rachael B Blue
2 Samuel C Red
3 Thabo C Red
4 Jermaine B Blue
5 Susanna A Blue
6 Jason B Red
7 Nelson C Blue
8 Thabo A Red
9 Sipho A Red

8.2 Relational Database Design


In most business situations in which databases are used, the databases consist of many tables that
contain data that is related in some way. These databases are called relational databases and are
managed by the Database Management Systems (DBMS).
In general, a database consists of many tables. As a rule, each table should store the information about
a single subject. In the Student table, the table stores information about students, classes and houses.
These should all be separate tables linked through primary and foreign keys (a primary key in another
table). The process of designing a database with separate tables is called normalisation.
An important part of database design is the use of primary keys.

8.3 More About Keys


A primary key field is a field in a table that uniquely identifies each record in the table. This means that
no data values in the primary key field(s) are repeated. One way to make a primary key is to add an
extra auto-numbered field to make each record unique. Fields can also be combined to create a

Page 32 Learning Unit 8 Database Normalisation


combination of values that will produce a unique key. Before primary keys can be discussed in more
detail, different types and combinations of keys need to be identified that can uniquely identify a record.
The naming convention for primary keys is to use the table name (e.g., Student) followed by ID to
indicate that it is a key field which uniquely identifies each record in the table. So, the primary key of the
Student table is named StudentID.

8.3.1 Primary Keys


A primary key uniquely identifies a record, possible primary keys for the Student relation are:
(StudentID)
(IDNumber)
A table in a database can have more than one possible primary keys. Both StudentID and the South
African IDNumber are both possible primary keys. Schools often use a StudentID since it is shorter than
an IDNumber making it easier to type in.

8.3.2 Composite/Compound/Concatenated Keys


A composite key is the combination of two or more fields to form a primary key. For example (StudentID,
IDNum) and (StudentID, IDNum, Name) are composite keys.
Books (Author, Title, Pages, Cost)
In the absence of an ISBN number the combination of Author and Title could serve as a primary key for
a Books relation. This assumes that no author writes two or more books with the same title.
It is better to use a combination of keys for a primary key than to choose a new key field.

8.3.3 Choosing a Primary Key for a Table


Example 1
A business teaches people how to parallel park their cars. A specific rate (CarRate) is charged
depending on how difficult it is to park the car that the client drives. The Tank is most difficult to park with
a rating of 10 and the VW Beetle is the easiest with a rating of 0.8.
Each client has a ClientID, but some clients have more than one car (John Doe and Nazim Du Plooy).
Furthermore, some clients drive the same car as other clients (John Doe drives the same car as Lia
Mkhizi). Details about the client, the client's car and the rate that will be charged are stored in one table
called ParkCars. A primary key needs to be chosen for the table.

ClientID First Name Surname Email CarName CarRate


85 John Doe [email protected] Toyota Fortuna 1
86 Nazim Du Plooy [email protected] Ford GT 1.2
86 Nazim Du Plooy [email protected] VW Beetle 0.8
87 Lia Mkhizi [email protected] Toyota Fortuna 1
88 Sally Hamilton [email protected] VW Beetle 0.8
85 John Doe [email protected] Tank 10
89 Fred Jones [email protected] Kia Picanto 0.2

ClientID cannot be a primary key as 86 and 85 are duplicated in the table. The combination of ClientID
and CarName would be unique as there are no duplicates.

Learning Unit 8 Database Normalisation Page 33


ClientID CarName
85 Toyota Fortuna
86 Ford GT
86 VW Beetle
87 Toyota Fortuna
88 VW Beetle
85 Tank
89 Kia Picanto

Whenever a primary key is chosen, assumptions are made. In this case it is assumed that no person has
the two cars of the same type. This is not a good assumption, since John Doe could collect cars and
specialise in collecting tanks. If John Doe bought another tank, this tank could not be added to the
database and John Doe could not be taught how to park his new tank.
A solution could be to add a numeric ID field for the cars.

ClientID First Name Surname Email CarID CarName CarRate


85 John Doe [email protected] 100 Toyota Fortuna 1
86 Nazim Du Plooy [email protected] 101 Ford GT 1.2
86 Nazim Du Plooy [email protected] 102 VW Beetle 0.8
87 Lia Mkhizi [email protected] 100 Toyota Fortuna 1
88 Sally Hamilton [email protected] 102 VW Beetle 0.8
85 John Doe [email protected] 103 Tank 10
85 John Doe [email protected] 104 Another Tank 11
89 Fred Jones [email protected] 105 Kia Picanto 0.2

A suitable primary key for this table could be the combination of ClientID and CarID.
The table could be written as the relation:
ParkCars (ClientID, First Name, Surname, Email, CarID, CarName, CarRate)
Example 2
The simplified details of a company's employees are stored in a table. Employees are allocated to
different departments, but some employees work in more than one department (Shuraya works in both
marketing and sales). Each department is in a different room and the room number of the department is
stored in the table called EmployeeDepts.

Page 34 Learning Unit 8 Database Normalisation


A primary key needs to be chosen for the table.

Employee Age Room No Department


Shuraya 32 1 Marketing
Shuraya 32 2 Sales
Fazul 45 3 Quality Assurance
Bongani 36 4 Human Resource
Fred 41 2 Sales
Gemima 23 1 Marketing
Mpumi 33 3 Quality Assurance
Katleho 27 4 Human Resources
Bongani 36 2 Sales

A combination of fields needs to be chosen that will uniquely identify a row (record) in the table. In this
case, Employee and Room No will create a unique primary key.
By choosing this key, it is assumed that no two people have the same surname and that only one
department can be in a room. What if there were people with the same surname and what if two
departments shared a room?
An EmployeeID field could be added to uniquely identify employees combined with the Department
name to create a concatenated key. This is assuming that departments do not change their names.

EmployeeID Employee Age Room No Department


1 Shuraya 32 1 Marketing
1 Shuraya 32 2 Sales
2 Fazul 45 3 Quality Assurance
3 Bongani 36 4 Human Resource
4 Fred 41 2 Sales
5 Gemima 23 1 Marketing
6 Mpumi 33 3 Quality Assurance
7 Katleho 27 4 Human Resources
3 Bongani 36 2 Sales

The table could be written as the relation:


EmployeeDepts(EmployeeID, Employee, Age, Room No, Department)

EXERCISE 1

1. What is a relation and how can it be represented?


2. A clothing store records the purchases made by customers and the items were bought in a table
called Purchases:
CustomerID CustomerName ItemID Item DateOfPurchase Quantity
1 Fred Blogs 200 T Shirt 11/12/02020 3
1 Fred Blogs 223 Jeans 24/12/2020 1
2 Jane Doe 200 T Shirt 12/12/2020 2

Learning Unit 8 Database Normalisation Page 35


2 Jane Doe 297 Dress 12/12/2020 1

2.1. Is it possible that a person can buy the same items on a different day?
2.2. If the store stocked red and blue T Shirts, would the table need to be changed?
2.3. Choose a concatenated primary key for this table.
2.4. What assumptions are made by choosing this key?
3. A medical centre records appointments made by patients with the resident dentists in a table called
Appointments. Each dentist has a unique DentistID and each patient has a unique PatientID.
One dentist can have appointments with many patients, and a patient can see more than one
dentist. The medical centre has 3 rooms for dental procedures.

DentistID Dentist Name PatientID PatientName ApointmentDateTime Room No


D101 Shirley Nel P100 Ronel Peter 17/08/2020 10:00 1
D102 Thabo Muller P101 Tracey Davids 17/08/2020 10:00 2
D103 Desiree Mohammed P102 Darren Greef 17/08/2020 11:00 1
D104 Alicia Ndlovu P102 Darren Greef 18/08/2020 9:00 3
D102 Thabo Muller P100 Ronel Peter 18/08/2020 9:00 2
D103 Mark Mather P104 Lebogang Jacobs 18/08/2020 9:00 1
D104 Zandile Nair P101 Tracey Davids 19/08/2020 14:00 1
D104 Alicia Ndlovu P105 Neo Ally 20/08/2020 15:00 2
D102 Thabo Muller P101 Tracey Davids 20/08/2020 9:00 2

3.1. Is it possible for a dentist to see the same patient on a different day?
3.2. Why is the combination of DentistID and PatientID not a suitable primary key?
3.3. What field can be added to DentistID and PatientID to create a primary key?
3.4. What assumptions are made by choosing this primary key?

8.4 Derived Data


Derived data is when a fields can be calculated, like deriving a person's age from their date of birth; or
determining the person's average from a set of marks. As a rule, derived data is not stored. Derived data
can be calculated using a query in MS Access.
Example 3
In the EmployeeDepts table, each employee's age is stored. If a person has a birthday, then their age
must be updated. This could be extremely time consuming if the table stored thousands of employees.
There is a high possibility that the ages are not all updated correctly leading to a database with incorrect
data.
The problem can be solved by storing the employee's date of birth instead of their age. This value would
never change, and if an employee's age were needed, a query could be created to determine the age
using the current date.

Page 36 Learning Unit 8 Database Normalisation


EmployeeID Employee Date of Birth Room No Department
1 Shuraya 1997/04/02 1 Marketing
1 Shuraya 1999/12/03 2 Sales
2 Fazul 1990/10/18 3 Quality Assurance
3 Bongani 1999/12/03 4 Human Resource
4 Fred 2000/01/01 2 Sales
5 Gemima 1980/09/29 1 Marketing
6 Mpumi 1985/11/26 3 Quality Assurance
7 Katleho 1998/05/30 4 Human Resources
3 Bongani 1999/12/03 2 Sales

The relation will become:


EmployeeDepts(EmployeeID, Employee, Date of Birth, Room No, Department)
Example 4
A car wash business has many customers who regularly come to the car wash. Each customer is
charged a rate according to the type of wash they require (full wash, wash and wax, outside only etc.).
Customers that are pensioners receive a 5% discount and customers whose cars belong to a business
receive 10% discount.
The Discounted Cost field is derived by reducing the Cost field using the value in the Discount field.
The Discounted Cost can be calculated using a query.

CustomerID CustomerName Customer Cost Discount Discounted


Type Cost
400 Pearl Masango Private 50.00 50.00
401 Funworks Business 75.00 10 67.50
402 Fikele Shezi Pensioner 60.00 5 57.00
403 Marco Thwala Private 75.00 75.00
404 Roy Pienaar Pensioner 50.00 5 45.00
405 Sharon Molepo Private 75.00 75.00
406 Laura Nkuna Inc Business 60.00 10 54.00
407 Diane Blignaut Private 50.00 50.00

The relation will become:


CarWash(CustomerID, CustomerName, Customer Type, Discount)

8.5 Non-Atomic Data


Each value of a field should store a single data item and should not be combined. For example, storing a
person's name and surname as a single field would be non-atomic data. The name should be split up
into two separate fields: one for the first name and one for the surname. A second common example is
storing an address as a single field. It should be divided into fields for the street name and number, the
suburb, town and postal code. Often the field names are address line 1, address line 2, address line 3,
town and postal code.

Learning Unit 8 Database Normalisation Page 37


Example 5
In the Appointments table, the dentist's name and patient's name can be split into separate fields for
first name and surname. The AppointmentDateTime field should not be split since date and time are
linked. If the date and time were stored as separate fields then they will always need to be combined to
view a patient's appointment.

DentistID Dentist Dentist PatientID Patient Patient Appointment Room


First Surname First Surname DateTime No
Name Name
D101 Shirley Nel P100 Ronel Peter 17/08/2020 10:00 1
D102 Thabo Muller P101 Tracey Davids 17/08/2020 10:00 2
D103 Desiree Mohammed P102 Darren Greef 17/08/2020 11:00 1
D104 Alicia Ndlovu P102 Darren Greef 18/08/2020 9:00 3
D102 Thabo Muller P100 Ronel Peter 18/08/2020 9:00 2
D103 Mark Mather P104 Lebogang Jacobs 18/08/2020 9:00 1
D104 Zandile Nair P101 Tracey Davids 19/08/2020 14:00 1
D104 Alicia Ndlovu P105 Neo Ally 20/08/2020 15:00 2
D102 Thabo Muller P101 Tracey Davids 20/08/2020 9:00 2

The relation will become:


Appointments(DentistID, Dentist First Name, Dentist Surname, PatientID, Patient First Name, Patient
Surname, AppointmentDateTime, Room No)
Example 6
The ParkCars table includes a filed called CarName which is a combination of a Make and Model of a
car. The field can be split into two fields.

ClientID First Surname Email CarID Make Model CarRate


Name
85 John Doe [email protected] 100 Toyota Fortuna 1
86 Nazim Du Plooy [email protected] 101 Ford GT 1.2
86 Nazim Du Plooy [email protected] 102 VW Beetle 0.8
87 Lia Mkhizi [email protected] 100 Toyota Fortuna 1
88 Sally Hamilton [email protected] 102 VW Beetle 0.8
85 John Doe [email protected] 103 Tank 10
85 John Doe [email protected] 104 Tank Another 11
89 Fred Jones [email protected] 105 Kia Picanto 0.2

The relation will become:


ParkCars(ClientID, First Name, Surname, Email, CarID, Make, Model, CarRate)

Page 38 Learning Unit 8 Database Normalisation


EXERCISE 2

Study the table called StudentMarks which stores a student's name, address, register class, theory and
practical mark for CAT and their overall CAT result which is the average of the theory and practical
marks.

Student Name Address Register CAT CAT CAT


Class Theory Practical Overall
Vusi Hughes 23 Freedom Ave, Boksburg 12A 78 79 78.5
Riaan Modise 95 5th St, Houghton, Johannesburg 12B 75 83 7985.5
Lorraine Sithole 16 Gray Place, Durban 12A 82 89 85.5
Kelly Loubser 59175 Kozy Lghts, Capricorn District 12B 91 96 93.5
Carel Solomons 42183 Lucius Mission, Xhariep District 12A 88 92 90

1. Identify fields with non-atomic data.


2. Identify the derived field.
3. How would you correct this table?
4. Select an appropriate primary key for this table.
5. Write the corrected table in relational notation.

8.6 Repeating Groups


Database design is the process of representing a problem in the real world as a set of tables. It would be
great if data could be arbitrarily placed into one or more tables and then queries can be run to access
and change the data in the database. Unfortunately, it is not so simple. A badly designed database could
produce anomalies and some very complicated queries to access and update the data.
Normalisation avoids these very bad things:
1. Repeating Groups
2. Data redundancy
3. Anomalies

• Update
• Insertion
• Deletion
4. Complex queries

8.6.1 Repeating Groups – Type 1


In a school where each student can do more than one sport, a repeating group is produced if the
information is stored in one table with one field for sport. To determine if Patience does Hockey, a query
is needed to extract the word "Hockey" from the Sports field. The students will be stored in a table called
tblStudents.

Learning Unit 8 Database Normalisation Page 39


Name Grade Sports
Roger Philips 10 Cricket
Patience Mbata 10 Netball, Hockey
Hennie Venter 12 Hockey, Rugby, Golf
Sarah Cohen 11 Golf

Extracting "Hockey" may not seem to complex, but what if Patience decides to take up Cricket instead
of Hockey?
The Sport field is also problematic since it is non-atomic. The solution for non-atomic fields is to split the
filed into separate fields.

8.6.2 Repeating Groups – Type 2


If the Sport field were split into a separate fields: Sport1, Sport2, Sport3 then each field would have a
single value which would solve the above problem. However, to find out if Patience did Hockey, the fields
Sport1, Sport2 and Sport3 would need to be checked. What if there was a possibility of doing 100
sports?

Name Grade Sport1 Sport2 Sport3


Roger Philips 10 Cricket
Patience Mbata 10 Netball Hockey
Hennie Venter 12 Hockey Rugby Golf
Sarah Cohen 11 Golf

8.6.3 Data Redundancy


This problem could be solved by listing each sport that a student does on a separate line and duplicate
their other details. A new primary key would need to be chosen as Name is not unique. The combination
of the Name and Sports fields could create a unique key. This solution produces data redundancy. What
if Hennie Venter did 10 sports?

Name Grade Sports

Roger Philips 10 Cricket

Patience Mbata 10 Netball

Patience Mbata 10 Hockey

Hennie Venter 12 Hockey

Hennie Venter 12 Rugby

Hennie Venter 12 Golf

Sarah Cohen 11 Golf

Simply put, a repeating group is a field that can have multiple values. When repeating groups are
removed, data redundancy is produced. In a normalised database, all fields should have a single value.
The data in a cell cannot store multiple values.

Page 40 Learning Unit 8 Database Normalisation


Summary

• A repeating group occurs when a field contains more than one value.
• Repeating groups produce invalid tables since it infringes on the primary key.
• Inserting multiple values in a cell is not possible
• Expanding the primary key produces data redundancy.

8.7 Anomalies
The ParkCars table will be used to explain anomalies.

ClientID First Surname Email CarID Make Model CarRate


Name
85 John Doe [email protected] 100 Toyota Fortuna 1
86 Nazim Du Plooy [email protected] 101 Ford GT 1.2
86 Nazim Du Plooy [email protected] 102 VW Beetle 0.8
87 Lia Mkhizi [email protected] 100 Toyota Fortuna 1
88 Sally Hamilton [email protected] 102 VW Beetle 0.8
85 John Doe [email protected] 103 Tank 10
85 John Doe [email protected] 104 Tank Another 11
89 Fred Jones [email protected] 105 Kia Picanto 0.2

8.7.1 Update Anomaly


Update anomalies occur when the same data needs to be updated more than one place. For example, if
John Doe change his email address, then it would need to be changed in three places. If it was decided
that Toyota Fortuna is more difficult to park and should have a rating of 1.3, then the change would need
to take place on two places.
Human error could lead to inconsistencies and if the data in a database is inconsistent then they are of
little value.

8.7.2 Deletion Anomaly


Deletion anomalies occur when a deletion causes unnecessary loss of data. For example, if Fred Jones
were removed from the table, the rating for a Kia Picanto would be lost. If Toyota Fortuna was removed
from the table, Liza Mkhizi would be lost, but not John Doe since John Doe has more than one car.

8.7.3 Insertion Anomaly


An insertion anomaly occurs when records are added that do not satisfy the primary key requirements. A
primary key filed cannot have no value. If the primary key is a composite key, the all the fields
contributing to the primary key must have a value. For example, if a Gerald Jackson wanted to learn how
to park a car but does not have a car, he cannot be added to the database. To add a record to the
database, a value is needed for both ClientID and CarID. If concatenated primary key does not have
values for all its fields, the primary key would be violated, and the DBMS will not allow the addition.

8.8 Duplicate Data


Duplicate data is when a record has the same value for a field as another record. This is not to be
confused with redundant data which is produced by repeating groups in first normal form. Duplicate data
is not wrong and must not be removed. An example would be if two students lived in the same road or
were in the same house at school.

Learning Unit 8 Database Normalisation Page 41


In the Appointments table, the Room No is duplicated. Shirley Nel and Desiree Mohammed both use
Room No 1.

EXERCISE 3

1. Using the Appointments table identify the following anomalies:


DentistID Dentist Dentist PatientID Patient Patient Appointment Room
First Surname First Surname DateTime No
Name Name
D101 Shirley Nel P100 Ronel Peter 17/08/2020 10:00 1
D102 Thabo Muller P101 Tracey Davids 17/08/2020 10:00 2
D103 Desiree Mohammed P102 Darren Greef 17/08/2020 11:00 1
D104 Alicia Ndlovu P102 Darren Greef 18/08/2020 9:00 3
D102 Thabo Muller P100 Ronel Peter 18/08/2020 9:00 2
D103 Mark Mather P104 Lebogang Jacobs 18/08/2020 9:00 1
D104 Zandile Nair P101 Tracey Davids 19/08/2020 14:00 1
D104 Alicia Ndlovu P105 Neo Ally 20/08/2020 15:00 2
D102 Thabo Muller P101 Tracey Davids 20/08/2020 9:00 2

1.1. Update
1.2. Delete
1.3. Insert
2. Study the table called RecipeIngredients that stores the ingredients for recipes.
RecipeID Name Ingredients
1 Chocolate Cake Flour, eggs, butter, milk, baking powder, cocoa
2 Chocolate Brownies Flour, eggs, cocoa, margarine
3 Sponge Cake Flour, eggs, butter, milk, baking powder,
4 Crunchies Flour, oats, desiccated coconut, butter, baking soda, water
5 Pancakes Flour, eggs, milk

2.1. Which field stores non-atomic data?


2.2. Explain why Ingredients is a repeating group.
2.3. How can this table be changed to remove the repeating group in a way that produces data
redundancy?
2.4. Choose a suitable primary key for the table.
2.5. Write the solution in relational notation.

CHECK POINT 1

1. Define a primary key.


2. Define a composite key.
3. Give an example of derived data.
4. How can derived data be calculated in Ms Access.
5. Give an example of non-atomic data.
Page 42 Learning Unit 8 Database Normalisation
6. What is the solution to non-atomic data?
7. Give an example of a repeating group.
8. How is redundant data related to a repeating group.
9. Define an update anomaly.
10. Define a delete anomaly.
11. Define an insert anomaly.

8.9 Relationships
In all the previous tables, the data should be stored in more than one table. A single table can be
separated into different subjects or categories which will be called entities. For example, the
Appointments table stores details about Dentists, Patients and Appointments. These tables need to
be linked using primary and foreign keys.

DentistID Dentist Dentist PatientID Patient Patient Appointment Room


First Surname First Surname DateTime No
Name Name
D101 Shirley Nel P100 Ronel Peter 17/08/2020 10:00 1
D102 Thabo Muller P101 Tracey Davids 17/08/2020 10:00 2
D103 Desiree Mohammed P102 Darren Greef 17/08/2020 11:00 1
D104 Alicia Ndlovu P102 Darren Greef 18/08/2020 9:00 3
D102 Thabo Muller P100 Ronel Peter 18/08/2020 9:00 2
D103 Mark Mather P104 Lebogang Jacobs 18/08/2020 9:00 1
D104 Zandile Nair P101 Tracey Davids 19/08/2020 14:00 1
D104 Alicia Ndlovu P105 Neo Ally 20/08/2020 15:00 2
D102 Thabo Muller P101 Tracey Davids 20/08/2020 9:00 2

To work out how to create these links, the relationship between the subjects needs to be identified.
There are three types of relationships: one-to-one (1 : 1), one-to-many (1 : n) and many-to-many (m :
n).

8.9.1 One-to-One (1 : 1)
For example, in the Student table, each student is allocated to a register (home room) class (12A, 12B
or 12C). Each register class has one teacher in charge of the administration of that class. For example,
Ms Kubeka is the register teacher for class 12A. The relationship between the register class (as a whole)
and the teacher is one-to-one. A one-to-one relationship does not present a problem in databases as
there is no repeating data. A one-to-one relationship is indicated graphically by two boxes joined by a
line and with 1's on either side.

1 1
Entity Entity

1 1
Teacher Register
Class
One-to-one relationships are simple to deal with. Both fields are put in the same table. The teacher's
name would be one field and so would the name of their register class be a field in the same table.

Learning Unit 8 Database Normalisation Page 43


8.9.2 One-to-Many (1 : n)
An example of a one-to many (or many-to-one) relationship would be between each house in a school
and its students. One house has many students.
You need to test that the relationship is not many-to-many by trying the statement the other way around.
A student cannot be in many houses, so the relationship is definitely not many-to-many. Another
example of one-to-many is where one class has many students. A one-to-many relationship is indicated
graphically by two entities connected by a line with 1 and n showing the relationship. Note that the n
indicates the many side of the relationship. In MS Access, the many is indicated with an infinity sign (∞).

Entity
1
∞ Entity

House
1
∞ Student

8.9.3 Many-to-Many (m : n)
In a hospital, there are many doctors and many patients. One doctor may see many patients and one
patient may have many doctors. This is a many-to-many relationship. It is shown graphically using two
boxes for the entities and a line joining them. A m and n show the many-to-many relationship. In MS
Access, an ∞ is used in place of m an n.

Entity
∞ ∞ Entity

∞ ∞
Doctor Patient

EXERCISE 4

1. In the ParkCars table:

ClientID First Surname Email CarID Make Model CarRate


Name
85 John Doe [email protected] 100 Toyota Fortuna 1
86 Nazim Du Plooy [email protected] 101 Ford GT 1.2
86 Nazim Du Plooy [email protected] 102 VW Beetle 0.8
87 Lia Mkhizi [email protected] 100 Toyota Fortuna 1
88 Sally Hamilton [email protected] 102 VW Beetle 0.8
85 John Doe [email protected] 103 Tank 10
85 John Doe [email protected] 104 Tank Another 11
89 Fred Jones [email protected] 105 Kia Picanto 0.2

1.1. What is the relationship between Cars and Clients?


1.2. What is the relationship between the type of car and the CarRate?
2. In the CarWash table:
Page 44 Learning Unit 8 Database Normalisation
CustomerID CustomerName Customer Cost Discount Discounted
Type Cost
400 Pearl Masango Private 50.00 50.00
401 Funworks Business 75.00 10 67.50
402 Fikele Shezi Pensioner 60.00 5 57.00
403 Marco Thwala Private 75.00 75.00
404 Roy Pienaar Pensioner 50.00 5 45.00
405 Sharon Molepo Private 75.00 75.00
406 Laura Nkuna Inc Business 60.00 10 54.00
407 Diane Blignaut Private 50.00 50.00

2.1. What is the relationship between CustomerType and CustomerName?


3. In the EmployeeDepts table:

EmployeeID Employee Date of Birth Room No Department


1 Shuraya 1997/04/02 1 Marketing
1 Shuraya 1999/12/03 2 Sales
2 Fazul 1990/10/18 3 Quality Assurance
3 Bongani 1999/12/03 4 Human Resource
4 Fred 2000/01/01 2 Sales
5 Gemima 1980/09/29 1 Marketing
6 Mpumi 1985/11/26 3 Quality Assurance
7 Katleho 1998/05/30 4 Human Resources
3 Bongani 1999/12/03 2 Sales

3.1. What is the relationship between Employees and Departments?


3.2. If departments shared a room, what would the relationship be between Departments and
Rooms?
3.3. Why is Department atomic data even though "Quality Assurance" and "Human
Resources" are two words.

ACTIVITY 1
Give two other examples of many-to many relationships.

Learning Unit 8 Database Normalisation Page 45


8.10 Examples of Normalisation
8.10.1 Example 1: Car Repairs
8.10.1.1 Identify Different Tables
Each table should represent an entity or a subject. A company makes repairs to vehicles. There are two
entities, the car and the repair. Place all the information related to the car in one table and all the
information about the repair in another table.
Car (RegNo, Make, Model)
Repair (Date, Description, Cost)

8.10.1.2 Give Each Table a Primary Key


The registration number can serve as a primary key for the Car table, but the Repair table also needs a
primary key. A combined key using Date, Description and Cost field could not be used because that
would assume that no two repairs on the same day can cost the same. For this reason, a single key
called RepairID can be added.
Car (RegNo, Make, Model)
Repairs (RepairID, Date, Description, Cost)

8.10.1.3 Analyse the Relationships Between the Tables


There is a one-to-many relationship between the tables since one car can have many repairs. Test that it
is not a many-to-many relationship by checking that one repair cannot have many cars.

Car
1 ∞ Repairs

8.10.1.4 Link the Tables Using the Primary and Foreign keys
The rule is that the table on the many side gets the primary key of the table on the one side of the
relationship. The primary key that is added becomes the foreign key in the many table. In this set of
relations, the primary keys have a double underline, and the foreign key has a single underline.
So, the Repairs table must get the RegNo field of the Car table.
Car (RegNo, Make, Model)
Repairs (RepairID, Date, Description, Cost, RegNo)
The tables would appear as:
Car

RegNo Make Model

A123 ABC Ford Fiesta

XYZ 123 GP Mazda CX 5

123456 VW Beetle

Page 46 Learning Unit 8 Database Normalisation


Repairs

RepairID RepairDate Description Cost RegNo

1 1/1/2020 Panel beat door R1400.00 A123 ABC

2 1/7/2020 Replace bumper R2650.00 A123 ABC

3 3/7/2021 Fix dents R3200.00 XYZ 123 GP

4 5/8/2021 Replace windscreen R1700.00 123456

EXERCISE 5
Using the above tables, linked by RegNo field answer the questions:
1. What repairs were made to the Mazda CX 5?
2. Which car had the windscreen replaced?
3. How many repairs did the Ford Fiesta have?
4. In this database design, could a car have two different repairs on the same day?

8.10.2 Example 2: Playlists


8.10.2.1 Identify the Tables
A user wishes to store the details of each song in a playlist. A playlist consists of the name of the playlist
and the "occasion" or "type" of playlist (party, laid back, new songs, favourite songs). Each playlist would
have many songs. Assuming that no song can be in more than one playlist, there would be two entities:
playlists and songs.
For a playlist, the name of the list and the type could be stored, and for each song the title of the song
and the artist who sang the song could be stored.
PlayList (PlayListName, Type)
Songs (SongTitle, ArtistName)
It is a good idea to name the fields as artistName and playListName instead of using name for the
name of the artist and the name of a playlist.

8.10.2.2 Give Each Table a Primary Key


PlayList (PlayListID, PlayListName, Type)
Songs (SongID, SongTitle, ArtistName)

8.10.2.3 Analyse the Relationship Between the Tables


One playlist can have many songs. (It is assumed that the same song does not appear on two different
playlists).

PlayList
1 ∞ Songs

Learning Unit 8 Database Normalisation Page 47


8.10.2.4 Link the Tables Using the Primary and Foreign Keys
The primary key from the one side of the relationship (PlayListID) becomes a foreign key in the table on
the many side of the relationship (Songs).
PlayList (PlayListID, PlayListName, Type)
Songs (SongID, SongTitle, ArtistName, PlayListID)

8.10.3 Example 3: Recipe database


In the following table, the recipes are stored together with all their ingredients.

RecipeID Name Ingredients


1 Chocolate Cake Flour, eggs, butter, milk, baking powder, cocoa
2 Chocolate Brownies Flour, eggs, cocoa, margarine
3 Sponge Cake Flour, eggs, butter, milk, baking powder,
4 Crunchies Flour, oats, desiccated coconut, butter, baking soda, water
5 Pancakes Flour, eggs, milk

There is a many-to-many relationship between the recipes and the ingredients. One recipe can have
many ingredients and one ingredient can be in many recipes.

Recipe
∞ ∞ Ingredient

8.10.3.1 Identify the Tables


The recipes and ingredients must be two separate tables.

8.10.3.2 Give Each Table a Primary Key


Start by creating the relations Recipe and Ingredient:
Recipe (RecipeID, RecipeName)
Ingredient (IngredientID, IngredientName)

8.10.3.3 Analyse the Relationship Between the Tables


Many-to-many relationships must be changed to one-to-many relationships. This can be done be
introducing a third table. This table will be called RecipeIngredient indicating it is a solution to a many-
to-many relationship between the tables Recipe and Ingredient. The extra table can be thought of as a
link table in a many-to-many relationship.
The relationship between the original table and the new table is now one-to-many. The new table
consists of the primary keys of both tables forming a composite key.

Recipe 1 1 Ingredient

∞ RecipeIngredient ∞

8.10.3.4 Link the Tables Using the Primary and Foreign Keys

Page 48 Learning Unit 8 Database Normalisation


The new table gets the primary keys of both the original tables:
Recipe (RecipeID, RecipeName)
Ingredient (IngredientID, IngredientName)
RecipeIngredient (RecipeID, IngredientID)
The name of the new table takes on the combined names of previous table, so you know it stores a
many-to-many relationship. The keys in the RecipeIngredient table are joined to form a composite key.
The tables populated with data would become:

Recipe RecipeIngredient
RecipeID RecipeName RecipeID IngredientID
1 Chocolate Cake 1 1
2 Chocolate Brownies 1 2
3 Sponge Cake 1 3
4 Crunchies 1 4
5 Pancakes 1 5
1 6
Ingredient 2 1
IngredientID IngredientName 2 2
1 Flour 2 6
2 Eggs 2 7
3 Butter 3 1
4 Milk 3 2
5 Baking Powder 3 3
6 Cocoa 3 4
7 Margarine 3 5
8 Desiccated Coconut 4 1
9 Baking Soda 4 11
10 Water 4 8
11 Oats 4 3
4 9
4 10
5 1
5 2
5 4

The link table RecipeIngredient has multiple records for each recipe. Chocolate cake (RecipeID 1) has
6 ingredients, hence there are 6 records in the RecipeIngredient table for chocolate cake. Milk
(IngredientID 4) is used in chocolate cake (RecipeID 1), sponge cake (RecipeID 3) and pancakes
(RecipeID 5). There are 3 records in the RecipeIngredient table for each recipe that has milk as an
ingredient.
The combined keys of RecipeID and IngredientID form a unique key in the RecipeIngredient table.
Each recipe is linked to all its ingredients and vice versa.

Learning Unit 8 Database Normalisation Page 49


EXERCISE 6

Use the Recipe database to answer the questions:


1. What are the ingredients for a chocolate cake?
2. List the recipes that have butter as an ingredient?
3. How many recipes have flour as an ingredient?
4. Is it possible to have two records with the values 1 for RecipeID and 1 for IngredientID in the
RecipeIngredient table?

8.10.4 Example 4: Back to the Playlists


In the playlist example, it was assumed that one song cannot be on two playlists which is simply not true.
Therefore, the relationship between PlayList and Songs is many-to-many.

PlayList
∞ ∞ Songs

To solve this problem, introduce a new table and copy the primary keys from each of the tables into the
third table. Remove the PlayListID field from the Songs table since the relationship is no longer one-to-
many. Create a third table called PlayListSongs with the primary keys of both tables.
PlayList (PlayListID, PlayListName, Type)
Songs (SongID, SongTitle, ArtistName)
PlayListSongs (PlayListID, SongID)
The primary key of the PlayListSongs table will be a concatenation of PlayListID and SongID.

8.10.5 Example 5: Appointments


DentistID Dentist Dentist PatientID Patient Patient Appointment Room
First Surname First Surname DateTime No
Name Name
D101 Shirley Nel P100 Ronel Peter 17/08/2020 10:00 1
D102 Thabo Muller P101 Tracey Davids 17/08/2020 10:00 2
D103 Desiree Mohammed P102 Darren Greef 17/08/2020 11:00 1
D104 Alicia Ndlovu P102 Darren Greef 18/08/2020 9:00 3
D102 Thabo Muller P100 Ronel Peter 18/08/2020 9:00 2
D103 Mark Mather P104 Lebogang Jacobs 18/08/2020 9:00 1
D104 Zandile Nair P101 Tracey Davids 19/08/2020 14:00 1
D104 Alicia Ndlovu P105 Neo Ally 20/08/2020 15:00 2
D102 Thabo Muller P101 Tracey Davids 20/08/2020 9:00 2

In the Appointments table, there are three entities, Dentists, Patients and Appointments.
The relationships between the entities are:

• Dentist to Patients is many-to-many. (One Dentist has many Patients and one Patients can have
many Dentists)
Page 50 Learning Unit 8 Database Normalisation
• Dentist to Appointments is one-to-many. (One Dentist can have many Appointments)
• Patient to Appointments in one-to-many. (One Patient can have many Appointments)
The three tables can be created:
Dentist (DentistID, Dentist First Name, Dentist Surname)
Patient (PatientID, Patient First Name, Patient Surname)
Appointment (AppointmentDateTime, Room No)
An extra table needs to be created for the many-to-many relationship between Dentist and Patients with
a combination of both primary keys.
DentistPatient (DentistID, PatientID)
For the one-to-many Dentist to Appointments relationship, the Appointment table gets the primary key
(DentistID) of the Dentist table. Similarly, the Appointments table gets the primary key (PatientID) of the
Patient table.
The relations become:
Dentist (DentistID, Dentist First Name, Dentist Surname)
Patient (PatientID, Patient First Name, Patient Surname)
Appointment (AppointmentDateTime, Room No, DentistID, PatientID)

Dentist Patient
DentistID Dentist Dentist PatientID Patient Patient
First Surname First Name Surname
Name
D101 Shirley Nel P100 Ronel Peter
D102 Thabo Muller P101 Tracey Davids
D103 Desiree Mohammed P102 Darren Greef
D104 Alicia Ndlovu P104 Lebogang Jacobs
P105 Neo Ally

Appointment
ApointmentDateTime Room No DentistID PatientID
17/08/2020 10:00 1 D101 P100
17/08/2020 10:00 2 D102 P101
17/08/2020 11:00 1 D103 P102
18/08/2020 9:00 3 D104 P102
18/08/2020 9:00 2 D102 P100
18/08/2020 9:00 1 D103 P104
19/08/2020 14:00 1 D104 P101
20/08/2020 15:00 2 D104 P105
20/08/2020 9:00 2 D102 P101

EXERCISE 7

Learning Unit 8 Database Normalisation Page 51


Answer the questions related to Appointments database.
1. Who are Thabo Muller's patients?
2. Which dentists have Tracey Davids as a patient?
3. What dentists use room number 2?
4. When are Alicia Ndlovu's appointments?
5. What room is used for Neo Ally's appointment?
6. How many appointments does Shirley Nel have on 17/08/2020?

EXERCISE 8

1. An electronic store sells monitors, speakers and cell phones. These products are supplied by
manufacturers. Each product has a price and a description. Note that one manufacturer can supply
many products and one product can be supplied by different manufacturers. An example of the
data is stored in the table below:
Manufacturer Address ProductName Description Price
15 Sunset BD, Los
ACME Monitor High resolution 23 inch R5 999.00
Angeles
15 Sunset BD, Los
ACME Cell phone 3 cameras, biometrics scanner R10 000.00
Angeles
Blue tooth
SpeakCo 18, HW Street Can pair with multiple devices R2 250.00
speaker
SpeakCo 18, HW Street Monitor High resolution HDMI R2 250.00

1.1. Identify the non-atomic field.


1.2. Identify the redundant data.
1.3. What is the relationship between manufacturer and products?
1.4. Normalise the table to remove the data redundancy.
2. Normalise the ParkCars table.
ClientID First Surname Email CarID Make Model CarRate
Name
85 John Doe [email protected] 100 Toyota Fortuna 1
86 Nazim Du Plooy [email protected] 101 Ford GT 1.2
86 Nazim Du Plooy [email protected] 102 VW Beetle 0.8
87 Lia Mkhizi [email protected] 100 Toyota Fortuna 1
88 Sally Hamilton [email protected] 102 VW Beetle 0.8
85 John Doe [email protected] 103 Tank 10
85 John Doe [email protected] 104 Tank Another 11
89 Fred Jones [email protected] 105 Kia Picanto 0.2

Page 52 Learning Unit 8 Database Normalisation


3. Normalise the EmployeeDepts table.
EmployeeID Employee Date of Birth Room No Department
1 Shuraya 1997/04/02 1 Marketing
1 Shuraya 1999/12/03 2 Sales
2 Fazul 1990/10/18 3 Quality Assurance
3 Bongani 1999/12/03 4 Human Resource
4 Fred 2000/01/01 2 Sales
5 Gemima 1980/09/29 1 Marketing
6 Mpumi 1985/11/26 3 Quality Assurance
7 Katleho 1998/05/30 4 Human Resources
3 Bongani 1999/12/03 2 Sales

8.11 A More Complex Example – Running Club


A running club with many members. For each member, the club stores the person's name and date of
birth. Each member runs with a running "school" according to their ability. There are 4 running schools,
namely the "Bolts", the "Jets", the "Miles" and the "Underdogs". Each school runs at a different
rate. The Bolts run at 5 mins/km, the Jets run at 5.5 mins/km, the Miles run at 6 mins/km and the
Underdogs run at 6.5 mins/km. Each school has a captain who is also member of the club. The runners
in the club enter and run in many races. The club stores all the races a runner has entered and the
finishing time for each race. The races are all a fixed distance in km, namely 21km or 42km. Each race
has a name, a date and a distance.

8.11.1 Identify the Tables


The entities are a runner, a school, a race, a result at a race. Since there are many fields, each field
needs to be allocated to a table.
Here the convention has been followed of prefixing every table's name with "tbl".
tblRunner (Name, DOB)
tblSchool (Name, Captain, Rate)
tblResult (Time)
tblRace (Name, Dist, Date)

8.11.2 Give each Table a Primary Key


tblRunner (RunnerID, Name, DOB)
tblSchool (SchoolID, Name, Captain, Rate)
tblResult (ResultID, Time)
tblRace (RaceID, Name, Dist, Date)

Learning Unit 8 Database Normalisation Page 53


8.11.3 Analyse the Relationships Between the Tables
• One school has many runners.
• One runner has many race results.
• One race has many race results.

Runner
∞ School
1
1


Result
∞ 1
Race

8.11.4 Link the Tables Using the Primary and Foreign Keys
Place the primary keys of the table in the one side of the relationships as foreign keys in the tables on
the many side of the relationships. The tables become:
tblRunner (RunnerID, Name, DOB, SchoolID)
tblSchool (SchoolID, Name, Captain, Rate)
tblResult (ResultID, RunnerID, RaceID, Time)
tblRace (RaceID, Name, Dist, Date)
Note that tblResult has 2 foreign keys.

8.11.5 Populate the Tables with Data


Note that the primary key field in each table is underlined.

Page 54 Learning Unit 8 Database Normalisation


tblResult tblRunner
ResultID RunnerID RaceID Time RunnerID Name DOB SchoolID
1 1 1 1:16:52 1 Cephas Mazibuko 1983/01/17 1
2 5 1 1:18:24 2 Geoff Taylor 1984/11/02 4
3 17 1 1:20:32 3 Dean Parker 1974/04/21 3
4 19 1 1:23:16 4 Leon Twala 1995/02/24 4
5 20 1 1:25:03 5 Henry Grobler 1991/06/06 1
6 7 1 1:32:11 6 Gugu Matala 1971/12/26 2
7 14 1 1:42:31 7 Bronwyn Kotze 1992/07/07 1
8 15 1 1:47:32 8 Johanna George 1990/04/03 4
9 12 1 1:47:32 9 Jessica Andrews 1999/03/18 3
10 13 1 1:56:42 10 Andrea Prinsloo 1976/06/19 4
11 3 1 2:04:04 11 Steven Mkomo 1987/01/09 2
12 18 1 2:15:53 12 Takalani Coetzee 1999/02/24 2
13 16 1 2:16:10 13 Roxanne Rikhotso 1993/04/03 3
14 8 1 2:22:48 14 Lungile Mbele 1971/06/24 1
15 2 1 2:23:51 15 Tandy Maritz 1992/06/26 2
16 4 1 2:32:51 16 Bernard Pretorius 1985/02/16 3
17 10 1 2:31:24 17 Yolanda Gordan 1994/01/16 1
18 9 1 2:31:24 18 Juanita De Freitas 1990/06/04 3
19 1 2 1:17:41 19 Cornelius De Berg 1975/05/16 1
20 17 2 1:22:22 20 Cheryl Bester 1983/03/22 1
21 7 2 1:34:50
22 15 2 1:55:50 tblRace
23 9 2 2:31:18 RaceID Name Dist Date
24 16 2 2:30:20 1 Wonderpark 21 2019/01/12
25 3 3 2:01:22 2 Rainbow 21 2019/03/16
26 6 3 2:11:41 3 Combat Run 21 2019/05/01
27 1 4 2:28:28 4 Combat Run 42 2019/05/01
28 19 4 2:33:34 5 Irene 42 2019/05/25
29 14 4 2:47:44
30 7 4 2:52:16 tblSchool
31 15 4 3:15:24 SchoolID Name Captain Rate
32 13 4 3:40:18 1 Bolts Lungile Mbele 5
33 6 4 3:54:49 2 Jets Takalani Coetzee 5.5
34 3 4 4:06:07 3 Miles Roxanne Rikhotso 6
35 19 5 2:32:45 4 Underdogs Andrea Prinsloo 6.5
36 7 5 2:50:12
37 15 5 3:09:52
38 6 5 3:55:09

8.11.6 Refine the Tables to Eliminate Redundancy and Extra Data


Learning Unit 8 Database Normalisation Page 55
Look at each table and see if there are any fields that are not needed. In tblResult, the primary key field
ResultID uniquely identifies the records in the table. But, ResultID can be eliminated by combining
RunnerID and RaceID into a composite key. That is, instead of using a unique ResultID number for
each record, records are still uniquely identified by a combination of RunnerID and RaceID. By doing
this it is assumed that no runner can run the same race twice, which, in this example, is reasonable:

tblResult
RunnerID RaceID Time
1 1 1:16:52
5 1 1:18:24
17 1 1:20:32
19 1 1:23:16
20 1 1:25:03

18 1 2:15:53
16 1 2:16:10
8 1 2:22:48
2 1 2:23:51
4 1 2:32:51

9 2 2:31:18
16 2 2:30:20
3 3 2:01:22
6 3 2:11:41
1 4 2:28:28

3 4 4:06:07
19 5 2:32:45
7 5 2:50:12
15 5 3:09:52
6 5 3:55:09

There is still some data redundancy in the database. The captains of the schools have their names
stored twice: in tblRunner and in tblSchool. Replace these names with their RunnerID's in tblSchool
to solve this problem:

tblSchool
SchoolID Name Captain Rate
1 Bolts 14 5
2 Jets 12 5.5
3 Miles 13 6
4 Underdogs 10 6.5

Page 56 Learning Unit 8 Database Normalisation


8.11.7 Apply Normalisation Rules
To check that the design is good, apply the rules of normalisation to ensure all the data in the database
is in its most manageable form:

• Each table has a primary key


• There is no redundant data
• There is no non-atomic data
• There is no derived data
tblResult tblRunner
RunnerID RaceID Time RunnerID Name DOB SchoolID
1 1 1:16:52 1 Cephas Mazibuko 1983/01/17 1
5 1 1:18:24 2 Geoff Taylor 1984/11/02 4
17 1 1:20:32 3 Dean Parker 1974/04/21 3
19 1 1:23:16 4 Leon Twala 1995/02/24 4
20 1 1:25:03 5 Henry Grobler 1991/06/06 1
… 6 Gugu Matala 1971/12/26 2
18 1 2:15:53 7 Bronwyn Kotze 1992/07/07 1
16 1 2:16:10 8 Johanna George 1990/04/03 4
8 1 2:22:48 9 Jessica Andrews 1999/03/18 3
2 1 2:23:51 10 Andrea Prinsloo 1976/06/19 4
4 1 2:32:51 11 Steven Mkomo 1987/01/09 2
… 12 Takalani Coetzee 1999/02/24 2
9 2 2:31:18 13 Roxanne Rikhotso 1993/04/03 3
16 2 2:30:20 14 Lungile Mbele 1971/06/24 1
3 3 2:01:22 15 Tandy Maritz 1992/06/26 2
6 3 2:11:41 16 Bernard Pretorius 1985/02/16 3
1 4 2:28:28 17 Yolanda Gordan 1994/01/16 1
… 18 Juanita De Freitas 1990/06/04 3
3 4 4:06:07 19 Cornelius De Berg 1975/05/16 1
19 5 2:32:45 20 Cheryl Bester 1983/03/22 1
7 5 2:50:12
15 5 3:09:52
6 5 3:55:09

tblRace tblSchool
RaceID Name Dist Date SchoolID Name Captain Rate
1 Wonderpark 21 2019/01/12 1 Bolts 14 5
2 Rainbow 21 2019/03/16 2 Jets 12 5.5
3 Combat Run 21 2019/05/01 3 Miles 13 6
4 Combat Run 42 2019/05/01 4 Underdogs 10 6.5
5 Irene 42 2019/05/25

Rewrite the RunningClub database as a set of relations, correcting the above errors.
Learning Unit 8 Database Normalisation Page 57
8.12 Referential Integrity
Once database has been designed to be reliable and extendable, with tables linked by primary and
foreign keys, the designer needs to ensure queries cannot be performed that will violate the integrity of
the database. These queries could be deleting a race in the RunningClub database when runners still
have results listed in that race. Before referential integrity can be enforced, a primary key must be
defined in each table in the RunningClub database.

ACTIVITY 2
Load MS Access and open the database RunningClub found on the website at
http://www.funworks.co.za/FileDownloads/CATFiles.aspx.
Open tblRunner in Design view. Set the field RunnerID as a primary key by selecting the
RunnerID field and clicking the Primary Key button.

Do the same to set RaceID as the primary key in tblRace and SchoolID as the primary key in
tblSchool.
The table tblResult has a composite key, so in Design View of tblResult, select BOTH RunnerID
and RaceID and then click the Primary Key button. Both fields should show a key next to them.

8.12.1 Implement Referential Integrity in MS Access


Select Database Tools tab and click on the Relationships button to view the relationships
window. Choose Show Table and select all four tables.
You should see all the tables and their fields in the window. You should also notice that the primary keys
for each table are shown in bold.
To create a relationship between two tables, click on the primary key RunnerID in the table called
tblRunner and drag onto the RunnerID in the table called tblResult.
A new window appears asking for details about the relationship you just created.
Check the box to Enforce Referential Integrity, which is explained in the following section.

Page 58 Learning Unit 8 Database Normalisation


Continue to join all the tables so that the relationships appear as shown in the following screen
shot:

Check that this representation in Access has the same relationships as the RunningClub database
designed earlier in this Learning Unit.

Runner
∞ School
1
1


∞ 1
Result Race

8.12.2 Check Referential Integrity


Referential integrity ensures that the links between tables remain consistent. In other words, no record
can refer to another record that does not exist.
Deleting: If the runner Tandy Maritz left, this would cause problems in the results table called tblResult
as there would be results for a runner who does not exist. Before Tammy Maritz can be deleted from
tblRunners, all her results would have to first be deleted from tblResults.
Updating: If the captain of a school changed (stored in tblSchool), the new captain must exist as a
runner in tblRunners.
Inserting: A result cannot be added for a runner that does not exist in tblRunners.
By enforcing referential integrity, the database designer ensures that no record can refer to another
record that does not exist, causing the database to be incorrect. In MS Access, this must be done
explicitly by checking the dialog box when creating relationships.

Learning Unit 8 Database Normalisation Page 59


ACTIVITY 3
Test the referential integrity by attempting to perform the following changes on the database:
Delete the runner Tandy Maritz from tblRunner.
Change the captain of Jets school to be runner number 50 in tblSchool.
Add a result for runner number 50, with a time of 2 hours for race number 3 in tblResults.
All these changes should not be allowed by MS Access. Please note that when referential integrity is
enforced, you need to expect possible errors. The DBMS will check if the change will produce a record
that does not refer to another record, and if so, an error is produced.

8.13 Alternative Method of Normalisation


A table can be normalised into smaller tables by using a defined set of rules. Applying these rules will
create tables that satisfy the first three normal forms:
1. 1st Normal Form – 1NF
2. 2nd Normal Form – 2NF
3. 3rd Normal Form – 3NF
There are many more normal forms which we will not study in this course. You may come across them in
later studies.
Although there are clear guidelines about how to normalise a database, there may be more than one
correct solution. Ultimately, you must understand the problem and try to design the database to
represent the real world as accurately as possible. You also need to be aware of any assumptions you
are making.

8.13.1 Characteristics of Normal Forms


1NF

• No repeating groups
• Choose a primary key
2NF

• Relation is in 1NF
• No partial dependencies
3NF

• Relation is in 2NF
• No transitive dependencies
Before we can begin to normalise a table, we need to look at the concept of one field being dependent
on another and the relationships between data in the database.

8.13.2 Dependencies
Simply put, a dependency is where one field is related to another. This can be represented by A ➔ B
which means B is determined by A.
A simple example is a car's make and model. The model of the car determines the make. For example, a
Volkswagen Polo is made by Volkswagen and the model is Polo. So, if you know the model of the car
(Polo) then there can be only one make (Volkswagen). Note that you cannot say this the other way
around. A make does not determine a model. Volkswagen make many different models of cars and
knowing the make of the car does not give us the model.

Page 60 Learning Unit 8 Database Normalisation


http://www.cms.livjm.ac.uk/johnwillitts/RelDBDes/13Norm/SuppFDs/functional_dependencies.htm.

In the ParkCars table the ClientID determines the First Name, Surname and Email. The CarID
determines the Make, Model and CarRate. The CarRate is not dependent on the client's name or
ClientID, it is an indication of how difficult it is to park the car. It has nothing to do with the client (a client
may not be able to parallel park but that would relate to all cars).

ClientID First Surname Email CarID Make Model CarRate


Name
85 John Doe [email protected] 100 Toyota Fortuna 1
86 Nazim Du Plooy [email protected] 101 Ford GT 1.2
86 Nazim Du Plooy [email protected] 102 VW Beetle 0.8
87 Lia Mkhizi [email protected] 100 Toyota Fortuna 1
88 Sally Hamilton [email protected] 102 VW Beetle 0.8
85 John Doe [email protected] 103 Tank 10
85 John Doe [email protected] 104 Tank Another 11
89 Fred Jones [email protected] 105 Kia Picanto 0.2

8.13.3 Partial Dependency


A partial dependency is when a field's value is dependent on only part of a composite key. Consider the
data of a Student's table relating to sports' choices at a school. The primary key is a composite key of
StuID and Sport.

House Practice Num


StuID Name Grade House Sport Coach
Colour Day Matches
Cricket U16 Lezar Thursday 4
1225 Joe Soap 10 Cambridge Yellow
Rugby 1st Team Meyer Tuesday 2
Roger
1124 10 Oxford Blue Cricket U16 Lezar Thursday 3
Phillips

Patience Netball U18 Smith Wednesday 8


2345 11 Yale Red
Mbata Girls Hockey U18 Bailly Monday 5
Boys Hockey U19 Jones Monday 5
Hennie
3221 12 Cambridge Yellow Rugby 1st Team Meyer Tuesday 2
Visser
Golf Joubert Friday 7
Sarah
2334 11 Oxford Blue Golf Joubert Friday 5
Cohen

In the above table, Name depends on the StuID and not Sport. If you have a student's ID then you
could work out their name. In the same way, Coach depends on the Sport.
Can you spot any more partial dependencies in the Student relation?

8.13.4 Transitive Dependency


A transitive dependency is when a field's value is dependent on a non-key field. In the Student relation
House Colour depends on the House and House is not part of the primary key.

CHECK POINT 2

Learning Unit 8 Database Normalisation Page 61


1. Explain what a dependency is and give an example.
2. What is the difference between a dependency and derived data?
3. What are transitive and partial dependencies?
4. Explain the difference between redundant data and duplicate data.
5. Give an example of atomic data. How should we deal with non-atomic data?
6. List the characteristics of 1NF, 2NF and 3NF.

8.14 Normalising a Database to Third Normal Form


8.14.1 First Normal Form (1NF) - it is not all it is cracked up to be
Using the Student table, we can change the table to be in 1NF by eliminating the repeating groups and
choosing the combination of StuID and Sport as a primary key. This will introduce data redundancy but
will satisfy the requirements for 1NF.

House Practice Num


StuID Name Grade House Sport Coach
Colour Day Matches
1225 Joe Soap 10 Cambridge Yellow Cricket U16 Lezar Thursday 4
Rugby 1st
1225 Joe Soap 10 Cambridge Yellow Meyer Tuesday 2
Team
Roger
1124 10 Oxford Blue Cricket U16 Lezar Thursday 3
Phillips
Patience
2345 11 Yale Red Netball U18 Smith Wednesday 8
Mbata
Patience Girls Hockey
2345 11 Yale Red Bailly Monday 5
Mbata U18
Hennie Boys
3221 12 Cambridge Yellow Jones Monday 5
Visser Hockey U19
Hennie Rugby 1st
3221 12 Cambridge Yellow Meyer Tuesday 2
Visser Team
Hennie
3221 12 Cambridge Yellow Golf Joubert Friday 7
Visser
Sarah
2334 11 Oxford Blue Golf Joubert Friday 5
Cohen

1NF achieves the following:

• Flattened the table


• Chose a primary key
• Eliminated repeating groups
However,

• 1NF does not eliminate data redundancy


• 1NF does not generate new relations
This relation can be written as:
Students (StuID, Name, Grade, House, House_Colour, Sport, Coach, Practice Day, NumMatches)

8.14.2 Second Normal Form (2NF)

Page 62 Learning Unit 8 Database Normalisation


Draw a dependency Diagram showing the partial and transitive dependencies.

Write all keys separately, then together


StuID
Sport
StuID, Sport
Write all dependant fields next to their respective keys and give each table a name. We have chosen the
name Players for third table.
Students (StuID, Name, Grade, House, House_Colour)
Sports (Sport, Coach, Practice Day)
Players (StuID, Sport, NumMatches)
Students

StuID Name Grade House House_Colour


1225 Joe Soap 10 Cambridge Yellow
1124 Roger Phillips 10 Oxford Blue
2345 Patience Mbata 11 Yale Red
3221 Hennie Visser 12 Cambridge Yellow
2334 Sarah Cohen 11 Oxford Blue

Sports Players

Sport Coach Practice Day StuID Sport Matches


Cricket U16 Lezar Thursday 1225 Cricket U16 4
Netball U18 Smith Wednesday 1225 Rugby 1st Team 2
Girls Hockey U18 Bailly Monday 1124 Cricket U16 3
Boys Hockey U19 Jones Monday 2345 Netball U18 8
Rugby 1st Team Meyer Tuesday 2345 Girls Hockey U18 5
Golf Joubert Friday 3221 Boys Hockey U19 5
3221 Rugby 1st Team 2
3221 Golf 7
2334 Golf 5

Learning Unit 8 Database Normalisation Page 63


2NF – Complete

• No more partial dependencies


• Reduces redundancy considerably
• New relations created

8.14.3 Third Normal Form (3NF)


Put the transitive dependency into a new relation. House_Colour is a transitive dependency as the
colour of the house is determined by its name. Therefore, we extract house colour into a new relation:
Houses (House, House_Colour) and the Students table loses the House_Colour field.
The tables Sports and Players stay the same.
Students Houses

StuID Name Grade House House House_Colour

1225 Joe Soap 10 Cambridge Cambridge Yellow

1124 Roger Phillips 10 Oxford Oxford Blue

2345 Patience Mbata 11 Yale Yale Red

3221 Hennie Visser 12 Cambridge

2334 Sarah Cohen 11 Oxford

3NF – Completed
We can now write the relations as follows:
Students (StuID, Name, Grade, House)
Sports (Sport, Coach, Practice Day)
Players (StuID, Sport, NumMatches)
Houses (House, House_Colour)
At this stage, it is important that we define what a foreign key is. A foreign key is a field in a table that is
a primary key in another table. In the Students table, House is a foreign key as it is a primary key in the
Houses table. The foreign keys link tables together if they are not linked via the primary keys.
It is all very well to have 4 tables that are nicely broken up, but can you link them together? See if you
can answer these questions by looking at the tables.

ACTIVITY 4
What sport does Hennie Visser play?
How many matches has Joe Soap played?
When is the Rugby first teams' practice day?
What colour is Roger Philips' house?
Who is coached by Jones?
Who is in Cambridge house?

Page 64 Learning Unit 8 Database Normalisation


Check the database for anomalies:
Can you add a new sport if no one takes it yet?
Can you change the colour of Cambridge house with only one value being changed?
Can you delete a student without losing any other data?
What if you wanted to delete a house? Should this be allowed?

EXERCISE 9

1. Software Company
Adapted from Database Normalisation Exercise - Dominic Gruijters 2008 Used with Permission

To understand the data which has been given to you, an outline of the real-world scenario for the
Software Company is laid out below:

• The company works on many projects at one time.


• A project can be assigned to as many employees as necessary.
• Each employee in the company does only one type of work.
• An employee can work on more than one project at the same time.
• There is a standard rate for each type of employee. In other words, the company charges the same
rate for all programmers assigned to that project.
• The number of hours worked on each project is indicated. Those hours are specific to the
employee and that project.

ProjID ProjName EmpID EmpName JobTitle ChargePerHour HoursWorked


1 Sanlam 23 Janet Jackson Project Manager 450 12
56 Celine Dion Delphi Programmer 350 41
12 James Brown Delphi Programmer 350 21
2 Netstar 56 Celine Dion Delphi Programmer 350 6
11 George Clooney Project Manager 450 16
77 Johnny Clegg Database Analyst 275 6
3 Poland 12 James Brown Delphi Programmer 350 5
11 George Clooney Project Manager 450 3

1.1. Study the data given in the table:


1.1.1. Is this data in 1NF?
1.1.2. Give a reason for your answer.
1.1.3. Write down the relation in the form of the table name followed by the fields in
brackets.

Learning Unit 8 Database Normalisation Page 65


1.2. 1st Normal Norm:
1.2.1. Write in all the data required in the table so that it is 1NF.
1.2.2. Write down the relation in relational notation.
1.2.3. When placing the data into 1NF you should have selected primary keys. Explain
how you chose your primary keys.
1.3. The data is still susceptible to anomalies:
1.3.1. State which anomalies can occur in our 1NF table created in 1.2. For each anomaly
type, give an example relevant to the scenario.
1.3.2. Identify the redundant data in the table.
1.4. 2nd Normal Form:
1.4.1. What are the requirements for 2NF?
1.4.2. Draw a dependency diagram for the data.
1.4.3. Write down the relations in the relational notation and underline all primary keys.
1.5. 3rd Normal Form:
1.5.1. What are the requirements for 3NF?
1.5.2. Use your dependency diagram to transform the relation into 3NF.
1.5.3. Write the tables in relational notation in 3NF.
1.6. Describe any other anomalies that still exist. Make modifications to the tables, data or keys to
rectify these problems. Write down the final relations in relational notation.
2. ComSciStudent
The following is extracted and adapted from http://db.grussell.org/section008.html

2.1. Consider the following table storing the results of first year Computer Science students. Each
student has a Matric_no field (since students register in their matric year) which uniquely
identifies the student. Some of the students have taken more than one subject during their
first year.

Matric_no Name Date_of_Birth Subject Teacher Grade


210100 Smith, J 14/11/2000 Databases Jobs C
Soft_Dev Gates A
ISDE Torvald D
210105 White, A 10/05/1999 Soft_Dev Gates B
ISDE Torvald B
210120 Moore, T 11/03/2001 Databases Jobs A
Soft_Dev Gates B
Workshop Lovelace C
210145 Smith, P 09/01/2000 Databases Jobs B
210150 Black, D 21/08/2001 Databases Jobs B
Soft_Dev Gates D
ISDE Torvald C
Workshop Lovelace D

Page 66 Learning Unit 8 Database Normalisation


2.2. Normalise the above table to 1NF.
2.3. Give an example of each type of anomaly that could occur.
2.4. Normalise the table to 2NF and then 3NF. Showing each step clearly. Write your answer
showing all relations.

Learning Unit 8 Database Normalisation Page 67

You might also like