| Lesson 4 | Characteristics of Database Tables |
| Objective | Describe the characteristics of relational tables and how they map to implementation in an RDBMS. |
A relational table has named columns, rows at a defined grain, data types, and constraints. Keys identify rows and connect related tables. Unlike a spreadsheet display, its query results have no guaranteed order without ORDER BY. The examples below connect these characteristics to a computer-inventory schema.
A relational database is a collection of tables. Each table has two parts: a heading that defines the table name and column names, and a body that holds the rows of data. Columns store attributes - the properties of the entity the table represents. Rows store records, each of which is an instance of that entity. In relational theory, a row is called a tuple, and the table itself is called a relation.
Understanding the distinction between the relational theory vocabulary - relation, tuple, attribute - and the practical vocabulary - table, row, column - is important because both sets of terms appear in database documentation, textbooks, and RDBMS tools. They are closely related, but SQL tables can contain duplicates and NULLs unless constraints restrict them; a mathematical relation is a set of tuples, as discussed in Lesson 3.
During the logical design phase of the DBLC, entities in an ER diagram are represented as relations using relational notation. When the design moves to the implementation phase, the RDBMS creates a physical table corresponding to each relation. The mapping from logical design to physical implementation should be consistent: table names, column names, data types, primary keys, and foreign keys should all carry directly from the relational notation into the CREATE TABLE statement.
A key design principle is integrity by default: constraints should be defined in the database schema so that the RDBMS rejects invalid data at write-time. Relying on application code to enforce data validity after the fact is fragile - a second application accessing the same database may not apply the same rules. Enabled, enforced constraints protect writes from different applications. Administrators can disable some constraints, so their validation and enforcement state must also be managed.
Keys are the mechanism by which rows in a table are identified and linked to rows in other tables. Three types of keys are relevant to table design:
Each column in a table has a data type that constrains the values it can hold. Choosing appropriate data types is part of physical design and has implications for both data integrity and storage efficiency.
DATE or TIMESTAMP columns rather than strings for date and time
values. Storing dates as strings makes range queries fragile and prevents the RDBMS from representing valid date values.INT, DECIMAL) rather than strings for quantities,
prices, and counts. Numeric types allow arithmetic operations and range comparisons without relying on repeated conversion of strings.A null value in a relational database represents the absence of a known value - it is not zero, not a placeholder. Many systems distinguish NULL from an empty string; Oracle treats a zero-length character string as NULL. Null values require careful handling because comparisons involving null produce a third logical state (unknown) rather than true or false.
Allow null values only in columns where the absence of data is semantically meaningful - for example,
a DateTerminated column for an employee who is still active. For all other columns, enforce
NOT NULL to guarantee that critical data is always present. A common source of data quality
problems is columns left nullable by default when they should always contain a value.
Normalization is the process of organizing a relational schema to minimize data redundancy and eliminate update, delete, and insert anomalies. The standard normal forms provide a systematic approach:
Design to 3NF or BCNF as a default. Denormalize only when there is a measured, documented performance requirement that normalization cannot satisfy - and document the denormalization explicitly so future maintainers understand why the schema departs from the normal form standard.
Not all tables in a relational database are stored on disk. The distinction between base tables and virtual tables is fundamental to understanding how a relational database is organized.
A base table stores rows rather than merely defining a query; persistence and storage depend on its type and DBMS. Its rows are stored in the database and occupy storage space. When you execute an INSERT, UPDATE, or DELETE statement, you are modifying the data in a base table. Base tables are the primary source of data in the relational model.
A virtual table, most commonly implemented as a view, is derived at query time. A view stores only its definition - a SELECT statement - and produces its result set by executing that query against the underlying base tables each time the view is referenced. The data displayed by a view is not stored separately; it is computed on demand.
Views serve three important purposes in a well-designed database:
The Computer table illustrates the characteristics described in this lesson. In relational notation:
Computer (Comp_ID, Processor, HardDrive, Monitor, Purchased, Cost)
The table has one relation name (Computer), one primary key (Comp_ID), and five non-key attributes. Each row represents a single computer instance. The following sample data demonstrates the structure:
| Comp_ID | Processor | Hard Drive | Monitor | Purchased | Cost |
|---|---|---|---|---|---|
| 001 | Intel Core Ultra 9 | 2 TB SSD | 27" 4K | 2026-02-01 | 1899.99 |
| 002 | AMD Ryzen 9 AI | 4 TB SSD | 32" 5K | 2026-02-01 | 2899.99 |
Applying the concepts from this lesson to this table:
DATE type, not a string, to support
date range queries and represent valid date values; display formatting is a separate concern.DECIMAL(10,2) to support accurate financial
calculations and avoid binary floating-point representation error for stored amounts; calculations still need an explicit rounding policy.This illustrative SQL makes the inventory rules explicit. The identifiers use text so leading zeros are preserved.
CREATE TABLE Computer (
Comp_ID VARCHAR(10) PRIMARY KEY,
Processor VARCHAR(100) NOT NULL,
HardDrive VARCHAR(100) NOT NULL,
Monitor VARCHAR(100) NOT NULL,
Purchased DATE NOT NULL,
Cost DECIMAL(10,2) NOT NULL CHECK (Cost >= 0)
);
The key rejects another computer with the same identifier. The cost rules reject NULL and negative amounts, but do not verify a purchase receipt. A table can enforce only the rules actually expressed in its schema. Adding an index may change access speed; it does not change the meaning of one row.
Once a table is defined and populated, how it is accessed and maintained affects both performance and data quality over the operational life of the database.
Mouse over each term for its definition:
Test your understanding of relational table characteristics before moving to the next lesson:
Relational Table Characteristics - Quiz