0% found this document useful (0 votes)
7 views26 pages

Chapter 3

Chapter 3 discusses the relational database model, focusing on data types, keys, data integrity, and relational set operators. It categorizes data types into simple, complex, and specialized, while emphasizing the importance of keys for unique identification and relationships in tables. Additionally, it outlines integrity rules and various relational set operators like SELECT, PROJECT, and JOIN, which are essential for data manipulation.

Uploaded by

shenna galicia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views26 pages

Chapter 3

Chapter 3 discusses the relational database model, focusing on data types, keys, data integrity, and relational set operators. It categorizes data types into simple, complex, and specialized, while emphasizing the importance of keys for unique identification and relationships in tables. Additionally, it outlines integrity rules and various relational set operators like SELECT, PROJECT, and JOIN, which are essential for data manipulation.

Uploaded by

shenna galicia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

CHAPTER 3 – THE RELATIONAL

DATABASE MODEL
CHRIS MARK C. AQUINO
THE CONCEPT OF DATA TYPES IN A
RELATIONAL DATABASE MODEL
1. Simple Data Types. This includes basic validation and formatting
requirements placed on to individual values Simple data types may also be
sub – categorized into the following:
Strings. A string is a sequence of one or more characters. Strings
can be fixed – length strings in which it will always store the specified length
declared for that data type. They can be also variable – fixed length strings in
which it allows storage into a data type as the actual length of string, as long
as a maximum limit is not exceeded.
Numbers. Numeric data types are often the most numerous field data
types in many database tables. Here are some of them:
 Integers  Floating points
 Fixed – length decimals  Dates and times
DATA TYPES ACCORDING TO COMPLEXITY

2. Complex Data Types.


This encompasses object data types. Available object data
types vary for different relational databases. Some relational
databases provide more object – relational attributes and
functionality than others. Complex data types include any data
types breaching the object – relational database divide including
items such as binary objects, reference pointers, collection arrays
and even the capacity to create user – defined types.
DATA TYPES ACCORDING TO COMPLEXITY

3. Specialized Data Types.


These are present in more advanced relational
databases catering to inherently structured data such as
XML documents, spatial data, multimedia objects and even
dynamically definable data types.
WHAT IS A KEY?
A key consists of one or more attributes that determine
other attributes in a relational table. In relational databases,
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. Therefore, a proper understanding of the
concept and use of keys in the relational model is very
important.
KEYS COMMONLY USED IN RDM

1. Primary Key.
It is used to uniquely identify a record in a table.
Unique identification for each record is critical because
there is no other way to find a record without the possibility
of finding more than one record, if the said unique identifier
is not used. A primary key can be also used to define
relationships between tables.
KEYS COMMONLY USED IN RDM

2. Candidate Keys.
Sometimes called as a unique key, it is created on a
field containing only unique values throughout the entire
table similar to a primary key. However, candidate keys are
not used to define relationships between tables compare to
primary keys. They only ensure uniqueness across a table.
KEYS COMMONLY USED IN RDM

3. Foreign Keys.
They are copies of primary keys created into child
tables to form the opposite side of the link in an inter – table
relationship in which it establishes a “relational database
relation”. A foreign key defines the reference for each record
in the child table, referencing back to the primary key in the
parent table.
WHAT IS DATA INTEGRITY?
In a relational database, data integrity refers to a
condition in which the data in the database is in compliance
with all entity and referential integrity constraints. The
integrity of data is the validity of data, wherein possible
compromises to data integrity include human error at data
entry, network transmission errors, software bugs and virus
infections, hardware malfunction, disk errors, and natural
disasters.
INTEGRITY RULES

Integrity rules are rules or constraints that


are used in a database to ensure the
consistency, accuracy, and completeness of
data.
TYPES OF INTEGRITY RULES
Entity integrity rules: These rules ensure that each
row in a table has a unique identifier or primary key, and
that this identifier is not null or empty.
Referential integrity rules: These rules ensure that
relationships between tables are consistent and valid,
and that foreign key values in one table correspond to
valid primary key values in another table.
TYPES OF INTEGRITY RULES
Domain integrity rules: These rules define the valid
values that can be stored in a field or column, and
prevent the insertion of invalid or inconsistent data.
User-defined integrity rules: These rules can be
created by users to enforce specific business rules or
requirements, such as ensuring that a customer's
account balance does not go below zero.
TYPES OF RELATIONAL SET
OPERATORS

1. SELECT
– also known as RESTRICT, it yields values for all rows
found in a table that satisfy a given condition. SELECT
can be used to list all of the row values, or it can yield
only those row values that match a specified criterion.
In other words, SELECT yields a horizontal subset of a
table.
TYPES OF RELATIONAL SET
OPERATORS

2. PROJECT
– This relational operator yields all values for
selected attributes. In other words, PROJECT
yields a vertical subset of a table.
TYPES OF RELATIONAL SET
OPERATORS
3. UNION
It combines all rows from two tables, excluding duplicate
rows. The tables must have the same attribute characteristics
which included the columns and domains must be compatible to
be used in the UNION. When two or more tables share the same
number of columns, and when their corresponding columns
share the same or compatible domains, they are said to be union
– compatible.
TYPES OF RELATIONAL SET
OPERATORS

4. INTERSECT
This relational operator yields only the rows that
appear in both tables. As was true in the case of UNION,
the tables must be union – compatible to yield valid
results. For example, the INTERSECT relation operator
cannot be used if one of the attributes is numeric and
one is character – based.
TYPES OF RELATIONAL SET
OPERATORS

5. DIFFERENCE
DIFFERENCE yields all rows in one table that
are not found in the other table; that is, it
subtracts one table from the other. As was true
in the case of UNION, the tables must be union –
compatible to yield valid results.
TYPES OF RELATIONAL SET
OPERATORS

5. PRODUCT
This relational operator yields all possible
pairs of rows from two tables also known as
the Cartesian product.
TYPES OF RELATIONAL SET
OPERATORS

6. JOIN
JOIN allows information to be combined from two or
more tables. JOIN is the real power behind the relational
database, allowing the use of independent tables linked
by common attributes. Types of JOIN implementation can
be explained further through the utilization of SQL
during data manipulation queries.
WHAT IS DATA DICTIONARY?

A data dictionary generally provides a detailed description of all


tables found within the created database made by the database
designer.
Thus, the data dictionary contains at least all of the attribute names
and characteristics for each table in the system. In short, the data
dictionary contains metadata that typically describes the “data about
the data”

You might also like