By the end of this chapter, you will be able to:
These skills will help you build reliable database systems while keeping your workplace safe and environmentally responsible—key qualities for success in the tech trade!
Compiled by: Beatrice Adhiambo
A database management system (DBMS) is the software that stores, organises, protects and serves the data of a database to users and programs. Identifying database management software means knowing the main products on offer, what kind of data each one is built for, and what each one costs to run. A developer who can name the options and say what separates them can recommend a product with reasons instead of choosing the one that happens to be installed on a laptop.
Database software falls into two broad families. Relational DBMSs store data in tables of rows and columns, link tables through keys and are queried with Structured Query Language (SQL). Non-relational (NoSQL) systems store data in other shapes, such as documents, key-value pairs or graphs. Most business record systems, such as stock, sales and booking records, fit the relational family.
Example: a hardware shop with three branches wants one system for stock, suppliers and daily sales. Its data is made of well-defined records that must always add up, so a relational DBMS is the natural family to consider.
The products below are widely used and are met by a software developer in training and in small and medium projects. SQL examples in this chapter use MySQL 8 syntax unless another product is named.
| Product | Type and licence | Typical use |
|---|---|---|
| MySQL | Relational, client-server; free Community Edition and paid editions from Oracle | Web applications, small to medium business systems |
| MariaDB | Relational, client-server; open source fork of MySQL, largely compatible with it | Web applications, drop-in replacement for MySQL, bundled in the XAMPP package |
| PostgreSQL | Relational, client-server; open source | Systems that need strict standards support, advanced data types, complex queries |
| SQLite | Relational, embedded; the whole database is one file with no server | Mobile apps, desktop tools, prototypes, small local data |
| Microsoft SQL Server | Relational, client-server; commercial, with a free Express edition that has size and resource limits | Windows-centred businesses, applications written in C# and .NET |
| Oracle Database | Relational, client-server; commercial licence | Very large organisations with heavy transaction loads |
| Microsoft Access | Relational desktop database; part of some Microsoft 365 plans, Windows only | Small single-office record keeping with simple forms |
| MongoDB | Non-relational document database; free community edition and a paid cloud service | Data stored as flexible JSON-like documents, such as product catalogues with varying fields |
Selecting a DBMS is a decision that is hard to reverse: once data, application code and staff skills are built around one product, changing it costs time and money. A sound selection starts from the needs of the system, not from the product name, and ends with a written recommendation that the client can read and approve.
Worked example: the hardware shop uses four criteria with weights that add up to 100: cost 30, ease of administration 25, fit with its PHP web application 25, and local skills 20. The scores below are the developer's judgement for this shop only.
| Criterion (weight) | MySQL | PostgreSQL | SQL Server Express |
|---|---|---|---|
| Cost (30) | 5 | 5 | 4 |
| Ease of administration (25) | 4 | 3 | 4 |
| Fit with PHP application (25) | 5 | 4 | 3 |
| Local skills (20) | 4 | 2 | 3 |
Weighted total for MySQL = (30 × 5) + (25 × 4) + (25 × 5) + (20 × 4) = 150 + 100 + 125 + 80 = 455, which is 4.55 out of 5.
Weighted total for PostgreSQL = (30 × 5) + (25 × 3) + (25 × 4) + (20 × 2) = 150 + 75 + 100 + 40 = 365, which is 3.65 out of 5.
Weighted total for SQL Server Express = (30 × 4) + (25 × 4) + (25 × 3) + (20 × 3) = 120 + 100 + 75 + 60 = 355, which is 3.55 out of 5.
MySQL scores highest for this shop, so the developer builds the prototype on MySQL. A different shop with different weights, for example one whose staff all know SQL Server, could reach a different result with the same method.
Create a free account to open more of this chapter.
Free: practical guides, quick cards, workplace scenarios and more.
Create a free accountType: Individual
| Tools & Equipment | Materials |
|---|---|
| Relational Database Management System (MySQL, PostgreSQL, MS SQL Server) | Rewritable Compact Disc (CD-RW) |
| Data Modelling Tool (Lucidchart, EdrawMax, Draw.io) |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Relational Database Management System (MySQL, PostgreSQL, MS SQL Server) | 1 Pc per Candidate |
| 2 | Data Modelling Tool (Lucidchart, EdrawMax, Draw.io) | 1 Pc per Candidate |
| 3 | Rewritable Compact Disc (CD-RW) | 1 Pc per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Create database and tables | |||
| Created database named 'StudentRegistration' (Award 1 mark for correct database creation) | 1 | ||
| Created table 'Students' with fields and appropriate data types (Award 1 mark for each correct field and data type: StudentID integer PK, FirstName varchar, LastName varchar, DateOfBirth date, Email varchar) | 4 | ||
| Created table 'Courses' with fields and appropriate data types (Award 1 mark for each correct field and data type: CourseID integer PK, CourseName varchar, DurationMonths integer) | 3 | ||
| Created table 'Enrollments' with fields and appropriate data types (Award 1 mark for each correct field and data type: EnrollmentID integer PK, StudentID integer FK, CourseID integer FK, EnrollmentDate date) | 4 | ||
| Set primary keys on StudentID, CourseID, EnrollmentID fields respectively (Award 1 mark for each primary key defined) | 3 | ||
| Set foreign key constraints on Enrollments.StudentID and Enrollments.CourseID referencing Students and Courses respectively (Award 1.5 marks for each foreign key constraint) | 3 | ||
| Used consistent naming conventions for tables and fields (Award 2 marks for consistent and meaningful naming) | 2 | ||
| Sub-Total | 20 | ||
| PRODUCT CHECKLIST | |||
| Students table with fields: StudentID (integer, PK), FirstName (varchar), LastName (varchar), DateOfBirth (date), Email (varchar) (Award 3 marks for correct fields, data types, and primary key) | 3 | ||
| Courses table with fields: CourseID (integer, PK), CourseName (varchar), DurationMonths (integer) (Award 2 marks for correct fields, data types, and primary key) | 2 | ||
| Enrollments table with fields: EnrollmentID (integer, PK), StudentID (integer, FK), CourseID (integer, FK), EnrollmentDate (date) (Award 3 marks for correct fields, data types, primary key, and foreign keys) | 3 | ||
| Referential integrity enforced via foreign keys between Enrollments and Students, and Enrollments and Courses (Award 2 marks for correct foreign key constraints) | 2 | ||
| Database structure follows normalization and best design practices (Award 2 marks for normalization and consistent naming) | 2 | ||
| Sub-Total | 12 | ||
| GRAND TOTAL | 32 | ||
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Relational Database Management System (MySQL, PostgreSQL, MS SQL Server etc.) | integer |
| Data Modelling Tool (Lucidchart, EdrawMax, Draw.io etc.) | varchar |
| Rewritable Compact Disc (CD-RW) | date/time |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Relational Database Management System (MySQL, PostgreSQL, MS SQL Server etc.) | 1 Pc per Candidate |
| 2 | Data Modelling Tool (Lucidchart, EdrawMax, Draw.io etc.) | 1 Pc per Candidate |
| 3 | Rewritable Compact Disc (CD-RW) | 1 Pc per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Define Database Keys | |||
| Mapped entities from the ERD into six (6) relations (Award 1 mark per correctly mapped relation, zero if incorrect) | 3 | ||
| Specified attributes for the six (6) relations (Award 1 mark per table for correct attributes with data types) | 6 | ||
| Specified primary keys for the six (6) relations (Award 0.5 mark per correct primary key per table) | 3 | ||
| Specified composite primary keys for the marks and subject-teacher relations (Award 1 mark per correct composite primary key) | 2 | ||
| Enforced referential integrity by specifying foreign keys in the referencing relations (Award 1 mark per correctly defined foreign key with constraints) | 4 | ||
| Printed the relational schema (Award 1 mark for clear, complete printed schema) | 1 | ||
| Sub-Total | 19 | ||
| PRODUCT CHECKLIST | |||
| Created database and six (6) tables with required attributes and data types (Award 2 marks per table created with correct attributes and data types) | 12 | ||
| Enforced entity integrity (primary key) constraints in the six (6) tables (Award 1 mark per table for correct primary key enforcement) | 6 | ||
| Enforced referential integrity (foreign key) constraints in the six (6) tables (Award 1 mark per table for correct foreign key enforcement) | 6 | ||
| Utilized best practices in Database Design: (a) Well normalized relations (b) Consistent naming scheme for relations and attributes (Award 2 marks for normalization, 2 marks for consistent naming) | 4 | ||
| Sub-Total | 28 | ||
| GRAND TOTAL | 47 | ||
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.