Relational Database Fundamentals: Entities and Attributes
Classified in Computers
Written on in
English with a size of 2.93 KB
Core Concepts: Domain, Attribute, and Entity
Domain: A set of values of any simple or elemental type which can represent the possible values a variable takes for a characteristic or property (attribute) of a representable object (entity).
Attribute: Anything capable of taking a value (data) within a domain (range of possible values). Attributes sharing the same domain are typically given the same or similar names to avoid confusion.
Entity: Anything that can hold a set of attributes with occurrences in the universe. Each occurrence is assigned values for each attribute. More formally, an entity is a set of attributes A1, A2, ..., An, taking values in their respective domains D1, D2, ..., Dn.
Understanding Relationships and Relations
A relationship can be considered a set of occurrences of an entity. An occurrence of an entity is formed by an occurrence of each of its constituent attributes. For efficiency or specific properties, certain restrictions are required on entity occurrences to be considered relations. A relation R consists of:
- A header: A set of attributes A1, ..., An with domains D1, ..., Dn.
- A body: The body of the relation R is a subset of the Cartesian product of the domains of its attributes: R ⊆ D1 × ... × Dn.
Any relationship defined this way can be represented in a Flat Table. Each element is an n-tuple (tuple) or occurrence.
Key Characteristics of Relations
- Grade (Degree): The number of attributes (columns).
- Cardinality: The number of occurrences (rows).
- Uniqueness: No two identical rows or two identical columns exist.
Fundamental Properties of Relations
- No duplicate tuples: There is a handle that makes each occurrence unique. This identifier, consisting of a field or set of fields, is called the primary key.
- No required order: There is no required order for occurrences or attributes. The concept implies a lack of management-imposed ordering, which distinguishes a relation from a table where an order might be established.
- Atomic values: Attribute values are atomic. That is, each element of the table is a single value and cannot contain another relationship. This is the first condition of normalization imposed to avoid manipulation complexity.
A relationship can be considered a table. Usually, a relationship does not need to be standardized, but it is always possible to find an equivalent relationship if they are standardized.