Skip to main content

What is a database schema?

A database schema is a structural description of the entire database, defining how tables, fields, and the relationships between them are organized. It describes not the data itself, but the rules for storing and relating it.

The schema's main components

  1. Tables: the list of every table in the database, each holding a specific kind of information (e.g. "Employees", "Orders").
  2. Fields (columns): characteristics of the records in a table, each column has a data type: text, number, date, and so on.
  3. Keys: a primary key (a unique record identifier) and foreign keys (links to other tables).
  4. Relationships between tables: specifies how tables relate: one-to-one, one-to-many, many-to-many.
  5. Constraints and integrity rules: define valid values, required fields, uniqueness, and consistency of references between tables.

A schema serves as the database's blueprint, helping maintain the data's structure, correctness, and ease of use. It helps you understand how tables relate, where different data lives, and which rules apply when information changes.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.