Instances and Schemas in Database Management

Sep 10, 2024

Lecture Notes on Instances and Schemas

Introduction

  • Focus on two important terminologies in database management systems: Instances and Schemas.

Analogy of Software Programming

  • Software Development: Involves programming languages.
  • Variables: Defined by programmers (e.g., variable a).
  • Variable Value:
    • Holds a value that can change (e.g., a = 20).
    • The variable type determines the structure and size (e.g., integer type in C = 2 bytes).

Understanding Schemas

  • Definition of Schema: Overall design of a database.
  • Database: A collection of tables.
  • Table: Data organized in rows and columns.
  • Example: Banking database consists of multiple tables like customer, accounts, loans, etc.
  • Relation to Analogy:
    • Database schema = variable declaration (the structure is fixed).
    • Changes to data in tables do not often affect schema.

Characteristics of Schema

  • Once a schema is fixed, it is not frequently changed.
  • Changes are possible but require database administrator intervention.
  • Type Definition Example:
    • Student Record Structure:
      • Role number (numeric, max size 5)
      • Name (char, max size 25)
      • Class (char, max size 10)

Real-time Example: University Database

  • Department Table: Fields include department name, building, budget, head of department.
  • Course Table: Fields include course ID, title, department name, credits.
  • Student Table: Fields include role number, name, department name, total credits.

Data Abstraction

  • Hides the complexity of physical storage from programmers.
  • Database administrators have additional responsibilities and knowledge of physical organization.

Understanding Instances

  • Definition of Instance: Collection of interrelated data at a particular moment.
  • Database Change: Data can be added or deleted, leading to changes in instances.
  • Example: University database with changing student records (e.g., new admissions).
  • Relation to Analogy:
    • Database instance = value of a variable that keeps changing.

Levels of Abstraction in Databases

  1. View Level: Sub-schemas exist at this level.
  2. Logical Level: Logical schema of the database.
  3. Physical Level: Actual physical storage of data.

Conclusion

  • Understanding schemas and instances is crucial for database management.
  • Thank you for participating in the presentation.