Module 3
Module 3
Design,
Implementation,
and Management,
14e
Module 3: The Relational
Database Model
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 1
Chapter Objectives (1 of 2)
2. Identify the relational model’s basic components and explain the structure,
contents, and characteristics of a relational table
4. Explain the purpose and components of the data dictionary and system catalog
5. Identify appropriate entities and then the relationships among the entities in the
relational database model
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 2
Chapter Objectives (2 of 2)
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 3
A Logical View of Data
• The relational data model allows the designer to focus on the logical representation
of the data and its relationships, rather than on the physical storage details
• The relational model enables you to view data logically rather than physically
• Logical simplicity tends to yield simple and effective database design methodologies
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 4
Tables and Their Characteristics (1 of 2)
• A table is perceived as a two-dimensional structure composed of rows and columns
• The characteristics of a relational table are summarized in Table 3.1 on the following
slide
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 5
Tables and Their Characteristics (2 of 2)
2 Each table row (tuple) represents a single entity occurrence within the entity set
3 Each table column represents an attribute, and each column has a distinct name
6 Each column has a specific range of values known as the attribute domain
8 Each table must have an attribute or combination of attributes that uniquely identifies each row
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 6
Keys
• Keys are important because they are used to ensure that each row in a table is
uniquely identifiable
− They are also used to establish relationships among tables and to ensure the
integrity of the data
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 7
Types of Keys (1 of 3)
• A composite key is a key that is composed of more than one attribute
• A candidate key is a minimal superkey; that is, a key that does not contain a subset
of attributes that is itself a superkey
• Primary key(PK) A candidate key selected to uniquely identify all other attribute values in any given row;
cannot contain null
• Foreign key(FK) An attribute whose values match primary key values in the related table
• A secondary key is a key that is used strictly for data retrieval purposes and does not require a
functional dependency
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 8
Types of Keys (2 of 3)
• Unique Key Ensures uniqueness, but can have one NULL value
• A null is the absence of any data value, and it is never allowed in any part of a
primary key
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 9
Types of Keys (3 of 3)
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 10
STUDENT Key Types
Super Key
Student_ID Name Email Phone Department_ID Roll_No Candidate Key
S101 Alice alice@email.com 123-456-7890 D01 R001 Primary Key
S102 Bob bob@email.com 987-654-3210 D02 R002 Alternate Key
S103 Charlie charlie@email.com 555-123-4567 D01 R003 Unique Key
S104 David david@email.com 777-888-9999 D03 R004 Foreign Key
S105 Alice alice2@email.com 222-333-4444 D02 R005 Composite Key
S106 Frank frank@email.com 666-777-8888 D01 R006 Secondary Key
DEPARTMENT
Department_ID Department_Name
D01 Computer Science
D02 Mechanical Engineering
D03 Electrical Engineering
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 11
Dependencies
• The role of a key is based on the concept of determination, which is the state in
which knowing the value of one attribute helps to determine the value of another
− Example: revenue – cost = profit
• Functional dependence means that the value of one or more attributes determines
the value of one or more other attributes
• The attribute whose value determines another is called the determinant or the key
• The attribute whose value is determined by the other is called the dependent
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 12
Dependencies
F(a) → b; Determinant → Dependent
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 13
Knowledge Check Activity 3-1
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 14
Knowledge Check Activity 3-1: Answer
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 15
Integrity Rules (1 of 3)
• Constraints are conditions that must hold on all valid relation states.
• Key constraints
A key Is a set of attributes with the following condition:
− No two tuples in any valid relation state will have the same value for the key
− If a relation has several candidate keys, one is chosen arbitrarily to be the primary key.
Another implicit constraint is the domain constraint
− Every value in a tuple must be from the domain of its attribute (or it could be null, if allowed for that
attribute)
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 16
Integrity Rules (2 of 3)
• Constraints are conditions that must hold on all valid relation states.
• Key constraints
A key Is a set of attributes with the following condition:
− No two tuples in any valid relation state will have the same value for the key
− If a relation has several candidate keys, one is chosen arbitrarily to be the primary key.
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 17
Integrity Rules (3 of 3)
• Referential integrity constraints
A constraint involving two relations
− Used to specify a relationship among tuples in two
relations:
− The referencing relation and the referenced
relation.
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 18
Integrity Rules
Table 3.4 Integrity Rules
Entity Integrity Description
Requirement All primary key entries are unique, and no part of a primary key may be null.
Purpose Each row will have a known, unique identity, and foreign key values can properly reference primary key values.
Example No invoice can have a duplicate number, nor can it be null; in short, all invoices are uniquely identified by their invoice
number.
Referential Integrity Description
Requirement A foreign key may have either a null entry, as long as it’s not part of its table’s primary key, or an entry that matches the
primary key value in a table to which it is related (every non-null foreign key value must reference an existing primary key
value).
Purpose The purpose is to ensure that every reference by a foreign key is a valid reference to the related primary key. It is possible
for an attribute not to have a corresponding value, but it will be impossible to have an invalid entry; the enforcement of
the referential integrity rule makes it impossible to delete a row in one table whose primary key has mandatory matching
foreign key values in another table.
Example A customer might not yet have an assigned sales representative (number), but it will be impossible to have an invalid
sales representative (number).
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 19
Relational Algebra
• Relational algebra is a set of mathematical principles that form the basis for
manipulating relational table contents
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 20
Formal Definitions and Terminology
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 21
Relational Set Operators (1 of 7)
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 22
Relational Set Operators (2 of 7)
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 23
Relational Set Operators (3 of 7)
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 25
Relational Set Operators (5 of 7)
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 26
Relational Set Operators (6 of 7)
• Other forms of JOIN include the following:
− Equijoin – links tables on the basis of an equality condition that compares specified
columns of each table
− Theta join – links tables using an inequality comparison operator
− Inner join – only returns matched records from the tables that are being joined
− Outer join – matched pairs are retained and unmatched values in the other table are
left null
▪ Left outer join: yields all of the rows in the first table, including those that do not
have a matching value in the second table
▪ Right outer join: yields all of the rows in the second table, including those that do
not have matching values in the first table
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 27
Relational Set Operators (7 of 7)
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 28
Knowledge Check Activity 3-2
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 29
Knowledge Check Activity 3-2: Answer
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 30
The Data Dictionary and the System
Catalog
• The data dictionary provides a detailed description of all tables in the database
created by the user and designer
− It is sometimes described as “the database designer’s database” because it
records the design decisions about tables and their structures
• The system catalog is a detailed system data dictionary that describes all objects
within the database
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 31
Relationships within the Relational
Database (1 of 6)
• The one-to-many (1:M) relationship is the norm for relational databases
• In the one-to-one (1:1) relationship, one entity can be related to only one other entity
and vice versa
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 32
Relationships within the Relational
Database (2 of 6)
• Figure 3.19 The 1:M Relationship between COURSE
and CLASS
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 33
Relationships within the Relational
Database (3 of 6)
• Figure 3.21 The 1:1 Relationship between
PROFESSOR and DEPARTMENT
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 34
Relationships within the Relational
Database (4 of 6)
• Figure 3.23 The ERM’s M:N Relationship between
STUDENT and CLASS
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 35
Relationships within the Relational
Database (5 of 6)
• Figure 3.25 Converting the M:N Relationship into
Two 1:M Relationships
• Because the ENROLL table links two tables, it is
also called a linking table
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 36
Relationships within the Relational
Database (6 of 6)
• Figure 3.27 The Expanded ER Model
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 37
Data Redundancy Revisited (1 of 2)
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 38
Data Redundancy Revisited (2 of 2)
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 39
Indexes (1 of 2)
• The index key is the index’s reference point that leads to data location identified by
the key
• In a unique index, the index key can have only one pointer value associated with it
• A table can have many indexes, but each index is associated with only one table
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 40
Indexes (2 of 2)
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 41
Cobb’s Relational Database Rules (1 of 2)
Table 13.8 Dr. Codd’s 12 Relational Database Rules
1 Information All information in a relational database must be logically represented as column values
in rows within tables.
2 Guaranteed access Every value in a table is guaranteed to be accessible through a combination of table
name, primary key value, and column name.
3 Systematic treatment of nulls Nulls must be represented and treated in a systematic way, independent of data type.
4 Dynamic online catalog based The metadata must be stored and managed as ordinary data—that is, in tables within
on the relational model the database; such data must be available to authorized users using the standard
database relational language.
5 Comprehensive data The relational database may support many languages; however, it must
sublanguage support one well-defined, declarative language as well as data definition,
view definition, data manipulation (interactive and by program), integrity
constraints, authorization, and transaction management (begin, commit,
and rollback).
6 View updating Any view that is theoretically updatable must be updatable through the
system.
7 High-level insert, update, and delete The database must support set-level inserts, updates, and deletes.
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 42
Cobb’s Relational Database Rules (2 of 2)
Table 13.8 Dr. Codd’s 12 Relational Database Rules
8 Physical data independence Application programs and ad hoc facilities are logically unaffected when physical access
methods or storage structures are changed.
9 Logical data independence Application programs and ad hoc facilities are logically unaffected when changes are
made to the table structures that preserve the original table values (changing order of
columns or inserting columns).
10 Integrity independence All relational integrity constraints must be definable in the relational language and
stored in the system catalog, not at the application level.
11 Distribution independence The end users and application programs are unaware of and unaffected by the data
location (distributed vs. local databases).
12 Nonsubversion If the system supports low-level access to the data, users must not be allowed to
bypass the integrity rules of the database.
13 Rule zero All preceding rules are based on the notion that to be considered relational, a database
must use its relational facilities exclusively for management.
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 43
Knowledge Check Activity 3-3
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 44
Knowledge Check Activity 3-3: Answer
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 45
Summary (1 of 2)
Now that the lesson has ended, you should be able to:
2. Identify the relational model’s basic components and explain the structure,
contents, and characteristics of a relational table
4. Explain the purpose and components of the data dictionary and system catalog
5. Identify appropriate entities and then the relationships among the entities in the
relational database model
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 46
Summary (2 of 2)
Now that the lesson has ended, you should be able to (continued):
Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage.
All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 47