Understand Data Models and the Objectives of Relational Model
History of the Relational Model
Terminology of Relational Model
Data Representation in Relational Model
Properties of Database Relations
Identifying Relational Keys
Candidate Keys
Primary Keys
Foreign Keys
Integrity Rules
Entity Integrity
Referential Integrity
Components of a Data Model:
Structural Part: Rules for constructing databases.
Manipulative Part: Defines allowed operations on data.
Integrity Rules: Ensures data accuracy.
Definition: Integrated collection of concepts for describing data, relationships, and constraints.
Purpose: To represent and clarify data understanding.
Types of Data Models:
External Model: User-specific view.
Conceptual Model: Logical community view, independent of DBMS.
Internal Model: Physical representation for DBMS understanding.
Hierarchical Model: Used tree structures for parent/child relationships.
Network Model: Also record-based, relationships represented by sets.
Proposed by: Edgar Codd in 1970.
Key Features:
Based on 2D tables, set theory, and relational algebra.
Logical design decoupled from physical implementation.
Dominant data-processing software today (RDBMS).
Data Independence: Applications unaffected by internal data representation changes.
Consistency and Redundancy Management: Introduction of normalisation.
Use of Set-oriented Data Manipulation Languages.
Relation: A table with rows and columns.
Attributes: Named columns (can appear in any order).
Tuples: Rows in a relation.
Degree of a Relation: Number of attributes.
Cardinality: Number of tuples.
Three Levels of Abstraction:
External Level: Users' specific views of the database.
Conceptual Level: Community view of stored data and relationships.
Internal Level: Physical data storage representation.
Notes: One conceptual/internal level but multiple external views.
Domain: Set of allowable values for an attribute.
Examples:
BranchNo: Range B1-B999, (varchar, size 4)
Street: UK street names, (varchar, size 25)
City: UK city names, (varchar, size 15)
etc.
Relation: Table, File
Tuple: Row, Record
Attribute: Column, Field
Uniqueness: Each relation must have a unique name.
Distinct Names: Attributes must have distinct names within a relation.
Same Domain: Values must come from the same domain.
Order Irrelevance: Order of attributes and tuples is insignificant.
Atomic Values: Each cell contains one value; no multiple values allowed.
Distinct Tuples: No duplicate tuples allowed.
Definition: Attributes that uniquely identify each tuple.
Issue: May contain unnecessary (redundant) attributes.
Minimal Superkey: Must uniquely identify a tuple without unnecessary attributes.
Examples: BranchNo is a candidate key, while (BranchNo, Postcode) is not.
Uniqueness: No two rows can have the same key values.
Irreducibility: Cannot remove attributes without losing identification.
Definition: A candidate key selected to uniquely identify a tuple in a relation.
Example: BranchNo as Primary Key in the BRANCH relation.
Definition: Candidate keys not selected as Primary Key.
Example: NatInsNo as an alternate key in STAFF relation if StaffNo is the primary key.
Definition: An attribute in one relation that matches a candidate key in another relation.
Purpose: Establishes relationships between tables; allows duplicates if it references a PK.
Integrity Constraints: Ensure data accuracy in the relational data model.
Types of Integrity Rules:
Entity Integrity: Primary key must be unique and not null.
Referential Integrity: Validates relationships between foreign keys and corresponding primary keys in linked tables.
Definition: Represents unknown or non-applicable values.
Difference: Null is not the same as zero or empty string.
Understanding of data models, relational model properties, relational keys, entity integrity, and referential integrity is crucial.