The Relational Database Model

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/79

flashcard set

Earn XP

Description and Tags

2Y2 | Midterms

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

80 Terms

1
New cards

• The relational model, introduced by E. F. Codd in 1970, is based on predicate logic and set theory.

2
New cards

o Predicate logic

is used extensively in mathematics to provide a framework in which an assertion (statement of fact) can be verified as either true or false.

3
New cards

E.F Codd

He introduced the relational model.

4
New cards

1970

When was the relational model first introduced?

5
New cards

Example: A student with a student ID of 324452 is named Mark Reyes.

6
New cards

o Set theory

is a part of mathematical science that deals with sets, or groups of things, and is used as the basis for data manipulation in the relational model.

7
New cards

Example: Set A contains 15, 23, and 52 while Set B contains 41, 52, 70, 12. It can be concluded that the A and B share a common value, 52.

8
New cards

• The relational model has three (3) components:

9
New cards
  1. A logical data structure represented by relations
10
New cards
  1. A set of integrity rules to enforce that the data is consistent and remains consistent over time
11
New cards
  1. A set of operations that defines how data is manipulated
12
New cards

• A table (relation)

is as a two-dimensional structure composed of rows and columns.

13
New cards

• Each table row (tuple) represents data about an entity.

14
New cards

• Each table column represents an attribute, and each column has a distinct name.

15
New cards

• Each intersection of a row and column represents a single data value.

16
New cards

• All values in a column must conform to the same data format.

17
New cards

attribute domain

Each column has a specific range of values known as the ________________.

18
New cards

Table 1. Student Table Attribute Values

knowt flashcard image
19
New cards

• The order of the rows and columns is not important in a DBMS.

20
New cards

• The following are some conclusions based on the table above.

21
New cards

o The STUDENT table is composed of six (6) rows/tuples and five (5) columns/attributes.

22
New cards

o Each of the six (6) rows describes a student. For example, row 5 describes Martin S. Cruz.

23
New cards

o Because the STU_MI values are limited to characters A to Z, the domain is [A, Z].

24
New cards

o STUNUM is the primary key since it is guaranteed unique for each student. STULNAME would not be a good primary key because students can have the same last name. Same reason applies to other attributes.

25
New cards

Key

is an attribute or group of attributes that determines the values of other attributes. For example, an invoice number identifies all of the invoice attributes, such as the invoice date and the customer name.

26
New cards

• Determination

is the state in which knowing the value of an attribute makes it possible to determine the value of another. It is based on the relationships among the attributes.

27
New cards

• Functional dependence

means that the value of one or more attributes determines the value of one or more other attributes.

28
New cards

Determinant or the key.

The attribute whose value determines another is called the

29
New cards

Dependent.

The attribute whose value is determined by the other attribute is called the _________.

30
New cards

• The standard notation for representing the relationship between attributes is: ATT_A → ATT_B

31
New cards

For example,

STUNUM → STULNAME

32
New cards

STUNUM is the determinant and STULNAME is the dependent. When given a value for STUNUM, you can determine the value for STULNAME because only one (1) value of STULNAME is associated with any given value of STUNUM.

33
New cards

• Functional dependence

can involve a determinant that comprises multiple attributes.

34
New cards

For example,

STUNUM → (STULNAME, STUFNAME, STUMI, STU_SECT)

35
New cards

Composite key

is a key that is composed of more than one attribute.

36
New cards

Key attribute

An attribute that is a part of a key is called a ____________.

37
New cards

• The types of keys are the following:

38
New cards

Superkey

An attribute or combination of attributes that uniquely identifies any row in the table.

39
New cards

Superkey Example

Example STUNUM and any combination with STUNUM

Ex. (STUNUM, STULNAME)

(STUNUM, STUFNAME, STU_SECT)

40
New cards

Candidate Key

A superkey without any unnecessary attributes

Example: STU_NUM

41
New cards

Primary Key

A candidate key selected to uniquely identify all other attribute values in any given row; cannot contain null entries.

42
New cards

Example: STU_NUM

43
New cards

Foreign Key

An attribute or combination of attributes in one table whose values must either match the primary key in another table or be null.

44
New cards

Example: STU_SECT can be a foreign key if it is used as a primary key of another table.

45
New cards

Secondary Key

An attribute or combination of attributes used strictly for data retrieval purposes.

46
New cards

Example: (STULNAME, STUFNAME, STU_MI)

47
New cards

Integrity Rules

48
New cards

Entity integrity

is the condition in which each row in a table has its own unique identity.

49
New cards

Referential integrity

is the conditional in which every reference to an entity instance by another entity instance is valid.

50
New cards

Integrity rules

are followed to maintain a good database design.

51
New cards

Entity Integrity

52
New cards

Requirement

All primary key entries are unique, and no part of a primary key may be null.

53
New cards

Purpose

Each row will have a unique identity, and foreign key values can properly reference primary key values.

54
New cards

Example

No invoice can have a duplicate number, nor can it be null; in short, all invoices are uniquely identified by their invoice number.

55
New cards

Referential Integrity

56
New cards

Requirement

A foreign key may have either a null entry, as long as it is not a part of its table’s primary key, or an entry that matches the primary key value in a table to which it is related.

57
New cards

Requirement

Every non-null foreign key value must reference an existing primary key value.

58
New cards

Purpose

It is possible for an attribute not to have a corresponding value, but it will be impossible to have an invalid entry.

59
New cards

Purpose

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.

60
New cards

Example

A customer might not yet have an assigned sales representative (number), but it will be impossible to have an invalid sales representative (number).

61
New cards

Table example

knowt flashcard image
62
New cards

• The following are the features of the tables:

63
New cards

o Entity Integrity: The STUDENTS primary key (STU_NUM) column has no null entries, and all entries are unique. Similarly, the SECTIONS table’s primary key is STU_SECT, and this primary key column is also free of null entries.

64
New cards

o Referential Integrity: The STUDENTS table contains a foreign key, STUSECT, that links entries in the STUDENTS table to the SECTIONS table. The STUCODE row identified by the (primary key) number 324257 contains a null entry in its STUSECT foreign key because Marco Velasco does not yet have a section assigned to him. The remaining STUSECT entries in the STUDENTS table all match the STU_SECT entries in the SECTIONS table.

65
New cards

• To avoid nulls, special codes called flags are used to indicate the absence of some value. For example, the code NS can be used as the STUSECT entry in the second row of the STUDENTS table to indicate that Marco Velasco's section does not yet have a section assigned to him. If such a flag is used, the SECTIONS table must contain a dummy row with a STUSECT value of NS.

66
New cards

Relational Algebra

67
New cards

Data

can be manipulated to generate useful information.

68
New cards

Relational algebra

is a set of mathematical principles that form thebasis for manipulating relational table contents.

69
New cards

• Closure

The use of relational algebra operators on existing relations (tables) produces new relations is called _.

70
New cards

• Predicate

The condition to be evaluated is also known as .

71
New cards

• The eight (8) fundamental relational operators are:

72
New cards

SELECT

Retrieves a subset of rows

σ CONDITION (TABLE)

Example: σ STU_NUM = 324452 (STUDENTS)

<p>Retrieves a subset of rows</p><p></p><p>σ CONDITION (TABLE) </p><p>Example: σ STU_NUM = 324452 (STUDENTS)</p>
73
New cards

UNION

Merges two union-compatible tables into a new table, dropping the duplicate rows.

Symbol: ∪

Syntax: TABLE1 ∪ TABLE2

Example: STUDENTS ∪ SECTIONS

74
New cards

union-compatible

Two or more tables that have the same number of columns and the corresponding columns have compatible domains are __.

75
New cards

INTERSECT

Retrieves rows that are common to two union-compatible tables

Symbol: ∩

Syntax: TABLE1 ∩ TABLE2

Example: STUDENTS ∩ SECTIONS

76
New cards

DIFFERENCE

Retrieves rows from one table that are not found in another union-compatible table

Symbol: –

Syntax: TABLE1 – TABLE2

Example ': STUDENTS – SECTIONS

77
New cards

PROJECT

Retrieves a subset of columns

Syntax: π COLUMNS (TABLE)

Example: π STU_FNAME, STU_LNAME (STUDENTS

Symbol: π

<p>Retrieves a subset of columns</p><p></p><p>Syntax: π COLUMNS (TABLE) </p><p>Example: π STU_FNAME, STU_LNAME (STUDENTS</p><p>Symbol: π</p>
78
New cards

JOIN

Retrieves rows from two tables based on criteria (Ex. Rows with common values in their common attributes)

Symbol: ⨝

Syntax: TABLE1 ⨝ TABLE2

Example: STUDENTS ⨝ SECTIONS

79
New cards

PRODUCT

Retrieves possible pairs of rows from two tables (Cartesian Product)

Symbol: x

Syntax: TABLE1 x TABLE2

Example: STUDENTS x SECTIONS

80
New cards

DIVIDE

Retrieves values

÷

Syntax: TABLE1 ÷ TABLE2

Example: STUDENTS ÷ SECTIONS