Constrainsts in Databases Flashcards

1
Q

A ________ is a relationship among data elements that the DBMS is required to enforce

A

constraint

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are 5 types of constraints?

A
  • Functional Dependencies
  • Inclusion Dependencies
  • Value-based constraints
  • Tuple-based constraints
  • Assertions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

DB instances that satisfy all constraints are called _____

A

legal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Many kinds of constraints can expressed in ____

A

RA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an equivalent way to represent R (subset) S?

A

R-S = (empty set)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an equivalent way to represent R = (empty set)?

A

R (subset) (empty set)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

_______________ style of expressing constraints is common in SQL

A

equal-to-emptyset

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Give examples of a domain constraint on an attribute

A

Integers only/ strings of length 20

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a key constraint?

A

A set of attributes for a relation that does not allow 2 tuples in a relation instance to have the same values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a foreign-key constraint?

A

A value appearing in the attribute(s) of one relation must also appear as a value in attribute(s) that are a key of another relation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

(Foreign) Key constraints are special cases of ____________ dependencies and ___________ dependencies

A

functional, inclusion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

________ dependencies are constraints in the form X -> Y where X, Y are sets of attributes

A

functional

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In FDs, the values of X ________ the values of Y

A

determines

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Why are relation keys are special case of the FD X->Y?

A

Y is just the whole set of attributes of a relation when determining a key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What form do INDs take?

A

Constraints of the form R[X] (subset) S[Y]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

For INDs, the _______ of attributes matter

A

order

17
Q

INDs are _________ constraints, meaning they link the contents of one table to another table

A

referrential

18
Q

When does a set of constraints imply or entail a single constraint?

A

When every instance that satisfies the set of constraints also satisfies the single constraint

19
Q

What is the notation of an implication of constraints?

A

Σ |= φ

20
Q

A _______ axiomatization implies every derived constraint

A

sound

21
Q

A ______ axiomatization can derive implied constraints

A

complete

22
Q

Σ |= φ IFF Σ |- φ

A

Σ |= φ IFF Σ |- φ

23
Q

If Y (subset) X, then…

A

X -> Y

24
Q

If X -> Y, then…

A

XZ -> YZ for any Z

25
Q

If X -> Y and Y -> Z, then

A

X -> Z

26
Q

If X -> Y and X -> Z, then…

A

X -> YZ

27
Q

If X -> YZ, then…

A

X -> Y and X -> Z

28
Q

The ________ F+ of F is the set of all FDs implied by the FDs in F

A

closure

29
Q

A closure can be computed using ________ axioms

A

Armstrong’s

30
Q

Compute the closure of F = { A -> B, B -> C}

A

F+ = F U {A -> C, AC -> BC, AB -> AC, AB -> BC} U {all trivial FDs on A, B, C}