ILS3A01 Week 3
ILS3A01 Week 3
WEEK 3
Database Systems:
Design,
Implementation, and
Management, 14e
Module 3: The Relational
Database Model
Footnote Coronel, Carlos and Morris, Steven, Database Systems: Design, Implementation, and Management, 14 Edition. © 2023 Cengage. All Rights 2
Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. 2
Relational Algebra
The following are the eight main SELECT, PROJECT, JOIN, INTERSECT,
UNION, DIFFERENCE, PRODUCT, and
functions: DIVIDE
Footnote 3
Formal Definitions and Terminology
Footnote 4
Relational Set Operators
Footnote 5
Relational Set Operators (1 of 7)
Footnote 6
Relational Set Operators (2 of 7)
Footnote 7
Relational Set Operators
• Yields all rows in one table that are not found in the other table
Difference
• Tables must be union-compatible to yield valid results
• Union-compatible essentially implies that the tables being
“unioned” should have the same attributes in the same
sequence.”
Footnote 8
Relational Set Operators (3 of 7)
Footnote 9
Relational Set Operators (4 of 7)
Footnote 10
Relational Set Operators (5 of 7)
Footnote 11
Relational Set Operators (6 of 7)
• 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
Footnote 12
Relational Set Operators (7 of 7)
Footnote 13
Combining data from more than one table
Footnote 14
NATURAL JOIN (relates directly to Inner Join)
Footnote 15
OUTER JOIN
Outer join - Matched pairs are retained, and any unmatched values in other table
are left null
Footnote 17
SQL JOINS
Footnote 18
Be careful: The difference between Union and Inner / Outer Join?
Joins and Unions can be used to combine data from one or more
tables. The difference lies in how the data is combined.
Joins combine data into new Unions combine data into new
columns. If two tables are rows. If two tables are “unioned”
joined together, then the data together, then the data from the first
from the first table is shown in table is in one set of rows, and the
one set of column alongside the data from the second table in
second table’s column in the another set. The rows are in the
same row. same result.
Footnote 19
The Data Dictionary and the System Catalog
The system catalog is a detailed system data dictionary that describes all
objects within the database
Footnote 20
Relationships within the Relational Database (1 of 6)
Footnote 21
Relationships within the Relational Database (2 of 6)
Footnote 22
Relationships within the Relational Database (3 of 6)
Footnote 23
Relationships within the Relational Database (4 of 6)
Footnote 24
Relationships within the Relational Database (5 of 6)
Footnote 25
Relationships within the Relational Database (6 of 6)
Footnote 26
Data Redundancy Revisited (1 of 2)
Footnote 27
Data Redundancy Revisited (2 of 2)
Footnote 28
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
Footnote 29
Indexes (2 of 2)
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 the database;
on the relational model 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.
Footnote 31
Cobb’s Relational Database Rules (2 of 2)
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.
Footnote 32
Questions???
Footnote 33