What is a database schema?
brandon

brandon @burcs

About: Building outerbase.com

Location:
remote
Joined:
Oct 8, 2020

What is a database schema?

Publish Date: Jan 20
41 8

I remember the first time I heard someone mention a “database schema.” It feels like forever ago now... I was working on a side-project, trying to spin up a backend based on some of my spreadsheets and some .txt files, and it felt overwhelming. I kept thinking there had to be a better way to organize everything. That’s when my buddy told me: “Sounds like you need a proper database with an actual schema.” Let me tell you, they were right.

messy desktop folder files

What is a database schema?

At its heart, a database schema is just a map, or a blueprint, showing how your data fits together. It describes which tables exist, how columns are named, and how tables relate to one another. When you have a schema, you don’t have to dig around to figure out what data goes where; the schema spells that out for you.

If you’ve ever faced a folder stuffed with random files, you know how confusing unorganized data can be. A schema fixes that problem by defining how information fits together.

Schema on Read vs. Schema on Write

You’ll come across two terms when people talk about schemas:

Schema on Write:
You define the schema before storing the data. It forces data to be structured right from the start.

Schema on Read:
You load raw data with minimal structure and only apply a schema later, like when you query it. This can be flexible, but sometimes you end up wrestling with messy data at query time.

Each method has its place. If you need fast and reliable queries, or your data often comes in a predictable format, schema on write can be a lifesaver. But if you’re dealing with sprawling datasets where structure changes quickly, schema on read might fit better.

Common ways to organize your data

Relational Model
Picture rows and columns bound together by relationships. This is a standard approach in most well-known database systems.

Star Schema
A central “fact” table sits in the middle, surrounded by “dimension” tables. Facts are typically numbers (like sales figures), while dimensions describe context (like product name or date).

Snowflake Schema
Like a star schema, but with more branching in the dimension tables. It can give you deeper detail but increase complexity.

Hierarchical Model
Data arranged in a tree. Each node can have child nodes branching off. Great if your data naturally forms a hierarchy, like store departments and sub-departments.

Flat Model
All data goes into a single table, which might be fine for small projects but becomes unruly as you grow.

Network Model
Links data in a graph of nodes, allowing more complex connections. Less common today, but it can handle many-to-many relationships nicely.

How to design database schemas

Designing a schema starts with conversations. Ask people: “What data do you have?” “What questions do you need answered?” That set of questions guides the tables, columns, and the relationships you’ll build. Once you start drafting a schema, feedback loops are key. You bounce the design off others, add missing tables, or clarify fuzzy logic. Sometimes you draw it on a whiteboard or use a modeling tool.

Once the blueprint feels right, you build the actual database. You load the data, run some test queries, and see if everything behaves. If something’s slow or doesn’t logically fit, you tweak it.

simple database schema design

Best practices for database schemas

Use Clear Names
Call a date field OrderDate if it tracks orders, not just “Date.” It might seem obvious, but clarity saves headaches later.

Normalize (But Not Too Much)
Normalization helps you avoid repeating data (like storing a customer’s address in ten different places). It also keeps things tidy, but you do want to allow enough duplication to maintain speed and usability.

Plan for Security
Some data is private—store login info or personal details in a secure table. Limit who can edit production data. It’s small details like these that keep you safe.

Document Everything
When you add a new table, write a sentence or two about what it’s for so new team members (or your future self) can quickly get up to speed.

Two main kinds of database schemas

Logical Schema
Shows you the logical arrangement of data: which tables are there, what columns they have, and how they link together.

Physical Schema
Works behind the scenes, revealing how data is actually stored on disk or in memory. You usually don’t have to stress over the exact storage mechanism — your database handles that.

Why it's worth it

Good schemas are like well-designed city streets: you can navigate easily, and you don’t get stuck in endless detours or dead ends. It’s rarely fun to wade through disorganized data. With a database schema, you see pattern and purpose rather than chaos. You gain faster queries, fewer inconsistencies, easier collaborations, and a system you can grow.

city streets san francisco planned vs rome unplanned

Should you use a database schema?

When I first discovered database schemas, they felt like an extra chore. But I quickly realized they were the only thing standing between me and the kind of data breakdown that leaves you frustrated and confused. With the right schema, you can unlock the full power of your data—whether that’s for a personal project or a large-scale application.

So if you find yourself drowning in a sea of spreadsheets or puzzling over how to connect different pieces of information, take a moment to build a schema. You’ll thank yourself later.

Comments 8 total

  • Jonas Scholz
    Jonas ScholzJan 20, 2025

    Nice post! How did you create those schema diagrams? They look clean

    • brandon
      brandonJan 20, 2025

      thanks I'm actually using my own project outerbase which automatically generates the ORM based off of my databases.

  • Aaron Reese
    Aaron ReeseJan 22, 2025

    Schema also has another context, especially in MSSQL and Oracle. Is is a further sub-division of the database that prefixes the table and other objects and allows for setting of general permissions across objects at schema level and provides context to those objects: sales.orders as opposed to purchase.orders or production.orders

    • brandon
      brandonJan 22, 2025

      Good point that's very true — it also makes the naming convention even more confusion schema.table.schema haha!

      • Aaron Reese
        Aaron ReeseJan 25, 2025

        Actually it is instance.database.schema.table.field 😱

  • Kamal Hinduja
    Kamal HindujaJan 22, 2025

    Thanks for sharing important information.

  • Jotty John
    Jotty JohnJan 23, 2025

    Nice and Well explained!

  • Aaron Reese
    Aaron ReeseJan 25, 2025

    Re: Normalise (but not too much)
    If your database is recording transactional data (think order processing, accounts, production line etc) then your database should be in at least 3rd Normal Form. This prevents duplication of data and helps to define business entities correctly. It sacrifices some read speed in favour of write speed. You don't store anything that can be calculated (e.g. customer balance can be calculated from summing unpaid orders: you don't store the balance as you would have to update it every time an order was created, cancelled, amended or paid)
    If your database is used for reporting or analytics then duplication of data is allowed, and so it pre-calculated values (sales total by product by territory by month by customer type)
    The first database type is known as OLTP (on line transaction processing), the second as OLAP (on line analytical processing). If you are not sure, go with the first as it is easier to migrate data from OLTP to OLAP than the other way around.

Add comment