2080 7

CSC265 ยท 2080 ยท 5 marks

What is relational model? Define the terms domain, attribute, tuple and relation.

What is relational model? Define the terms domain, attribute, tuple and relation. [5]

Database Management SystemChapter 4: The Relational Data Model and Relational Database ConstraintsRelational Model Concepts

Quick answer

The relational model is a data model that represents data in the form of relations (tables). It was proposed by E.F. Codd and is the foundation of relational database management systems (RDBMS). In this model, all data is logically structured as two-dimensional tables consisting of rows and columns. SQL uses the terms table, row, and column for the formal relational model terms relation, tuple, and attribute respectively.

Relational Model

Definition


Key Terms

1. Domain

A domain is a set of atomic (indivisible) values from which the actual values of an attribute are drawn.

  • Domain constraints specify that within each tuple, the value of each attribute A must be an atomic value from the domain dom(A).
  • Data types associated with domains include:
    • Numeric types: integer, short integer, long integer, float, double
    • Other types: characters, Booleans, fixed-length strings, etc.

Example: The domain of an attribute "Age" could be the set of positive integers.


2. Attribute

An attribute is a named column of a relation that represents a specific property or characteristic of the entity being described.

  • Each attribute A takes values from its corresponding domain dom(A).
  • In SQL, attributes are referred to as columns.

Example: In a Student relation, Sname, Sid, and Address are attributes.


3. Tuple

A tuple is a single row in a relation that represents a single instance or record of the entity.

  • An n-tuple t in a relation r(R) is denoted as:

$$t = \langle v_1, v_2, \ldots, v_n \rangle$$

where $v_i$ is the value corresponding to attribute $A_i$.

  • Both t[Aแตข] and t.Aแตข refer to the value $v_i$ in tuple t for attribute $A_i$.
  • In SQL, tuples are referred to as rows.

Example: <101, "Ram", "Kathmandu"> is a tuple in a Student relation.


4. Relation

A relation is a two-dimensional table with rows and columns used to represent data and the relationships among data.

  • A relation r defined on a relation schema R(Aโ‚, Aโ‚‚, ..., Aโ‚™) is a set of n-tuples.
  • Each tuple in the relation contains one value for each attribute drawn from its domain.
  • A relation must satisfy integrity constraints such as domain constraints, key constraints, and referential integrity constraints.
  • In SQL, a relation is referred to as a table.

Example:

SidSnameAddress
101RamKathmandu
102SitaPokhara

This table is a relation with 2 tuples and 3 attributes.


Summary Table

Formal TermSQL EquivalentMeaning
RelationTableThe entire two-dimensional table
TupleRowA single record in the table
AttributeColumnA property/field of the relation
DomainData TypeSet of valid values for an attribute

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.