Tags:conceptdatabaserelationalmodel Status:🟩
Relational Model
Summary
The relational model is a formal data model based on Set Theory and Predicate Logic. It uses tables (relations) to represent data and their relationships. Each table consists of records (rows/tuples) and attributes (columns).
Details
The Relational Data Model is a framework for structuring data into tables, and represents how data is stored in Relational Databases. A relational database consists of a collection of tables, each of which is assigned a unique name. Each table consists of records and attributes.
When a database uses the relational model, it becomes a collection of tables. The relational model operates within the Three-Layer-Architecture.
Relational Database Management Systems
The relational Database Management System (RDBMS) is a type of DBMS that implements the Relational Data Model. It provides the software framework for managing, querying and manipulating relational databases.
SQL
Structured Query Language (SQL) is the standard language used to interact with relational databases. It allows users to perform various operations on the data in an RDBMS. There are 2 types of SQL languages:
- SQL DDL: Defines and manages the schema of the database.
- SQL DML: Handles data manipulation within the database.
SQL Schema
(Specific implementation of database schema using SQL). An SQL schema defines the logical structure of a relational database, including tables, columns, data types, and relationships between them. It outlines how data is organized and how integrity constraints, such as primary keys and foreign keys are applied. The schema serves as the blueprint for the relational database, guiding how data is stored and accessed.
Keys
In relational databases, keys are essential for uniquely identifying records and establishing relationships between tables. A primary key uniquely identifies each record within a table and ensures no duplicate values exist in that column. A foreign key links records between tables by referencing the primary key of another table, establishing relationships and maintaining referential integrity. See also: Database Keys and Relationships.
Relation Pros and Cons
Pros:
- It’s a very simple model.
- It’s how we typically think about structured data.
- It’s the conceptual model behind SQL, which is the most important query language today.
Cons:
- It can be too simple for some data like sound files.
- Much of today’s data is NOT structured (i.e. deep leaning).
- It could be complex to implement.
Examples
A database scheme
Students (SID : INT, Name : STRING, Email : STRING, Semester : INT)
Faculty (FID : INT, Name : STRING, DID : INT)
Courses (CID : STRING, Name : STRING, DID : INT)
Departments (DID : INT, Name : STRING)
Transcripts (CID : STRING, SID : INT, Grade : STRING, Comment : STRING)