What is Database Schema?

A database schema describes how a database is organised: its tables, their columns and data types, and how the tables relate to each other.

Database Schema explained

The schema is the blueprint. It says that an orders table has an id, a customer_id and an amount, that amount is a number, and that customer_id points to a row in the customers table.

Anyone writing SQL or building a report needs to understand the schema first, because it tells you what one row represents and which columns can be joined. In some databases 'schema' also means a named folder that groups tables.

Example

The schema for a shop might have customers, orders and order_items tables, with order_items.order_id referring to orders.id.

Asking about it in plain English

With SchemaChat you can type a question about your own data instead of writing a query, and check the SQL and figures it used before you rely on the answer. For example:

  • What tables and columns are in this database?

Frequently asked questions

What is Database Schema?
A database schema describes how a database is organised: its tables, their columns and data types, and how the tables relate to each other.
Can you give an example of Database Schema?
The schema for a shop might have customers, orders and order_items tables, with order_items.order_id referring to orders.id.