0% found this document useful (0 votes)
13 views8 pages

Chapter 3

The relational model, introduced by E. F. Codd in 1970, is based on predicate logic and set theory, providing a logical data structure, integrity rules, and operations for data manipulation. It utilizes tables (relations) to represent data, with rows as records and columns as attributes, ensuring each table has a primary key for unique identification. Additionally, concepts like foreign keys, referential integrity, and functional dependencies are crucial for maintaining data integrity and relationships within the database.

Uploaded by

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

Chapter 3

The relational model, introduced by E. F. Codd in 1970, is based on predicate logic and set theory, providing a logical data structure, integrity rules, and operations for data manipulation. It utilizes tables (relations) to represent data, with rows as records and columns as attributes, ensuring each table has a primary key for unique identification. Additionally, concepts like foreign keys, referential integrity, and functional dependencies are crucial for maintaining data integrity and relationships within the database.

Uploaded by

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

relational model

- introduced by E. F. Codd in 1970


- based on predicate logic and set theory

Predicate logic

- used extensively in mathematics


- provides a framework in which an assertion (statement of fact) can be verified as either true
or false.
- Examples:
o a student with a student ID of 12345678 is named Melissa Sanduski. assertion can
easily be demonstrated to be true or false

Set theory

- is a mathematical science that deals with sets, or groups of things, and is used as the basis
for data manipulation in the relational model.
- Example:
o set A contains three numbers: 16, 24, and 77. A(16, 24, 77).
o set B contains four numbers, 44, 77, 90, and 11. B(44, 77, 90, 11)
o conclude that the intersection of A and B yields a result set with a single number,
77. as A > B 5 77

Based on these concepts, the relational model has three well-defined components:

1. A logical data structure represented by relations

2. A set of integrity rules to enforce that the data is consistent and remains consistent over time

3. A set of operations that defines how data is manipulated

A logical data structure

e relational data model

- allowing the designer to focus on the logical representation of the data and its relationships,
rather than on the physical storage details.
- enables you to view data logically rather than physically
o it serves as a reminder of the simple file concept of data storage.
- logical view of the relational database is facilitated by the creation of data relationships
based on a logical construct known as a relation
- Logical simplicity tends to yield simple and effective database design methodologies
Table

- perceived as a two-dimensional structure composed of rows and column


- also called a relation because the relational model’s creator, E. F. Codd, used the two terms
as synonyms.
- persistent representation of a logical relation—that is, a relation whose contents can be
permanently saved for future use
- a group of related entity occurrences
- Example
o STUDENT table contains a collection of entity occurrences, each representing a
student.

Note:

1. Rows sometimes referred to as records


2. columns are sometimes labeled as fields
3. tables are labeled files
4. this substitution of terms is not always appropriate
5. The database table is a logical concept rather than a physical concept
6. file, record, and field describe physical concepts.
Note:

1. The STUDENT table is perceived to be a two-dimensional structure composed of 8 rows (tuples)


and 12 columns (attributes).
2. Each row in the STUDENT table describes a single entity occurrence within the entity set.
- Example:
o row 4 in Figure 3.1 describes a student named Walter H. Oblonski. Given the table
contents, the STUDENT entity set includes eight distinct entities (rows) or students
3. Each column represents an attribute, and each column has a distinct name.
4. All of the values in a column match the attribute’s characteristics.
- the grade point average (STU_GPA) column contains only STU_GPA entries for each of the
table rows. Data must be classified according to its format and function.

Although various DBMSs can support different data types, most support at least the following:

A. Numeric. You can use numeric data to perform meaningful arithmetic procedures.
- For example, in Figure 3.1, STU_HRS and STU_GPA are numeric attributes.

B. Character. Character data, also known as text data or string data, can contain any character or
symbol not intended for mathematical manipulation.
- In Figure 3.1, STU_CLASS and STU_PHONE are examples of character attributes.
C. Date. Date attributes contain calendar dates stored in a special format known as the Julian date
format.
- In Figure 3.1, STU_DOB is a date attribute.

D. Logical. Logical data can only have true or false (yes or no) values.
- In Figure 3.1, the STU_TRANSFER attribute uses a logical data format.

5. The column’s range of permissible values is known as its domain. Because the STU_GPA values
are limited to the range 0–4, inclusive, the domain is [0,4]

6. The order of rows and columns is immaterial to the user

7. Each table must have a primary key. In general terms, the primary key (PK) is an attribute or
combination of attributes that uniquely identifies any given row. In this case, STU_NUM (the
student number) is the primary key.

Key

- important because they are used to ensure that each row in a table is uniquely identifiable
- used to establish relationships among tables and to ensure the integrity of the data
- consists of one or more attributes that determine other attributes.
- attribute or group of attributes that can determine the values of other attributes.
- keys are determinants in functional dependencies
- Examplle:
o an invoice number identifies all of the invoice attributes, such as the invoice date
and the customer name

Determination

- is the state in which knowing the value of one attribute makes it possible to determine the
value of another
- the statement “A determines B” indicates that knowing the value of attribute A means that
the value of attribute B can be looked up
- Example:
o revenue 2 cost 5 profit. This is a form of determination, because if you are given the
revenue and the cost, you can determine the profit.
- Determination in a database environment, however, is not normally based on a formula but
on the relationships among the attributes.
- Example
o given a value for STU_NUM, then you can determine the value for STU_LNAME
because one and only one value of STU_LNAME is associated with any given value of
STU_NUM

functional dependence

- means that the value of one or more attributes determines the value of one or more other
attributes.
- determinant or the key.
o the attribute whose value determines another
- dependent
o attribute whose value is determined by the other attribute
- can involve a determinant that comprises more than one attribute and multiple dependent
attributes
- Example:
o STU_NUM is the determinant and STU_LNAME is the dependent. STU_NUM
functionally determines STU_LNAME, and STU_LNAME is functionally dependent on
STU_NUM
o STU_NUM → (STU_LNAME, STU_FNAME, STU_GPA) and (STU_FNAME, STU_LNAME,
STU_INIT, STU_PHONE) → (STU_DOB, STU_HRS, STU_GPA

full functional dependence

- used to refer to functional dependencies in which the entire collection of attributes in the
determinant is necessary for the relationship.

Types of Key

1. Composite key
- is a key that is composed of more than one attribute

2. superkey
- key that can uniquely identify any row in the table.
- functionally determines every attribute in the row.

Example:

1. In the STUDENT table, STU_ NUM is a superkey, as are the


2. composite keys
a. (STU_NUM, STU_LNAME)
b. (STU_NUM, STU_LNAME, STU_INIT)
c. (STU_LNAME, STU_FNAME, STU_INIT, STU_PHONE).
candidate key

- specific type of superkey


- a minimal superkey—that is, a superkey without any unnecessary attributes
- based on a full functional dependency
- they are the eligible options from which the designer will choose when selecting the primary
key

Example:

1. STU_NUM would be a candidate key


2. STU_LNAME, STU_FNAME, STU_INIT, STU_PHONE)
3. (STU_NUM, STU_LNAME) is a superkey, but it is not a candidate key because STU_LNAME could
be removed, and the key would still be a superkey

Note:

1. primary keys are candidate keys, but not all candidate keys are chosen to be the primary key
2. All candidate keys are superkeys, but not all superkeys are candidate keys.

Entity integrity

- is the condition in which each row (entity instance) in the table has its own known, unique
identity

To ensure entity integrity, the primary key has two requirements:

(1) all of the values in the primary key must be unique and

(2) no key attribute in the primary key can contain a null

Null

- the absence of any data value, and it is never allowed in any part of the primary key
- roblematic in the relational model.
- a table that contains a null is not properly a relational table at all
- however, some nulls cannot be reasonably avoided.
- Example:
o not all students have a middle initial.
- GR: nulls should be avoided as much as reasonably possible
- a null could represent any of the following:
• An unknown attribute value
• A known, but missing, attribute value
• A “not applicable” condition
- can create problems when functions such as COUNT, AVERAGE, and SUM

A foreign key (FK)

- the primary key of one table that has been placed into another table to create a common
attribute

Note:

1. , the primary key of VENDOR, VEND_CODE, was placed in the PRODUCT table
2. VEND_CODE is a foreign key in PRODUCT

referential integrity

- the condition in which every reference to an entity instance by another entity instance is
valid.
a secondary key

- is defined as a key that is used strictly for data retrieval purposes and does not require a
functional dependence
- Example:
o CUSTOMER table in which the customer number is the primary key. Do you think
that most customers will remember their numbers? Data retrieval for a customer is
easier when the customer’s last name and phone number are used.
o In that case, the primary key is the customer number; the secondary key is the
combination of the customer’s last name and phone number

You might also like