Relational Model Concepts

 

Relational Model Concepts

The relational model represents a database as a collection of relations (tables). Each relation consists of rows and columns, where each row represents a real-world fact about an entity or a relationship.


1. Domain

A domain is a set of atomic values from which attribute values are drawn.

  • Atomic means indivisible within the relational model.

  • Each domain has:

    • A name

    • A data type

    • A format

    • (Optionally) units of measurement

Examples of Domains

  • Names → character strings

  • Social_security_numbers → 9-digit strings

  • USA_phone_numbers → (ddd)ddd-dddd

  • Grade_point_averages → real numbers between 0 and 4

  • Employee_ages → integers between 15 and 80


2. Attribute

An attribute is a named role played by a domain in a relation.

  • Each attribute has:

    • A name

    • A domain

Example:

dom(Ssn) = Social_security_numbers dom(Gpa) = Grade_point_averages

The same domain may be used for multiple attributes (e.g., Home_phone and Office_phone).


3. Relation Schema ( Intension)

A relation schema defines the structure of a relation.

Definition

A relation schema is denoted as:

R(A1, A2, ..., An)

where:

  • R = relation name

  • A1, A2, ..., An = attributes

Degree (Arity)

  • The degree of a relation = number of attributes

Example

STUDENT(Name, Ssn, Home_phone, Address, Office_phone, Age, Gpa)

This relation has degree 7.


4. Relation (Relation State-Extension)

A relation (also called a relation state) is a set of tuples that conforms to a relation schema.

Formal Definition

If R(A1, A2, …, An) is a relation schema, then:

r(R) ⊆ dom(A1) × dom(A2) × … × dom(An)
  • A relation is a subset of the Cartesian product of its attribute domains.

  • The relation state changes over time, but the schema is relatively static.


5. Tuple

A tuple is a single row in a relation.

Definition

A tuple is an ordered list:

t = <v1, v2, …, vn>

where each vidom(Ai) or is NULL.

Accessing Tuple Values

  • t[Ai] or t.Ai → value of attribute Ai

  • t[A1, A3] → subtuple of selected attributes

Example:

t = <'Barbara Benson', '533-69-1238', '(817)839-8461', '7384 Fontana Lane', NULL, 19, 3.25>

t[Name] = 'Barbara Benson' t[Ssn, Gpa, Age] = <'533-69-1238', 3.25, 19>

6. Characteristics of Relations

6.1 Ordering of Tuples

  • Tuples are unordered

  • Relations are mathematical sets

  • Different row orders represent the same relation


6.2 Ordering of Attributes

  • Attribute order is logically insignificant

  • Alternative definition treats a tuple as a set of:

(Attribute, Value) pairs

This leads to self-describing data.


6.3 Atomic Values and First Normal Form (1NF)

  • All attribute values must be atomic

  • Composite and multivalued attributes are not allowed

  • Multivalued attributes must be represented using separate relations


7. NULL Values

NULL represents:

  1. Value unknown

  2. Value exists but not available

  3. Attribute does not apply

Example

  • Office_phone = NULL → student has no office

  • Home_phone = NULL → unknown or unavailable

  • Visa_status = NULL → apply to foreign students only

⚠ NULLs introduce ambiguity and should be minimized during design.


8. Interpretation of a Relation

8.1 As Facts

  • Each tuple represents a real-world fact

  • Relation schema represents a general assertion

Example:

STUDENT(Name, Ssn, Age, Gpa)

asserts that students have these properties.


8.2 Relations Represent Both:

  • Entities (e.g., STUDENT)

  • Relationships (e.g., MAJORS(Student_ssn, Dept_code))


8.3 Predicate Interpretation

  • A relation can be seen as a predicate

  • Each tuple makes the predicate true

  • Uses the closed world assumption:

    • Only stored facts are true


9. Relational Model Notation (Summary)

  • R(A1, A2, …, An) → relation schema (use  uppercase letters for schema)

  • r(R) → relation state (use lowercase letters)

  • t → tuple

  • R.A → qualified attribute name

  • t[A] → attribute value in tuple


10. Key Takeaway

The relational model:

  • Represents data using relations

  • Ensures simplicity, mathematical rigor, and data independence

  • Forms the foundation of relational databases and SQL

Comments

Popular posts from this blog

Database Management Systems DBMS PCCST402 Semester 4 KTU CS 2024 Scheme

Data Models, Schemas and Instances

Introduction to Database Management System -DBMS