Alif Najmi
← Back to Alif Notes · Coursework

A whole company in 49 tables

6 November 2026 · 4 min read

For Data & Information Management, the brief was to design a relational database for an organisation and build it in Oracle SQL. This one models a whole company from the CEO down: every executive, department, project, product and client.

  • 22 entity tables
  • 27 link tables
  • 83 foreign keys
  • 640 rows of test data

How the company is organised

Everyone starts as a row in Employee. A CEO, CFO, COO or CTO is an employee with extra details in their own table, and each department hangs off the executive who runs it.

How the company database is organisedEmployee is the base table. CEO, CFO, COO, CTO, Executive Assistant and Customer Service each extend it. The CFO runs Finance and Treasury, the COO runs Human Resource, PMO and Project, and the CTO runs IT and Computer Engineering.Employeeeveryone starts hereCEOCFOCOOCTOExecutiveAssistantCustomerServiceFinanceTreasuryHuman ResourcePMOProjectITComputerEngineering
From Employee down to the departments. Swipe sideways to see all of it.

Projects tie it all together

Project is the busiest table: it points at eleven others. And whenever two things relate many-to-many, like which client deals with which department, the relationship gets its own link table. There are 27 of those, such as CTO Project and Finance Sale.

Project ties eleven tables togetherProject points to Client, Sale, Marketing, Finance, Treasury, PMO, COO, Customer Service and Executive Assistant, and Product and Service point back to it.Projectthe hubClientSaleMarketingFinanceTreasuryPMOCOOCustomerServiceExecutiveAssistantProductService
Project and the tables around it. Swipe sideways to see all of it.

Try it yourself

This is the real schema and data, rebuilt in SQLite and running in your browser. Pick one of the original queries, open a table, or write your own and press Run (or Ctrl+Enter). Nothing leaves this page, and reloading puts everything back.

Scroll here to load the database.
Browse a table

Bringing it back

The original was written for Oracle, so rebuilding it meant turning Oracle's INSERT ALL … SELECT * FROM dual blocks into plain inserts and its TO_DATE calls into ordinary dates. All 640 rows loaded, and every original join returns the same kind of answer it did then. The people in it were always made up (there's a John Wick in Finance), but I swapped the phone numbers, emails and house numbers for obviously fake ones anyway.

What it taught me

  • Keys first, then everything else. Once every table knew exactly what it pointed at, an eight-table join was just following the arrows.
  • Test data is part of the design. A query only proves something if there are rows that pass the filter and rows that don't.
  • Many-to-many deserves its own table. Link tables felt like overkill at first, and then they were the reason every question had an answer.

It's also where the SQL in everything since started: the SLB data model, and the Postgres behind TaskMatch and the SMK dashboard.

← One VPC, two departments, $56 Jom Al-Quran: 56 tables, back from Oracle →