Why Good Databases Never Rely on Memory Alone
Why giant spreadsheets quickly cause errors, how splitting tables stops duplicate mistakes, and why combined reports sometimes double-count totals.
Why Giant Spreadsheets Break Down
Everyone has seen a spreadsheet where a single row holds a team's name, an employee's salary, a cloud hosting bill, and two contact notes all jammed beside one another. It works for five rows. The week a second cloud service or a second employee joins that department, things quietly fall apart.
Suddenly someone changes a department's name in one row and forgets to change it in three other rows. Worse, running a total column starts adding numbers twice or three times without giving any warning message.
Letting the Database Enforce the Rules
In engineering-ops-db, instead of trusting application code or manual discipline to keep data tidy, rules sit right inside the database structure itself:
- Every entity lives in its own focused table: departments, employees, cloud services, and incidents each get separate storage.
- Foreign keys check that no employee or bill can point to a department code that does not exist.
- Simple range checks ensure a negative salary or invalid email format gets rejected the moment someone tries to save it.
Moving validation into storage means even if three different scripts update the same file at different times, the underlying numbers stay consistent.
The Quiet Double-Counting Bug
The most surprising trap in database reporting happens when you join two unrelated lists at the same time. Imagine the Engineering department employs 2 people and pays for 3 separate cloud tools.
If you ask the database to fetch departments, staff, and cloud tools all in a single flat query, SQL matches every staff member with every cloud tool — producing 6 rows for a single team! If you ask for SUM(salary) across those 6 rows, both salaries get counted three times over, inflating payroll by 3x even though zero errors occurred.
-- Summing each group separately before combining keeps every total exact
WITH staff_totals AS (
SELECT department_id, COUNT(*) AS headcount, SUM(salary_gbp) AS payroll_gbp
FROM employees
GROUP BY department_id
),
tool_totals AS (
SELECT department_id, SUM(monthly_cost_gbp) * 12 AS annual_cloud_gbp
FROM cloud_services
GROUP BY department_id
)
SELECT d.name, s.headcount, s.payroll_gbp, t.annual_cloud_gbp
FROM departments d
LEFT JOIN staff_totals s ON s.department_id = d.id
LEFT JOIN tool_totals t ON t.department_id = d.id;Clear Structure Beats Clever Fixes
Summarising staff in one temporary table and cloud costs in a second before joining them together guarantees there is only ever one row per department. The maths becomes effortless to inspect by eye, and finance numbers stay trustworthy regardless of how many rows sit inside each list.