Database Schema

What Is a Database Schema?

A database schema defines the structure of a database, including how data is stored, organised, and managed.

Schemas exist at different levels, from conceptual overviews of data entities to the physical layout of data on disk.

Levels of Database Schema

Conceptual Schema

The conceptual schema represents a high-level view of the data. It defines entities, relationships, and constraints without any concern for how data is implemented in tables or stored on disk.

Example: An ER diagram showing entities like Student, Course, and Instructor, with relationships such as "enrols in" or "teaches".

Conceptual Diagram

Logical Schema

The logical schema translates the conceptual design into a set of normalised tables, fields, and relationships. It provides a blueprint of how data is logically organised for query and manipulation.

Example: A table Students with fields like StudentID, Name, and DateOfBirth, linked via foreign keys to other tables like Enrolments.

Logical Diagram
Students (PK: StudentID)
StudentID Name DateOfBirth
100012Ava Patel2007-04-17
100045Luca Rossi2006-11-03
100078Mina Zhang2007-01-29

Physical Schema

The physical schema describes how data is actually stored on disk. It includes data types, indexes, partitions, and file structures that affect performance and storage efficiency.

Example: A university database stores student records in physical data files on the server. Indexes are created on StudentID and LastName to speed up search queries. The physical schema also defines how data might be compressed.

Physical Diagram

Why Are Database Schemas Important?

  • Data Organisation: Provides a clear and consistent structure for managing data.
  • Scalability: A well-designed schema supports database growth without performance loss.
  • Consistency and Integrity: Ensures data rules are enforced through keys and constraints.
  • Security and Performance: Enables optimised access control and query efficiency.

 Key Takeaways

  • A database schema defines the structure and organisation of data.
  • There are three levels of database schema: conceptual, logical, and physical.
  • Each level has a different purpose-from modelling entities to specifying storage details.
  • Well-designed schemas improve data quality, system performance, and maintainability.