A database is an organised collection of related data stored so it can be accessed, managed and updated easily. A DBMS (database management system) such as MySQL or MS Access controls it. Examples in Kenya: KCSE results, M-Pesa transaction logs, school fee records, county land registries.
Benefits: less redundancy, easier updates, better integrity.
SQL (Structured Query Language) has:
Create a table:
CREATE TABLE students (
admno INT PRIMARY KEY,
name VARCHAR(50),
class VARCHAR(5),
marks INT
);
Insert:
INSERT INTO students VALUES (101, 'Achieng', '12A', 78);
Select with condition:
SELECT name, marks FROM students WHERE marks >= 50 ORDER BY marks DESC;
Update and delete:
UPDATE students SET marks = 80 WHERE admno = 101;
DELETE FROM students WHERE admno = 105;
COUNT, SUM, AVG, MIN, MAX with GROUP BY:
SELECT class, COUNT(*) FROM students GROUP BY class;
If marks are in a separate table:
SELECT students.name, results.score
FROM students JOIN results ON students.admno = results.admno;
Use validation rules, backups, user permissions and passwords. The Data Protection Act, 2019 requires careful handling of personal data, including learners' details.
Count students scoring 60 or more in each class: SELECT class, COUNT(*) FROM students WHERE marks >= 60 GROUP BY class;
Test yourself with 5 question(s) drawn from this topic - answer online and mark instantly.
Start Database Design and SQL quizCreate a free account to bookmark notes, download past papers, track your revision and get AI study help - free for Kenyan students.
Already have one? Log in
Join our list and we'll send fresh study notes and past papers straight to your inbox.