What Is a Database? A Beginner's Guide With Real Kenyan Examples
The Qtec Mastery
Author
Every app you use, from your school portal to M-Pesa, keeps its information somewhere organised so it can find it again in a fraction of a second. If you have ever wondered what a database is and why every developer job advert seems to ask for SQL, this guide is for you. By the end you will understand tables, rows and columns, know the difference between SQL and NoSQL, and have written your first real query.
A database is an organised collection of data stored on a computer so that it can be searched, updated and shared easily. Most databases store data in tables made of rows and columns, and you talk to them using a language called SQL. |
Databases from Zero, part 1 of 6. Next: SQL for Beginners: 10 Queries You Will Use Every Day
What is data, and what makes it a database?
Data is any recorded fact: a name, a phone number, an amount paid, a date. On its own, data is just a pile of facts. A note on a piece of paper saying "Brian paid 5,000" is data.
A database is what you get when you store those facts in a fixed structure, so that a computer can answer questions about them. Instead of flipping through a receipt book, you can ask "Who has not paid this term?" and get the answer instantly, even if there are a million records.
A good database also:
- Stops bad data getting in, for example a payment with no amount.
- Lets many people use the same data at once without overwriting each other.
- Keeps the data safe when the power goes off halfway through a save.
A spreadsheet can do some of this, which is why many small businesses start there. Once several people need the same records, or the sheet gets large, a proper database is safer and much faster.
What are tables, rows and columns?
Most databases you will meet as a beginner are relational databases. They store data in tables, and a table looks a lot like a spreadsheet:
- A table holds one kind of thing, for example students.
- Each column is one piece of information about that thing, such as the student's name or county. Every column has a data type: text, number, date and so on.
- Each row is one record, for example one student.
Throughout this series we use a small database for a Kenyan college. Here is part of its students table:
| student_id | full_name | county | course_id |
|---|---|---|---|
| 1 | Wanjiku Kamau | Nairobi | 1 |
| 2 | Brian Otieno | Kisumu | 2 |
| 3 | Amina Hassan | Mombasa | 3 |
| 4 | Kevin Mutua | Machakos | 2 |
| 5 | Faith Chebet | Uasin Gishu | NULL |
Two things to notice. First, every student has a unique student_id. This is the primary key, the value that identifies one row and only one row. Two students can share a name, but never an ID. Second, course_id does not store the course name. It stores a number that points to a row in a separate courses table. That link between tables is what makes the database "relational". Faith has not chosen a course yet, so her course_id is NULL, which means "no value".
What is a DBMS?
You never open a database file directly. You use a database management system (DBMS), the software that stores the data, checks the rules and answers your questions. Popular ones include:
- MySQL: free, very common in web hosting and with PHP and Laravel. We use it in this series.
- PostgreSQL: free, powerful and popular for larger systems.
- SQLite: a tiny database inside a single file, used in many mobile apps.
- Microsoft SQL Server and Oracle: common in banks, large companies and government.
- MongoDB: a popular NoSQL database.
The good news is that once you learn SQL on one of the relational ones, most of it carries over to the others.
What is SQL, and what is NoSQL?
SQL (Structured Query Language, said "S-Q-L" or "sequel") is the language for relational databases. You use it to create tables, add rows, change them and ask questions. It reads almost like English:
SELECT full_name, county
FROM students
WHERE county = 'Nairobi';
NoSQL is a name for databases that do not use tables in the usual way. MongoDB, for example, stores each record as a flexible document that looks like JSON, and two documents in the same collection can have different fields. That flexibility suits some apps, but you give up some of the strict rules that keep relational data tidy.
For a beginner the advice is simple: learn SQL first. Many business systems, from school portals to SACCO and payroll systems, are built on relational databases. We compare the options in detail in part 6, MySQL vs PostgreSQL vs MongoDB.
Where do you meet databases in Kenya every day?
School and college records
A school system keeps students, classes, fees and exam results in separate tables that point to each other. When the bursar checks a fee balance, the system adds up that student's payments and compares them with the fee for their course.
Your M-Pesa statement
When you download an M-Pesa statement, you are looking at a list of transactions: each one has a unique transaction code, a date and time, an amount and the other party. That is exactly the shape of a database table, with one row per transaction. In our college database, the payments table stores the M-Pesa code for every fee payment, such as SKA4H7XQ2P.
A shop's stock
A duka or hardware shop that uses a point-of-sale system keeps a products table like this:
| product | price_kes | in_stock |
|---|---|---|
| Unga 2kg | 180 | 40 |
| Cooking oil 1L | 320 | 15 |
| Sugar 1kg | 170 | 0 |
Every sale reduces in_stock, and the owner can ask the database "What has run out?" instead of counting shelves. (The prices here are only examples.)
How do I start learning databases?
You have two easy options.
Option 1: Use an online SQL sandbox
Search for "MySQL online sandbox" or "SQL fiddle" and pick one that offers MySQL 8. You type SQL in the browser and see the result straight away, with nothing to install. This is perfect for your first week, and it works on a slow laptop.
Option 2: Install MySQL on your laptop
- Download MySQL Community Server (free) from the official MySQL website. On Windows, the installer can also add MySQL Workbench, a visual tool for writing queries.
- During setup, choose a root password and write it down somewhere safe.
- Open Workbench, connect to your local server and open a new query tab.
Tools like XAMPP are also popular, but note that recent versions ship with MariaDB, a close relative of MySQL. It is fine for learning, though a few newer features behave differently.
Now run your first lines of SQL:
CREATE DATABASE qtec_school;
USE qtec_school;
CREATE TABLE courses (
course_id INT AUTO_INCREMENT PRIMARY KEY,
course_name VARCHAR(100) NOT NULL,
fee_kes DECIMAL(10,2) NOT NULL
);
INSERT INTO courses (course_name, fee_kes) VALUES
('Web Development', 10000.00),
('Python Programming', 20000.00),
('Cyber Security', 15000.00);
SELECT * FROM courses;
You should see:
| course_id | course_name | fee_kes |
|---|---|---|
| 1 | Web Development | 10000.00 |
| 2 | Python Programming | 20000.00 |
| 3 | Cyber Security | 15000.00 |
AUTO_INCREMENT gave each course its ID automatically, and DECIMAL(10,2) stores money exactly to two decimal places. Congratulations: you have built and queried a database.
Practice exercise
- Create the
studentstable with the columnsstudent_id,full_name,phone,county,course_idandenrolled_on. - Add Wanjiku Kamau (Nairobi, course 1) and Brian Otieno (Kisumu, course 2).
- Show only the students from Nairobi.
Answers
CREATE TABLE students (
student_id INT AUTO_INCREMENT PRIMARY KEY,
full_name VARCHAR(100) NOT NULL,
phone VARCHAR(15) UNIQUE,
county VARCHAR(50),
course_id INT,
enrolled_on DATE
);
INSERT INTO students (full_name, phone, county, course_id, enrolled_on) VALUES
('Wanjiku Kamau', '0712345678', 'Nairobi', 1, '2026-01-10'),
('Brian Otieno', '0723456789', 'Kisumu', 2, '2026-01-12');
SELECT full_name, county
FROM students
WHERE county = 'Nairobi';
Notice that the phone number is stored as text, not a number. A number column would drop the leading zero.
Learn databases properly, step by stepOur DBMS 1 course takes you from your first table to confident SQL over 10 weeks, online, with a certificate on completion. Also useful: SQL for Data Analysis (KES 20,000) |
Frequently asked questions
Is Excel a database?Not really. Excel stores data in rows and columns, but it does not enforce rules, handle many users safely or answer complex questions quickly. It is a good place to start thinking in tables, though. Do I need to know programming before learning SQL?No. SQL is often the first technical language people learn, and many data analysts use it without writing much other code. If you later move into web development, you will already have a head start. Which database should I learn first?MySQL or PostgreSQL. Both are free, widely used and teach you standard SQL that transfers to other systems. How long does it take to learn SQL basics?With regular practice, most beginners can write useful queries within a few weeks. Designing good databases takes longer, and the rest of this series will help. |
Comments (0)
Search Blog
Categories
Popular Posts
Why Traditional Education is Failing Future Developers: The QTEC Approach
326 views
What Is Frontend Development? A Beginner's Guide
121 views
What Is a Database? A Beginner's Guide With Real Kenyan Examples
35 views
Git and GitHub for Beginners: The Commands You Will Actually Use
33 views
Computer Packages Course in Kenya: Fees, Duration and Certificate (2026)
31 views
You Might Also Like
SQL for Beginners: 10 Queries You Will Use Every Day
Most of the SQL people write at work comes down to about ten patterns. This guid...
Read More →
SQL JOINs Explained Simply: INNER, LEFT and RIGHT JOIN With Examples
Real databases split information across several tables, so sooner or later you n...
Read More →
Database Design for Beginners: Tables, Keys and Normalisation
Most messy databases start life as a spreadsheet that grew too big: names typed...
Read More →