6: Relational Databases

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/208

encourage image

There's no tags or description

Looks like no tags are added yet.

209 Terms

1
New cards

What are the three main skills emphasized in Chapter 6?

Understanding relations, keys, and constraints; identifying normalization problems and decomposing relations; and mapping ER/EER models to relational schemas.

2
New cards

Who formalized the relational model, and when?

Edgar F. Codd in 1970.

3
New cards

What mathematical foundations support the relational model?

Set theory and first-order predicate logic.

4
New cards

What is a relation?

A set of tuples, commonly displayed as a table.

5
New cards

What is a tuple?

One record containing attribute values.

6
New cards

What is a relational attribute?

A named property or column.

7
New cards

What is a cell value?

The value for a particular tuple and attribute.

8
New cards

What is a domain?

The set of admissible values for an attribute.

9
New cards

What can an ER entity type map to in the relational model?

A relation.

10
New cards

Can a relation represent an ER relationship rather than an entity type?

Yes. Mapped relationships can have their own relations.

11
New cards

What ER concept roughly corresponds to a tuple?

An entity instance.

12
New cards

What ER concept corresponds to a relational column?

An attribute type.

13
New cards

Can a formal relation contain duplicate tuples?

No. A relation is a set.

14
New cards

Do tuples in a formal relation have an inherent order?

No.

15
New cards

What is the degree of a relation?

The number of attributes.

16
New cards

What is the cardinality of a relation?

The number of tuples.

17
New cards

A relation has five columns and 200 rows. What are its degree and cardinality?

Degree 5 and cardinality 200.

18
New cards

What does it mean that a relation is a subset of the Cartesian product of its domains?

It contains some of the possible combinations of values from those domains.

19
New cards

Must a relation contain at least one tuple?

No. A relation can be empty.

20
New cards

Do SQL tables and query results automatically behave like mathematical sets?

No. Duplicates may occur unless prevented by constraints or removed.

21
New cards

What does NULL represent in this chapter?

Missing, unknown, irrelevant, or inapplicable information.

22
New cards

Is NULL equivalent to zero or an empty string?

No. Zero and an empty string are actual values.

23
New cards

What does the domain constraint require?

Each attribute contains one atomic, single-valued value from its domain, subject to permitted NULLs.

24
New cards

Why does storing two separate course names in one cell violate the chapter’s atomicity requirement?

The cell contains a collection of values instead of one atomic, single-valued value.

25
New cards

What is a superkey?

A set of attributes that uniquely identifies a tuple, possibly including unnecessary attributes.

26
New cards

What is a candidate key?

A minimal superkey.

27
New cards

What does “minimal” mean for a candidate key?

No attribute can be removed without losing uniqueness.

28
New cards

Does minimal mean choosing the candidate key with the fewest attributes among all candidates?

No. Each candidate key must have no removable attributes, even if another candidate key has fewer attributes.

29
New cards

What is a primary key?

The candidate key selected as the principal identifier.

30
New cards

What is an alternative key?

A candidate key not selected as the primary key.

31
New cards

What is a foreign key?

Attributes that reference a key in another relation or in the same relation.

32
New cards

How does a candidate key differ from a superkey?

A candidate key has no unnecessary attributes; a superkey may contain them.

33
New cards

How does a primary key differ from an alternative key?

Both are candidate keys, but only the primary key is selected as the principal identifier.

34
New cards

If StudentNr is unique, is {StudentNr, Name} a superkey?

Yes, because StudentNr already uniquely identifies the tuple.

35
New cards

If StudentNr alone is unique, is {StudentNr, Name} a candidate key?

No. Name is unnecessary, so the set is not minimal.

36
New cards

If StudentNr and Email are individually unique and required, what are the candidate keys?

{StudentNr} and {Email}.

37
New cards

If StudentNr is selected as primary key and Email is another candidate key, what is Email?

An alternative key.

38
New cards

What is a prime attribute?

An attribute belonging to at least one candidate key.

39
New cards

What is a non-prime attribute?

An attribute belonging to no candidate key.

40
New cards

Does prime mean belonging only to the selected primary key?

No. Membership in any candidate key makes an attribute prime.

41
New cards

StudentNr and Email are candidate keys, while Name may repeat. Which attributes are prime?

StudentNr and Email.

42
New cards

StudentNr and Email are candidate keys, while Name may repeat. Which attribute is non-prime?

Name.

43
New cards

What are the four relational constraints discussed in this chapter?

Domain, key, entity integrity, and referential integrity.

44
New cards

What does the key constraint require?

Keys uniquely identify tuples.

45
New cards

What does entity integrity require?

No component of the primary key may be NULL.

46
New cards

Can one component of a composite primary key be NULL?

No. Entity integrity applies to every component.

47
New cards

What does referential integrity require?

A non-NULL foreign-key value must match a referenced key value.

48
New cards

A purchase order contains a non-NULL supplier number that does not exist in SUPPLIER. Which constraint is violated?

Referential integrity.

49
New cards

A primary-key component is NULL. Which constraint is violated?

Entity integrity.

50
New cards

Is a foreign key automatically unique?

No. Many tuples may reference the same parent.

51
New cards

Is a foreign key automatically NOT NULL?

No. NOT NULL must be required separately when participation is mandatory.

52
New cards

Can a foreign key reference its own relation?

Yes. This is a self-referencing foreign key.

53
New cards

What do the slides say about the domains of foreign keys and referenced keys?

Their domains must match.

54
New cards

In practical SQL systems, must foreign keys always reference the selected primary key?

No. They can also reference qualifying unique keys.

55
New cards

If every purchase order must have a supplier, what additional constraint is needed on its supplier FK?

NOT NULL.

56
New cards

How do FK, UNIQUE, and NOT NULL constraints differ?

FK requires a valid referenced value; UNIQUE prevents repeated values; NOT NULL requires a value.

57
New cards

Why normalize relations?

To reduce unnecessary redundancy and the insertion, deletion, and update anomalies it causes.

58
New cards

What is an insertion anomaly?

A design prevents recording one fact independently without supplying unrelated or missing information.

59
New cards

What is a deletion anomaly?

Deleting one fact unintentionally removes another fact that should be retained.

60
New cards

What is an update anomaly?

A repeated fact must be changed in multiple rows, creating a risk of inconsistent copies.

61
New cards

How can repeated supplier details cause an insertion anomaly?

A supplier cannot be recorded independently without creating or leaving missing supply information.

62
New cards

How can repeated supplier details cause a deletion anomaly?

Deleting the supplier’s last supply row also deletes the only stored supplier details.

63
New cards

How can repeated supplier details cause an update anomaly?

Changing an address requires updating multiple rows, and missed rows retain the old address.

64
New cards

What are goals of good relational design?

Clear meaning for each relation, fewer repeated facts, fewer unnecessary NULLs, and reduced risk of inconsistent updates.

65
New cards

Is normalization simply the process of making tables smaller?

No. It is driven by dependencies and business rules.

66
New cards

What does the functional dependency X → Y mean?

If two tuples agree on X, they must agree on Y.

67
New cards

What is the determinant in X → Y?

X, the attributes on the left side.

68
New cards

Does X → Y imply that X uniquely identifies an entire tuple?

Not necessarily. X determines Y but may not determine every attribute in the relation.

69
New cards

Does X → Y automatically imply Y → X?

No. Functional dependencies are directional.

70
New cards

What does SSN → EmployeeName mean?

Each SSN determines one employee name.

71
New cards

What does ProjectNr → ProjectName mean?

Each project number determines one project name.

72
New cards

What does {SSN, ProjectNr} → Hours mean?

Hours are determined by the employee–project combination.

73
New cards

Where should functional dependencies come from?

Business rules governing all valid states of the relation.

74
New cards

Why is a small data sample insufficient to establish a functional dependency?

The apparent dependency may be accidental and fail for other valid records.

75
New cards

What is a full functional dependency?

Every attribute in the determinant is needed to determine the dependent attributes.

76
New cards

What is a partial functional dependency?

A proper subset of the determinant still determines the dependent attributes.

77
New cards

Why is {SSN, ProjectNr} → ProjectName partial when ProjectNr → ProjectName?

SSN is unnecessary for determining ProjectName.

78
New cards

What is a transitive dependency in the normalization examples?

A key determines a non-key fact through an intermediate non-key determinant.

79
New cards

What does SSN → DeptNr → DeptName illustrate?

A transitive dependency of DeptName on SSN.

80
New cards

What is a trivial functional dependency?

A dependency whose right side is a subset of its left side.

81
New cards

Why is {SSN, Name} → SSN trivial?

SSN is already included in the determinant.

82
New cards

What is the rule for first normal form (1NF) in this chapter?

Every attribute value is atomic and single-valued.

83
New cards

How should a modeled composite name be represented when mapping it to atomic components?

Use separate component attributes, such as FirstName and LastName.

84
New cards

How should multiple department locations be represented instead of storing a list in one cell?

Create DEPT_LOCATION(DeptNr, Location), with one row per department–location pairing.

85
New cards

What is the primary key of DEPT_LOCATION(DeptNr, Location) under the chapter’s assumptions?

(DeptNr, Location).

86
New cards

What is the foreign key in DEPT_LOCATION(DeptNr, Location)?

DeptNr references DEPARTMENT.DeptNr.

87
New cards

What does one row of DEPT_LOCATION represent?

One department–location pairing.

88
New cards

What is the rule for second normal form (2NF)?

The relation is in 1NF, and every non-prime attribute depends on the whole of every candidate key.

89
New cards

What problem does 2NF eliminate?

Partial dependencies of non-prime attributes on candidate keys.

90
New cards

Does 2NF consider only the selected primary key?

No. It considers every candidate key.

91
New cards

Can a 1NF relation whose candidate keys are all single-attribute keys have an ordinary partial-key dependency problem?

No.

92
New cards

WORK has key (SSN, ProjectNr), and ProjectNr → ProjectName. Why does ProjectName violate 2NF?

It is a non-prime attribute determined by only part of the candidate key.

93
New cards

How should WORK(SSN, ProjectNr, ProjectName, Hours) be decomposed when ProjectNr determines ProjectName?

WORKS_ON(SSN, ProjectNr, Hours) and PROJECT(ProjectNr, ProjectName).

94
New cards

What is the primary key of WORKS_ON(SSN, ProjectNr, Hours)?

(SSN, ProjectNr).

95
New cards

What is the primary key of PROJECT(ProjectNr, ProjectName)?

ProjectNr.

96
New cards

Which foreign key connects WORKS_ON to PROJECT?

WORKS_ON.ProjectNr references PROJECT.ProjectNr.

97
New cards

Why does Hours remain in WORKS_ON after the 2NF decomposition?

It depends on the full employee–project combination.

98
New cards

What is the simplified 3NF rule for the straightforward examples in this chapter?

Be in 2NF and remove transitive dependencies of non-prime attributes on the key.

99
New cards

What is the precise 3NF test?

For every non-trivial dependency X → A, X must be a superkey or A must be prime.

100
New cards

EMPLOYEE has key SSN, with SSN → DeptNr and DeptNr → DeptName. What violates 3NF?

DeptName depends transitively on SSN through DeptNr.