The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Concepts 2440: 180 Database Concepts Instructor: Enoch E. Damson
2The Relational Model: Concepts The Relational Model E. F. Codd of IBM originated the relational model approach in the 1970s E. F. Codd of IBM originated the relational model approach in the 1970s Has been the predominant method for data storage Has been the predominant method for data storage The central data description construct is a table (called “relation” by Dr. Codd) The central data description construct is a table (called “relation” by Dr. Codd)
3The Relational Model: Concepts Advantages of the Relational Model Logical and physical characteristics of a database are separated Logical and physical characteristics of a database are separated Model is simple and easy to understand Model is simple and easy to understand Powerful operators to enable complex operations to be executed with simple commands Powerful operators to enable complex operations to be executed with simple commands Design of Database is simple Design of Database is simple
4The Relational Model: Concepts Relational Databases Collection of relations (tables or entities) Collection of relations (tables or entities) Records (rows or tuples) contain data about entities Records (rows or tuples) contain data about entities Attributes (columns or fields) contain data about properties of the entities Attributes (columns or fields) contain data about properties of the entities Relationships are common columns in two or more tables Relationships are common columns in two or more tables Order of rows and columns is unimportant Order of rows and columns is unimportant Repeating groups are not permitted Repeating groups are not permitted Entries with repeating groups are unnormalized Entries with repeating groups are unnormalized
5The Relational Model: Concepts Relation Two dimensional table in which: Two dimensional table in which: Entries are single-valued Entries are single-valued Each column (field or attribute) has a distinct name Each column (field or attribute) has a distinct name All values in a column represent the same attribute All values in a column represent the same attribute Order of columns is immaterial Order of columns is immaterial Each row (record or tuple) is distinct Each row (record or tuple) is distinct Order of rows is immaterial Order of rows is immaterial
6The Relational Model: Concepts Schema Database structure representation Database structure representation Description of a database (in terms of a data model) Description of a database (in terms of a data model) Relational model schema for a relation specifies: Relational model schema for a relation specifies: Name of the relation Name of the relation Name of each field (attribute or column) Name of each field (attribute or column) Type of each field Type of each field
7The Relational Model: Concepts Schema Representation Write the name of the table followed by a list of all columns (and column types) within parentheses Write the name of the table followed by a list of all columns (and column types) within parentheses E.g., Students (sid: char, name: char, login: char, age: integer, gpa: numeric) E.g., Students (sid: char, name: char, login: char, age: integer, gpa: numeric) Underline unique key (primary key) Underline unique key (primary key) Each table should appear on its own line Each table should appear on its own line Use the notation, tablename.columnname, with duplicate column names within a database Use the notation, tablename.columnname, with duplicate column names within a database Using this combination qualifies column names Using this combination qualifies column names
8The Relational Model: Concepts View (Subschema) Subset of a schema Subset of a schema Benefits of views include: Benefits of views include: Making databases simpler Making databases simpler Securing information Securing information
9The Relational Model: Concepts Other Relational Model Terminologies… Normalization – disallowing repeated groups in a table Normalization – disallowing repeated groups in a table Normalized relation – has no repeating groups Normalized relation – has no repeating groups Unnormalized relation – allows repeated groups Unnormalized relation – allows repeated groups Query – an approach that helps obtain information from a database Query – an approach that helps obtain information from a database Data Definition Languages (DDLs) - approaches to data definition Data Definition Languages (DDLs) - approaches to data definition E.g. Structured Query Language (SQL) E.g. Structured Query Language (SQL) Data Manipulation Languages (DMLs) - approaches to data manipulation Data Manipulation Languages (DMLs) - approaches to data manipulation E.g. Query-by-Example (QBE), Relational Algebra, SQL and Relational Calculus E.g. Query-by-Example (QBE), Relational Algebra, SQL and Relational Calculus Structured Query Language (SQL) – the language that defines and manipulates relational databases Structured Query Language (SQL) – the language that defines and manipulates relational databases Entity-Relationship Diagram (ERD) - diagram that visually represents database structure Entity-Relationship Diagram (ERD) - diagram that visually represents database structure
10The Relational Model: Concepts Other Relational Model Terminologies Integrity Constraint – rules applied to a DBMS to perform specific functions on a database Integrity Constraint – rules applied to a DBMS to perform specific functions on a database There are several types of key constraints: There are several types of key constraints: Primary key Primary key Composite key Composite key Candidate keys Candidate keys Surrogate key (synthetic key) Surrogate key (synthetic key) Foreign key Foreign key
11The Relational Model: Concepts Types of Key Constraints Primary key – the column (or collection of columns) that uniquely identifies a given row in a table Primary key – the column (or collection of columns) that uniquely identifies a given row in a table Composite key – a primary key with two or more fields Composite key – a primary key with two or more fields Candidate keys – other unique keys in a table that are capable (or candidates) of being used as the primary key Candidate keys – other unique keys in a table that are capable (or candidates) of being used as the primary key Surrogate key (synthetic key) – system-generated primary key usually hidden from users Surrogate key (synthetic key) – system-generated primary key usually hidden from users Foreign key – the field in one relation required to match the primary key of another relation to specify relationships between the relations and to ensure referential integrity constraints Foreign key – the field in one relation required to match the primary key of another relation to specify relationships between the relations and to ensure referential integrity constraints