03aSchemas

Database Management

Mick McQuaid

University of Texas at Austin

12 May 2026

Database Schemas

  • We have said that a relational database is structured. How?
  • A schema is a description of the structure of a database
  • A schema must touch on all the structures in the database
    • Tables
    • Columns
    • Data Types
    • Primary Keys
    • Foreign Keys
    • Constraints
    • Indexes

Tables

We’ve already talked about tables and can think of a table as a collection of entity instances, where each entity instance is described by a row

Columns

We can think of a column (also known as a field) as an attribute of an entity

Data Types

  • Every piece of data has a type, such as text, number, or date
  • We’ll discuss data types in the next video

Primary Keys

  • A primary key is a set of columns that uniquely specify a row in a table
  • This is how we tell one row from another
  • It’s also why every row in a table is unique
  • We’ll discuss primary keys next week

Foreign Keys

  • When data in one table refers to data in another table, there has to be a way to specify a row in the other table
  • The foreign key is that way
  • We’ll discuss foreign keys next week

Constraints

  • Constraints specify rules for columns
  • Such as “the value must be unique” or “the value can not be NULL” or “the value must be positive”
  • The dbms will raise an error if you try to enter data that violates a constraint

Indexes

  • We use indexes without needing to understand them except for the following
  • An index applies to a column
  • An index greatly speeds up searching for a cell in a column

Self description

  • We have said that a database is self-describing
  • This means that the schema is a set of tables associated with the rest of the database
  • So a database has tables that describe things in the real world plus tables that contain metadata, that is, data about the data in the database

END

Colophon

This slideshow was produced using quarto

Fonts are Roboto, Roboto Light, and Victor Mono Nerd Font