Schema (Database Schema)

Schema (Database Schema) image
A database schema defines how data is organised within a relational database. The schema includes table names, fields, data types and the relationships between these entities. Schemas and entity relationship diagrams act as valuable documentation and should be used by testing professionals to ensure data can be used by stakeholders, duplication is not introduced and the systems that utilise the database are as performant as possible.
The definition schema given by Emily O'Connor is the most common meaning of the word schema in the context of databases, including relational databases.

There is another meaning for schema, also in the context of relational databases, which can be confusing.  In this other meaning, a schema is a container of database tables, views etc., and so acts as a way of sub-dividing the things in a database instance.  A database instance is something with a connection string, that you can log into.  Within that will be one or more schemas, each of which will contain zero or more tables etc.  On Microsoft SQL Server databases the default schema is dbo, which is short for database owner.

There are a few reasons why you might choose to have more than one schema in a database:
  • Schemas can divide tables up into groups of related tables, e.g. relating to different features of the associated software. This is particularly useful when the database grows to have many tables.  The advantages of using schemas rather than separate databases include the fact that transactions and foreign key relationships can reach from one schema to another, but can't (easily) span from one database to another.
  • Permissions can be granted at the schema level, so that e.g. a user can be given read access to all tables in one schema but not to a different schema in the same database instance.
  • Database table names must be unique within a schema, but you can reuse a table name if each table with that name is in a different schema.

In SQL Server, the full version of a database table's name (or other database object such as a view) has four parts:
Server.Database.DatabaseSchema.DatabaseTable
Other databases, such as Postgres, can have different full name formats but will usually include the schema name.

  • Server is the database server, i.e. one running instance of the database software, and not the physical or virtual machine it runs on.
  • Database is the database instance - one database server can host one or more database instance.  Each database instance has a separate connection string.
  • Database schema e.g. Finance
  • Database table e.g. MonthlyPaymentSummary

Explore MoT
MoTaCon 2026 image
Thu, 1 Oct
Previously known as TestBash, MoTaCon is the new name for our annual conference. It's where quality people gather.
MoT Software Testing Essentials Certificate image
Boost your career in software testing with the MoT Software Testing Essentials Certificate. Learn essential skills, from basic testing techniques to advanced risk analysis, crafted by industry experts.
Into The Motaverse image
Into the MoTaverse is a podcast by Ministry of Testing, hosted by Rosie Sherry, exploring the people, insights, and systems shaping quality in modern software teams.
Subscribe to our newsletter
We'll keep you up to date on all the testing trends.