DEV Community

Kitco Codes
Kitco Codes

Posted on

[SQL] Essential Terms in the Relational Database Model and Characteristics of a relation

Feb 24rd 2025 - part 1

Before starting the post...

Today I learned about terms used when dealing with relational database models and the key characteristics of a relation. I’m the type of person who thinks using a precise word is important, so I’m glad that this is a trait that’s considered desirable for a developer. 😄 It’s 19:33 currently and I’m off to the gym after writing this post!

Why understanding the correct terms is important

Every field has its vocabulary that defines key concepts, and so does the RDBMS. It is crucial to understand the basic terms to get a deeper understanding of RDBMS. They are the building blocks for grasping complex concepts and applying them correctly.

Defining essential terms used in relational database model

A relational database model is a way of organizing and managing data in a database using a structure based on relations and their relationships.

A relationship refers to an association between two or more tables based on common attributes. Relationships are established using foreign keys, which link a column in one table to the primary key of another or the same table.

A relation schema is the structure of the relation. It defines the relation's design, including the names of the columns, the data types for each column, and constraints. But it does not include the actual data.

A Relation instance refers to the specific data currently in that relation at a given time. It represents the actual, concrete data that exists in the relation.

A relation is what we commonly know as a table. Relation includes its structure (schema) and the current data (tuples) stored at a given time. A relation combines the schema (the structure) and the instance (the current set of data).

Intension and Schema are essentially the same. It's a structure of the relation, but not the data itself.
The Extension, however, includes the actual tuples in the table. A set of tuples is the extension of a relation.

Attributes are columns of a relation.
Constraints of a relation are rules enforced to ensure the data's accuracy, consistency, and integrity. They define what is allowed or not allowed in the relation.

Domain refers to the set of valid values an attribute in a relation can hold. It defines the type, range, and constraints for the data that can be stored in that column.

Data typeis a specific category of data, like INT or VARCHAR. But domain is a broader concept that includes data type plus any additional constraints (NOT NULL, UNIQUE), and allowed range of values (ENUM sets).

Degree refers to the number of attributes in a relation. It measures how many fields each tuple contains.

A tuple is a single row in a relation. It's a collection of values that describes a single entity in the relation.

Cardinality refers to the number of tuples in a relation at a given time. If the relation has 50 tuples, the cardinality of that relation is 50. If a relation is empty, its cardinality is 0.

Why understanding the characteristics of a relation is important

To ensure consistency, integrity, and efficiency, a relation must follow specific characteristics that define its structure and behavior. These characteristics establish rules for how data is stored, retrieved, and maintained within the database.

Characteristics of a relation

  1. Each attribute(column) must have a unique name. No two attributes have the same name.

  2. Each tuple is unique. A relation must not have duplicate tuples. The primary key ensures its uniqueness.

  3. Entries in a column are from the same domain. This means that all values in a particular column must follow a consistent set of rules, like data type, constraints and format (an email must contain @).

  4. The order of rows and columns does not matter.
    The rows and columns in a relation have no inherent order. You can rearrange them without changing the meaning of the data. A relation is a set, not a list, so the focus is on the data itself, not its position.

  5. Values in each column must be atomic. This means a single cell should only contain one value.

  6. Each attribute must have a defined domain (data type and constraints).

  7. NULL values are allowed unless restricted. NULL means missing or unknown data.

Top comments (0)