By the end of this chapter, you will be able to:
Mastering these skills helps you keep important information reliable and accessible, which is essential for smooth business operations.
Compiled by: Elijah Kiprono
Database manipulation is a fundamental skill for ICT technicians working in Kenya’s diverse sectors, such as financial institutions, healthcare facilities, and county government offices. It involves populating databases with accurate data and retrieving information efficiently to support decision-making and service delivery. Mastery of database operations and querying languages empowers technicians to maintain data integrity and optimize system performance. This chapter explores the processes involved in database population and data retrieval, focusing on practical applications relevant to Kenyan ICT environments.
Database population is the work of loading data into the tables of a database and keeping that data correct afterwards. A new database holds only its structure: tables, fields and rules. It becomes useful when records are entered, read, corrected and removed in a controlled way. In a computer repair workshop, for example, the technician populates the customers and repair jobs tables when a device is booked in, reads them to see which jobs are still open, updates them as the repair progresses and removes records that were entered by mistake.
Database operations are the four basic actions performed on stored data: insert, select, update and delete. Together they are often called CRUD, from Create, Read, Update and Delete. Each action can be carried out through a form, a datasheet view or a SQL statement. The SQL form is used here because it works in much the same way in MySQL, MariaDB, PostgreSQL, SQL Server and SQLite, and it shows exactly what the database is asked to do. The full rules for writing SQL are taught under Data retrieval.
| Operation | SQL command | Effect on the stored data |
|---|---|---|
| Insert | INSERT | Adds one or more new records to a table |
| Select | SELECT | Reads records and shows them without changing anything |
| Update | UPDATE | Changes values in records that already exist |
| Delete | DELETE | Removes records from a table |
The examples in this topic use two linked tables from a computer repair workshop. The customer_id field in repair_jobs links each job to one customer.
customers
customer_id full_name phone town
101 Faith Achieng 0700000101 Kisumu
102 Hassan Mohamed 0700000102 Mombasa
103 Peter Kamau 0700000103 Nakuru
repair_jobs
job_id customer_id device fault status charge_ksh
5001 101 Laptop Cracked screen Completed 6500
5002 102 Desktop Will not boot In progress 0
5003 101 Printer Paper jam In progress 0
5004 103 Laptop Slow performance Received 0
Insert adds a new record to a table. The database checks the new record against the table's rules before it is stored, so a record that breaks a rule is refused instead of being saved wrongly. Example: when a customer brings in a wireless router with no internet connection, the technician inserts a new row into repair_jobs.
INSERT INTO repair_jobs (job_id, customer_id, device, fault, status, charge_ksh)
VALUES (5005, 102, 'Router', 'No internet connection', 'Received', 0);
Text values are written in single quotes and numbers are written without quotes. The column list in brackets names the fields in the same order as the values, so the statement still works if the table later gains a new column.
To insert a record safely:
Select reads data from one or more tables and shows it as a result set. The result set is a temporary view of the data, so the stored records stay exactly as they were. Selecting is used very often, because every report, search box and check of earlier work depends on it. Example: at the start of the day the technician lists the jobs that are still being repaired.
SELECT job_id, device, status
FROM repair_jobs
WHERE status = 'In progress';
With the sample data this returns two records: job 5002 (Desktop) and job 5003 (Printer).
Combining tables, totals and grouped results are taught under Writing SQL commands in Data retrieval.
Update changes values in records that already exist. It is used when information changes or when a mistake has to be corrected, and it keeps the same record instead of creating a second one. Example: when the desktop repair is finished, the technician records the new status and the charge.
UPDATE repair_jobs
SET status = 'Completed', charge_ksh = 2000
WHERE job_id = 5002;
After the update, the earlier query for jobs that are in progress returns only job 5003.
To update records safely:
Delete removes whole records from a table. It cannot be undone once it is committed, so it is used with more care than the other operations. Example: if a router job was booked in twice and the second copy was stored as job 5006, the technician removes the copy.
DELETE FROM repair_jobs
WHERE job_id = 5006;
To delete records safely:
Validation checks each value as it is entered, so that wrong data is stopped at the door instead of being cleaned up later. Invalid data such as an impossible date or a phone number with the wrong number of digits damages reports and searches long after it was typed in.
Data integrity means that the stored data stays accurate, consistent and trustworthy while it is being inserted, updated and deleted. The database enforces integrity through the rules below.
Create a free account to open more of this chapter.
Free: practical guides, quick cards, workplace scenarios and more.
Create a free accountThis chapter explored the essential processes involved in manipulating computerized databases, beginning with database population where key operations such as inserting, updating, and deleting data were detailed. It then addressed data retrieval techniques, focusing particularly on the use of Structured Query Language (SQL) as the primary tool for querying databases to extract meaningful information efficiently. The discussion progressed to database report generation, covering the steps to create comprehensive reports that summarize or analyze data. Editing reports was highlighted as a crucial step to ensure accuracy and relevance, followed by formatting techniques that enhance the visual presentation and readability of reports. The application of headers and footers was explained as a method to provide consistent structure and important contextual information across report pages. Finally, the chapter concluded with the practical considerations involved in printing reports, ensuring that the output meets organizational standards and user requirements. Together, these topics provide a thorough understanding of how to effectively manage and utilize computerized database systems in various professional settings.
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Laptop with database software installed | Sample student and course data sheet |
| USB flash drive |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Laptop with database software installed | 1 Pc per Candidate |
| 2 | USB flash drive | 1 Pc per Candidate |
| 3 | Sample student and course data sheet | 1 Set per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Database Creation and Saving | |||
| Launched the database application (Award 1 mark for launching the application) | 1 | ||
| Created a new database named 'StudentEnrollmentDB' (Award 1 mark for correct database naming and creation) | 1 | ||
| Saved the database file appropriately (Award 1 mark for saving the database correctly) | 1 | ||
| Sub-Total | 3 | ||
| TASK 2: Create Students Table | |||
| Created 'Students' table with fields: StudentID, FirstName, LastName, Gender, Department (Award 1 mark for each correct field name) | 5 | ||
| Assigned correct data types to each field (e.g. StudentID as AutoNumber or Integer, names as Text, Gender as Text, Department as Text) (Award 1 mark for each correct data type) | 5 | ||
| Set StudentID as Primary Key (Award 2 marks for correct primary key constraint) | 2 | ||
| Sub-Total | 12 | ||
| TASK 3: Create Enrollment Table | |||
| Created 'Enrollment' table with fields: EnrollmentID, StudentID, CourseName, Grade (Award 1 mark for each correct field name) | 4 | ||
| Assigned correct data types to each field (EnrollmentID as AutoNumber or Integer, StudentID as Integer, CourseName as Text, Grade as Number) (Award 1 mark for each correct data type) | 4 | ||
| Set EnrollmentID as Primary Key (Award 1 mark for correct primary key constraint) | 1 | ||
| Set StudentID as Foreign Key referencing Students table (Award 1 mark for correct foreign key constraint) | 1 | ||
| Sub-Total | 10 | ||
| TASK 4: Populate Tables with Sample Data | |||
| Entered at least 5 student records in Students table with all fields filled (Award 1 mark for each correctly entered student record) | 4 | ||
| Entered at least 8 enrollment records in Enrollment table linking to Students table (Award 1 mark for each correctly entered enrollment record) | 4 | ||
| Sub-Total | 8 | ||
| TASK 5: Create Queries | |||
| Created query listing full names (FirstName + LastName) and Department of all students (Award 2 marks for correct query) | 2 | ||
| Created query displaying CourseName and Grade for each student enrolled (Award 3 marks for correct query) | 3 | ||
| Created query showing full names of all male students who are enrolled (Award 3 marks for correct query) | 3 | ||
| Created query showing names of students who scored a grade above 75 (Award 3 marks for correct query) | 3 | ||
| Created query displaying students using JOIN between Students and Enrollment tables (Award 2 marks for correct join query) | 2 | ||
| Sub-Total | 13 | ||
| PRODUCT CHECKLIST | |||
| Database named 'StudentEnrollmentDB' saved and accessible (Award 2 marks for correct database file) | 2 | ||
| Students table structure matches specifications (field names, data types, primary key) (Award 4 marks for correct table structure) | 4 | ||
| Enrollment table structure matches specifications (field names, data types, primary and foreign keys) (Award 3 marks for correct table structure) | 3 | ||
| Tables populated with accurate data as per sample data sheet (Award 4 marks for correct data population) | 4 | ||
| Queries return correct results as per task requirements (Award 5 marks for all queries functioning correctly) | 5 | ||
| Sub-Total | 18 | ||
| GRAND TOTAL | 64 | ||
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Computer with Database Management Software | Student Enrollment Data Sheet |
| External Storage Device (USB Drive) |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Computer with Database Management Software installed | 1 Pc per Candidate |
| 2 | Student Enrollment Data Sheet | 1 Sheet per Candidate |
| 3 | External Storage Device (USB Drive) | 1 Pc per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Database Creation and Table Setup | |||
| Launched database application and created database named 'StudentRecords' (Award 1 mark each for launching application and correct database naming) | 2 | ||
| Created 'Students' table with fields: StudentID (Primary Key), FirstName, LastName, Gender, Department (Award 1 mark per field name, 1 mark for correct data type per field, 1 mark for primary key constraint on StudentID) | 6 | ||
| Created 'Enrollment' table with fields: EnrollmentID (Primary Key), StudentID (Foreign Key), CourseName, EnrollmentDate (Award 1 mark per field name, 1 mark for correct data type per field, 1 mark for primary key constraint, 1 mark for foreign key constraint on StudentID) | 6 | ||
| Sub-Total | 14 | ||
| TASK 2: Data Manipulation Operations | |||
| Inserted at least five student records into 'Students' table (Award 1 mark per correct student record inserted) | 5 | ||
| Inserted corresponding enrollment records into 'Enrollment' table (Award 1 mark per correct enrollment record inserted) | 5 | ||
| Updated the Department of a specified student correctly (Award full marks for correct update query executed) | 3 | ||
| Deleted a specified student record and related enrollment records (Award full marks for correctly deleting student and cascading enrollment records) | 4 | ||
| Modified the 'Enrollment' table to add a new field 'Grade' with appropriate data type (Award full marks for correct ALTER TABLE operation) | 4 | ||
| Updated the 'Grade' field for at least two enrollment records (Award full marks for correct update queries) | 3 | ||
| Saved the database and backed it up to the external storage device (Award 2 marks for saving, 1 mark for backup to USB) | 3 | ||
| Sub-Total | 27 | ||
| PRODUCT CHECKLIST | |||
| Database 'StudentRecords' contains correctly structured 'Students' and 'Enrollment' tables (Award marks if tables have correct fields, data types, and constraints) | 5 | ||
| Inserted, updated, and deleted records reflect accurately in the tables (Award marks for data accuracy and integrity) | 6 | ||
| New field 'Grade' added with correct data type and contains updated data (Award marks for correct field addition and data update) | 4 | ||
| Database file saved and backed up correctly on external storage device (Award marks for correct save and backup) | 4 | ||
| Sub-Total | 19 | ||
| GRAND TOTAL | 60 | ||
At the start of this chapter we promised you would be able to:
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.