Cyber Security  ·  Level 5
Secure Databases
Chapter 2: Design a database
📚 3 Topics
What you will be able to do

By the end of this chapter, you will be able to:

  • gather and analyze user and organizational needs to clearly define what your database must achieve
  • identify and document entities, attributes, and relationships using Entity-Relationship Diagrams (ERDs)
  • choose the right data types and structures that fit system needs and keep data secure
  • design a database schema that ensures data is normalized, accurate, and efficiently organized
  • include important security features like access controls, encryption, and auditing in your database design
  • create a clear data dictionary that explains all fields and data definitions

Mastering these skills will help you build secure, reliable databases that meet real-world business needs and protect valuable information.

Designing a secure database is fundamental for cybersecurity professionals tasked with protecting sensitive information in Kenya’s public and private sectors. Whether working with financial institutions like Equity Bank or government agencies such as the Kenya Revenue Authority (KRA), a well-structured database ensures data integrity, confidentiality, and availability. This chapter focuses on the principles of designing relational databases, creating entity relationships, and developing effective Entity Relationship Diagrams (ERDs) tailored for cybersecurity applications. Mastery of these concepts enables professionals to build robust databases that resist unauthorized access and support secure data management.

2.1 Design a relational database

2.1.1 Structure and components of a relational database

A relational database organizes data into tables, or relations, where each table consists of rows and columns representing records and attributes respectively. The fundamental components include:

  • Tables: Store data in a structured format with rows representing individual records and columns representing data fields.
  • Primary Keys: Unique identifiers for each record in a table that ensure entity integrity by preventing duplicate entries.
  • Foreign Keys: Attributes that create relationships between tables by referencing primary keys in other tables, enabling referential integrity.
  • Indexes: Data structures that speed up query processing by providing quick access paths to data, improving performance.
  • Constraints: Rules applied to data fields to enforce data validity, such as NOT NULL, UNIQUE, CHECK, and DEFAULT constraints.

In Kenyan financial institutions, for instance, primary keys ensure that each customer’s record is unique, while foreign keys link transactions to customer accounts, maintaining accurate and secure data relationships.

2.1.2 Normalization and its role in database design

Normalization is the process of organizing data to reduce redundancy and improve data integrity. It involves decomposing tables into smaller-related tables to eliminate duplicate data and ensure logical data storage. For cybersecurity professionals, normalization is crucial because redundant data can lead to inconsistency and increase the attack surface for data breaches.

Normal forms commonly applied include:

  • First Normal Form (1NF): Ensures each table cell contains atomic values, and each record is unique.
  • Second Normal Form (2NF): Removes partial dependencies where non-key attributes depend on part of a composite primary key.
  • Third Normal Form (3NF): Eliminates transitive dependencies so that non-key attributes depend only on the primary key.
  • Boyce-Codd Normal Form (BCNF): A stricter version of 3NF that addresses certain anomalies.
  • Fourth Normal Form (4NF): Handles multi-valued dependencies to prevent data anomalies in complex databases.

At a county government office managing citizen data, applying 3NF prevents duplication of address information across multiple records, reducing errors and securing data consistency.

2.1.3 Security considerations in relational database design

Designing a relational database with security in mind requires integrating access control, encryption, and audit mechanisms within the database schema and architecture. Cybersecurity professionals must anticipate threats such as SQL injection attacks, unauthorized data manipulation, and insider threats.

Key security design considerations include:

  • Least Privilege Principle: Assign users the minimum access rights necessary to perform their tasks, minimizing exposure.
  • Data Encryption: Encrypt sensitive fields such as national ID numbers or medical records to protect data at rest.
  • Input Validation: Design the database and application layers to validate inputs rigorously, preventing injection attacks.
  • Audit Trails: Implement logging mechanisms to track data access and modifications, aiding in forensic analysis.
  • Backup and Recovery Plans: Ensure that the database design supports secure backup strategies to prevent data loss from cyber incidents or system failures.

2.1.4 Indexing and performance optimization

Indexes improve database query performance by providing quick access paths to data, which is critical for applications requiring real-time analysis or reporting, such as fraud detection systems in banks. However, excessive or poorly designed indexes can degrade performance and increase storage requirements.

Best practices for indexing include:

  • Index Primary and Foreign Keys: These are frequently used in join operations and searches, improving query efficiency.
  • Use Composite Indexes Judiciously: Index multiple columns only when queries commonly filter on those combined attributes.
  • Avoid Over-Indexing: Too many indexes can slow down data modification operations like INSERT, UPDATE, and DELETE.
  • Monitor Query Performance: Use tools to analyze query execution plans and adjust indexes accordingly.
  • Consider Security Implications: Indexes should not expose sensitive data directly; combined with encryption, they must balance speed and confidentiality.

At a retail business database, indexing the product ID and customer ID fields accelerates sales report generation while maintaining secure access controls on the database.

Practice Questions

  1. Explain the role of primary and foreign keys in maintaining data integrity in a relational database. (5 marks)
  2. Describe the benefits of normalization and identify the differences between 1NF and 3NF. (6 marks)
  3. What security measures should be considered during the design of a relational database to prevent unauthorized access? (6 marks)
  4. How can indexing improve database performance, and what risks can arise from improper indexing? (5 marks)
The rest of this chapter
🔒

Create a free account to open more of this chapter.

Free: practical guides, quick cards, workplace scenarios and more.

Create a free account
🔒2.2 Create entity relationship

In cybersecurity, defining clear entity relationships is vital to represent how data objects interact and depend on each other within a database. This clarity aids in designing secure databases that reflect real-world processes accurately, such as linking user…

🔒2.3 Perform Normalisation

Normalisation is a fundamental process in designing secure and efficient databases, especially critical in cyber security environments where data integrity and minimising redundancy are paramount. In Kenyan institutions such as county government offices and fi…

Chapter Summary

This chapter focused on designing a relational database by first understanding the principles that govern how data is structured and related within tables. It then explored the creation of entity relationships, explaining the fundamental concepts and significance of entities and their associations. The process of drawing Entity Relationship Diagrams (ERDs) was detailed, highlighting how visual representations aid in clarifying database structure and relationships. Emphasis was placed on accurately mapping entities, attributes, and their connections to reflect real-world scenarios. The chapter concluded with the process of normalization, demonstrating how to organize data efficiently to reduce redundancy and improve data integrity. Through these steps, learners gained a comprehensive understanding of designing secure and well-structured databases.

Self-Assessment

🔒 PDFDownload this self-assessment, with answers

A. Written Assessment

  1. What is a relational database and how does it differ from a non-relational database? (3 marks)
  2. Identify and describe the main components of an Entity Relationship Diagram (ERD). (4 marks)
🔒20 more in this section.

Chapter Examination Questions

🔒 PDFDownload these examination questions, with model answers

SECTION A (40 Marks) - Answer ALL Questions

  1. Explain the importance of relational database design in securing sensitive information at a financial institution such as Equity Bank. (4 marks)
  2. Define what an entity is in the context of entity relationship modeling for a county government payroll system. (4 marks)
🔒18 more in this section.

Chapter Practical Activities

Practical 1: Design a Basic Relational Database Schema for a Student Enrollment System

Cyber Security · Level 5
Secure Databases
PRACTICAL ASSESSMENT
TIME: 4 HOURS
⬇ PDFCandidate Instructions (Candidate Tool)

Type: Individual

INSTRUCTIONS TO CANDIDATE:
1.  You are required to perform the following task:
i.  Design a relational database schema for a student enrollment system including three tables: Students, Courses, and Enrollments with appropriate fields and relationships.
2.  You have been provided with the following resources for the practical task:
Tools & EquipmentMaterials
Computer with Database Management System (DBMS) installedUSB flash drive for saving work
Keyboard and MouseDatabase design template or paper (optional)
⬇ PDFResources Required (Cutting List)
S/NItemQuantity
1Computer with Database Management System (DBMS) installed1 Pc per Candidate
2Keyboard and Mouse1 Set per Candidate
3USB flash drive for saving work1 Pc per Candidate
4Database design template or paper (optional)1 Pc per Candidate
⬇ PDFAssessor Guide
Items to be EvaluatedMarks AvailableMarks ObtainedComments
TASK 1: Database Creation and Table Setup
Opened DBMS and created a new database named 'StudentEnrollment'
(Award 1 mark for opening DBMS and creating database)
1
Created 'Students' table with correct field names and data types
(Award 1 mark per correct field and data type, total 4 marks)
4
Created 'Courses' table with correct field names and data types
(Award 1 mark per correct field and data type, total 3 marks)
3
Created 'Enrollments' table with correct field names and data types
(Award 1 mark per correct field and data type, total 3 marks)
3
Sub-Total11
TASK 2: Define Primary Keys and Relationships
Set primary key for 'Students' table (StudentID)
(Award 1 mark for correct primary key)
1
Set primary key for 'Courses' table (CourseID)
(Award 1 mark for correct primary key)
1
Set primary key for 'Enrollments' table (EnrollmentID or composite key)
(Award 1 mark for correct primary key)
1
Created foreign key relationships between 'Enrollments' and 'Students' (StudentID)
(Award 2 marks for correct foreign key and relationship)
2
Created foreign key relationships between 'Enrollments' and 'Courses' (CourseID)
(Award 2 marks for correct foreign key and relationship)
2
Sub-Total7
TASK 3: Save, Document, and Secure Database
Saved the database in the correct folder with appropriate name
(Award 1 mark for saving database correctly)
1
Generated database documentation listing tables and fields
(Award 2 marks for generating documentation)
2
Encrypted database with a password as instructed
(Award 3 marks for correctly setting encryption and password)
3
Compact and repaired the database to ensure integrity
(Award 2 marks for compacting and repairing database)
2
Sub-Total8
PRODUCT CHECKLIST
Database schema includes three tables (Students, Courses, Enrollments) with correct fields
(Award 5 marks for accurate table design and fields)
5
Primary keys correctly assigned to each table
(Award 3 marks for correct primary keys)
3
Foreign key relationships correctly established between tables
(Award 4 marks for correct foreign key relationships)
4
Database saved, documented, encrypted, and compacted without errors
(Award 4 marks for proper saving, documentation, encryption and maintenance)
4
Sub-Total16
GRAND TOTAL42
ASSESSMENT OUTCOME:   ☐ Competent    ☐ Not Yet Competent (competent if at least 50%)

Practical 2: Create an Entity Relationship Model for a Secure Database

Cyber Security · Level 5
Secure Databases
PRACTICAL ASSESSMENT
TIME: 4 HOURS
⬇ PDFCandidate Instructions (Candidate Tool)

Type: Individual

INSTRUCTIONS TO CANDIDATE:
1.  You are required to perform the following task:
i.  Create an entity relationship model diagram for a secure customer-transaction database with entities Customer, Account, and Transaction, showing relationships and cardinalities as per the provided scenario.
2.  You have been provided with the following resources for the practical task:
Tools & EquipmentMaterials
Computer with database design softwareReference materials on ER modeling and security principles
Pen
A4 paper
⬇ PDFResources Required (Cutting List)
S/NItemQuantity
1Computer with database design software (e.g., Microsoft Visio, draw.io)1 Pc per Candidate
2Pen and A4 paper for sketching2 Pcs per Candidate
3Reference materials on ER modeling and security principles1 Set per Candidate
⬇ PDFAssessor Guide
Items to be EvaluatedMarks AvailableMarks ObtainedComments
TASK 1: Identify Entities and Attributes
Identified and listed main entities (Customer, Account, Transaction)
(Award 1 mark for each correctly identified entity)
3
Defined appropriate attributes for each entity with correct naming
(Award 1 mark for each entity attributes set correctly defined)
4
Assigned primary keys to each entity correctly
(Award 2 marks if all primary keys correctly assigned, else 0)
2
Sub-Total9
TASK 2: Define Relationships and Cardinalities
Established relationships between Customer and Account entities
(Award 2 marks if correct relationship and cardinality shown, else 0)
2
Established relationships between Account and Transaction entities
(Award 2 marks if correct relationship and cardinality shown, else 0)
2
Included appropriate relationship attributes where necessary
(Award 2 marks if relationship attributes correctly included, else 0)
2
Sub-Total6
TASK 3: Model Security Features in ER Diagram
Indicated encrypted fields or sensitive data handling in the model
(Award 3 marks if encryption or security notations properly included, else 0)
3
Applied appropriate notation for access control or data privacy
(Award 3 marks if access control clearly represented, else 0)
3
Sub-Total6
TASK 4: Finalize and Save the ER Diagram
Completed ER diagram with neat and readable layout
(Award 2 marks for neatness and clarity)
2
Saved the diagram in the specified folder with correct file name
(Award 2 marks if file saved correctly)
2
Sub-Total4
PRODUCT CHECKLIST
ER diagram includes all required entities with correct attributes and primary keys
(Award 5 marks if all entities and attributes are complete and accurate)
5
Relationships correctly defined with proper cardinalities and relationship attributes
(Award 5 marks if relationships and cardinalities are correct)
5
Security aspects such as encrypted data fields and access controls clearly represented
(Award 5 marks if security features are clearly and correctly depicted)
5
Diagram is neatly presented, correctly labeled, and saved as per instructions
(Award 5 marks for presentation quality and correct saving)
5
Sub-Total20
GRAND TOTAL45
ASSESSMENT OUTCOME:   ☐ Competent    ☐ Not Yet Competent (competent if at least 50%)
🔒

Free: practical guides, quick cards, workplace scenarios and more.

Create a free account
🔒Annotate and explain entity relationship connotations in a database ER modelPractical 3
🔒Draw a complete ER diagram for a secure student information systemPractical 4
🔒Normalize a student enrollment database table to First Normal Form (1NF)Practical 5
🔒Normalize a database schema to Second Normal Form (2NF)Practical 6
🔒Normalize a database schema from 2NF to 3NFPractical 7
🔒Design a Relational Database Schema with ER DiagramPractical 8
🔒Create an ER Model with Relationship Cardinalities and Participation ConstraintsPractical 9
🔒Normalize a database table through 1NF, 2NF, and 3NFPractical 10
Flashcards 20 cards Study deck ▾
Question
1

↻ Tap card to reveal answer
🔒

18 more in this section.

Create a free account
Test Yourself 17 questions Start quiz ▾
0%
0 / 2
🔒

15 more in this section.

Create a free account
Am I competent?

At the start of this chapter we promised you would be able to:

  • gather and analyze user and organizational needs to clearly define what your database must achieve
  • identify and document entities, attributes, and relationships using Entity-Relationship Diagrams (ERDs)
  • choose the right data types and structures that fit system needs and keep data secure
  • design a database schema that ensures data is normalized, accurate, and efficiently organized
  • include important security features like access controls, encryption, and auditing in your database design
  • create a clear data dictionary that explains all fields and data definitions

Tick each one you can genuinely do.

Prove it — in the simulator

Sample simulation — try how the simulator works. A version built for this chapter's practical is coming.

Prepare Kenyan PilauLocked ▸

Free: practical guides, quick cards, workplace scenarios and more.

Now — are you there yet?

You're competent when you can confidently do 50% or more of what this chapter promised.

Sign in to record how you're doing.