Cyber Security  ·  Level 6
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 should achieve
  • identify and document entities, attributes, and relationships using Entity-Relationship Diagrams (ERDs)
  • select the right data types and structures that fit system needs and keep data secure
  • design a database schema that maintains normalization, data integrity, and works efficiently
  • 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

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

Designing a database is a fundamental skill for cyber security professionals tasked with safeguarding sensitive information in Kenyan institutions. Whether for a county government office managing citizen records or a financial institution protecting client data, a well-designed database ensures data integrity, confidentiality, and availability. This chapter focuses on designing relational databases, a widely adopted model that supports structured data storage and complex queries, and on creating entity relationship diagrams (ERDs) to visualize database structure effectively.

2.1 Design a relational database

2.1.1 Principles of Relational Database Design

Relational database design is governed by principles that ensure data is logically organized and redundancies minimized. The core principle is that data is stored in tables called relations, each representing an entity such as customers or transactions. Each table has rows (records) and columns (attributes), and relationships between tables are established through keys.

Key principles include:

  • Atomicity of Data: Attributes should be indivisible units ensuring each cell contains only one value to simplify querying and updates.
  • Uniqueness of Rows: Each row must be uniquely identifiable, typically through a primary key, which prevents duplication and maintains data integrity.
  • Avoidance of Redundancy: Repeating data across tables leads to inconsistencies; normalization techniques reduce redundancy by splitting data into related tables.
  • Referential Integrity: Foreign keys maintain consistency between related tables by ensuring referenced data exists.
  • Data Independence: The design should allow changes in the database schema without affecting application programs, supporting long-term adaptability.

2.1.2 Normalization and Its Role in Security

Normalization is a systematic approach to decomposing tables to eliminate data anomalies and redundancies. For cyber security professionals, normalization reduces the attack surface by limiting repeated sensitive data and simplifying access controls.

Stages of normalization include:

  • First Normal Form (1NF): Ensures each table cell holds atomic values and each record is unique.
  • Second Normal Form (2NF): Removes partial dependencies by ensuring all non-key attributes depend on the entire 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): Handles exceptions to 3NF for stricter dependency rules.

Normalization supports security by making it easier to implement row-level permissions and reduces the risk of unauthorized data duplication or exposure.

2.1.3 Designing Tables and Defining Keys

Effective table design involves specifying the right attributes and keys to support data relationships and security requirements. In Kenya’s banking sector, for example, customer tables might include sensitive information requiring encryption and access restrictions.

Important considerations:

  • Primary Key Selection: Choose attributes that uniquely identify each record, such as account numbers or employee IDs, to support efficient indexing and retrieval.
  • Foreign Keys: Define relationships between tables, such as linking customer IDs in transaction tables to customer records, enforcing referential integrity.
  • Composite Keys: Sometimes, a combination of attributes forms a unique key, important in scenarios like order details where order ID and product ID together identify a record.
  • Indexing: Create indexes on frequently queried columns to improve performance but balance this with security as indexes can reveal data patterns.
  • Constraints: Use constraints like NOT NULL and UNIQUE to enforce data validity and prevent insertion of invalid or duplicate data.

2.1.4 Security Considerations in Database Design

Designing a relational database with security in mind is critical in Kenya’s cyber security landscape. Protecting data from unauthorized access and ensuring accountability requires embedding security controls at the design stage.

Key security design aspects:

  • Access Control: Define user roles and permissions at the table and column level to restrict data access based on job function.
  • Data Encryption: Plan for encryption of sensitive fields such as personal identification numbers and financial details to protect data at rest.
  • Audit Trails: Design tables to log access and changes, supporting forensic investigations in case of data breaches.
  • Input Validation: Structure the database to support checks that prevent SQL injection and other input-based attacks.
  • Backup and Recovery: Ensure the design supports regular backups and recovery mechanisms to maintain data availability and integrity.

Practice Questions

  1. Explain how normalization enhances both data integrity and security in a relational database. (10 marks)
  2. Describe the role of primary and foreign keys in relational database design and their importance in maintaining data consistency. (10 marks)
  3. Identify five security considerations that must be incorporated during the design of a relational database in a Kenyan financial institution. (10 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

Entity relationship modeling is a visual approach to database design that helps cyber security professionals understand and communicate the structure and constraints of data. In Kenya’s public service, clear ER diagrams aid in designing secure databases that a…

🔒2.3 Perform Normalisation

Database normalisation is a critical process in designing secure and efficient databases, especially in the cyber security field where data integrity and minimisation of redundancy are paramount. In Kenyan cyber security firms, government agencies such as the…

Chapter Summary

This chapter focused on designing a relational database, emphasizing the importance of structuring data efficiently to support secure and reliable storage and retrieval. It introduced the concept of entity relationships, explaining their role in representing real-world objects and the associations between them within the database context. The process of creating entity relationship diagrams (ERDs) was detailed, highlighting how these visual tools aid in mapping out the database’s structure before implementation. The chapter also covered the critical phase of normalization, demonstrating how to systematically organize data to eliminate redundancy and ensure data integrity. Through normalization, database designers can optimize tables to reduce anomalies and enhance performance. Overall, the chapter provided a comprehensive guide to the foundational steps in building a secure and well-structured relational database.

Self-Assessment

🔒 PDFDownload this self-assessment, with answers

A. Written Assessment

  1. What is the primary purpose of designing a relational database in cyber security? (2 marks)
  2. Identify and explain three key components of an Entity Relationship Diagram (ERD). (3 marks)
🔒20 more in this section.

Chapter Examination Questions

🔒 PDFDownload these examination questions, with worked answers

SECTION A (40 Marks) - Answer ALL Questions

  1. Explain the importance of designing a relational database for a Kenyan cybersecurity firm handling sensitive client data. (4 marks)
  2. Define the term "entity" in the context of entity relationship modeling in database design. (4 marks)
🔒18 more in this section.

Chapter Practical Activities

Practical 1: Design a simple relational database schema for a student records system

Cyber Security · Level 6
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 records system including tables for Students, Courses, and Enrollments with appropriate keys and relationships.
2.  You have been provided with the following resources for the practical task:
Tools & EquipmentMaterials
Computer with database design software
Access to requirements specification document
Writing materials (pen, notebook)
⬇ PDFResources Required (Cutting List)
S/NItemQuantity
1Computer with database design software1 Pc per Candidate
2Access to requirements specification document1 Pc per Candidate
3Writing materials (pen, notebook)1 set per Candidate
⬇ PDFAssessor Guide
Items to be EvaluatedMarks AvailableMarks ObtainedComments
TASK 1: Design relational database schema
Candidate uses PPE as required (if applicable)
(Award 1 mark for correct PPE use or zero)
1
Candidate reviews requirements specification document
(Award 3 marks for thorough understanding of requirements or zero)
3
Candidate identifies appropriate tables (Students, Courses, Enrollments)
(Award 1 mark per correctly identified table, zero if missing)
4
Candidate defines primary keys for each table correctly
(Award 1 mark per correctly defined primary key, zero if incorrect)
4
Candidate establishes correct foreign key relationships between tables
(Award 4 marks if all foreign keys correctly defined, zero if missing or incorrect)
4
Candidate defines appropriate field data types for each attribute
(Award up to 3 marks for correct data types, zero if inappropriate)
3
Candidate includes constraints to ensure data integrity (e.g. NOT NULL, UNIQUE)
(Award up to 3 marks for appropriate constraints, zero if missing)
3
Candidate documents schema clearly with table names, fields, keys and relationships
(Award up to 3 marks for clear and complete documentation, zero if incomplete)
3
Sub-Total25
PRODUCT CHECKLIST
Schema includes Students, Courses, and Enrollments tables
(Award 4 marks if all three tables are present and named correctly, zero if missing)
4
Primary keys correctly assigned to each table
(Award 4 marks if all primary keys correct, zero if incorrect)
4
Foreign keys correctly link tables (e.g., Enrollments links Students and Courses)
(Award 4 marks if all foreign keys correct, zero if incorrect)
4
Field data types appropriate and consistent
(Award up to 3 marks for appropriate data types, zero if inappropriate)
3
Constraints correctly applied for data integrity
(Award up to 3 marks for correct constraints, zero if missing)
3
Schema diagram clearly and neatly presented
(Award up to 3 marks for neatness and clarity, zero if unclear)
3
Sub-Total21
GRAND TOTAL46
ASSESSMENT OUTCOME:   ☐ Competent    ☐ Not Yet Competent (competent if at least 50%)

Practical 2: Create an Entity Relationship Diagram for a University Enrollment System

Cyber Security · Level 6
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 a detailed Entity Relationship Diagram (ERD) for a university enrollment system on A3 paper sized 420mm x 297mm as per the provided scenario.
2.  You have been provided with the following resources for the practical task:
Tools & EquipmentMaterials
Pencils (HB and 2B)Drawing paper A3 size
Eraser
Ruler 30cm
Compass
Protractor
Colored pens (Red, Blue, Black)
⬇ PDFResources Required (Cutting List)
S/NItemQuantity
1Drawing paper A3 size1 Sheet per Candidate
2Pencils (HB and 2B)2 Pcs per Candidate
3Eraser1 Pc per Candidate
4Ruler 30cm1 Pc per Candidate
5Compass1 Pc per Candidate
6Protractor1 Pc per Candidate
7Colored pens (Red, Blue, Black)3 Pcs per Candidate
⬇ PDFAssessor Guide
Items to be EvaluatedMarks AvailableMarks ObtainedComments
TASK 1: Create Entity Relationship Diagram
Candidate uses PPE (if applicable) before starting the drawing process
(Award 1 mark for correct PPE use or zero)
1
Candidate sets out drawing area on A3 paper correctly
(Award 2 marks for correct layout and margins or zero)
2
Candidate identifies and lists all entities required by the scenario
(Award 1 mark per correctly identified entity up to 4)
4
Candidate identifies and defines relationships between entities
(Award 1 mark per correctly defined relationship up to 4)
4
Candidate specifies cardinalities correctly for all relationships
(Award 1 mark per correctly specified cardinality up to 4)
4
Candidate includes primary keys and attributes for each entity
(Award 1 mark per entity with correct primary key and attributes up to 5)
5
Candidate uses correct ERD notation (e.g. crow's foot notation) consistently
(Award 3 marks for consistent and correct notation or zero)
3
Candidate uses neat and clear drawing techniques with appropriate labeling
(Award 3 marks for neatness, clarity and labels or zero)
3
Sub-Total26
PRODUCT CHECKLIST
Finished ERD correctly shows all entities with appropriate attributes and primary keys
(Award 5 marks for complete and accurate entities or zero)
5
All relationships are correctly represented with proper cardinalities
(Award 5 marks for complete and accurate relationships or zero)
5
Diagram fits neatly on A3 paper sized 420mm x 297mm with clear margins
(Award 4 marks for correct paper usage and layout or zero)
4
Use of correct ERD notation symbols throughout the diagram
(Award 4 marks for consistent and correct notation or zero)
4
Sub-Total18
GRAND TOTAL44
ASSESSMENT OUTCOME:   ☐ Competent    ☐ Not Yet Competent (competent if at least 50%)
🔒

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

Create a free account
🔒Identify and Annotate Entity Relationships in a Secure Database ERDPractical 3
🔒Develop an Entity Relationship Diagram with Complex RelationshipsPractical 4
🔒Normalize a Customer Orders Database Table to First Normal FormPractical 5
🔒Normalize a Student Enrollment Database Table to Second Normal FormPractical 6
🔒Normalization of Customer Orders Database to Third Normal FormPractical 7
🔒Design a normalized relational database schema for a student enrollment systemPractical 8
🔒Draw ERD for a Normalized Student Course Enrollment DatabasePractical 9
🔒Analyze and Improve an Existing Entity Relationship Diagram (ERD)Practical 10
Flashcards 20 cards Study deck ▾
Question
1

↻ Tap card to reveal answer
🔒

18 more in this section.

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

14 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 should achieve
  • identify and document entities, attributes, and relationships using Entity-Relationship Diagrams (ERDs)
  • select the right data types and structures that fit system needs and keep data secure
  • design a database schema that maintains normalization, data integrity, and works efficiently
  • 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.

So, 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.