Lecture 1 - Relational Constraints Flashcards

1
Q

What are relational constraints?

A

conditions that must hold for all tuples for each relation

i.e. all rows in the table must have a bounded number for each column

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

How many fundamental constraints is there?

A

3

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

What are the 3 fundamental constraints?

A
  • key constraint (unique tuple identification)
  • entity integrity constraint (keys never null)
  • Referential integrity constraint (interpretation on relationships)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a superkey?

A

a set of attributes containing at least one attribute that uniquely identifies any tuple.

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

What is a candidate key?

A

is the minimal superkey; i.e., the set with the smallest number of attributes that uniquely identify tuples.

i.e., the removal of any attribute from K results in K’ that is no longer a superkey

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

What is a primary key?

A

If a relation has several candidate keys, one is chosen arbitrarily to be primary key; the rest candidate keys are called secondary keys.It uniquely identifies each row in the table.

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

Can primary key be null?

A

NO

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

Can primary key be a set of attributes?

A

YES, it becomes a composite primary key

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

How are PKs represented in a relation schema?

A

Underlined

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

What is a REFERENTIAL INTEGRITY CONSTRAINT?

A

The interpretation of relationships

  • foreign keys rules e.g if FK is null, then that FK should not be part of it’s own primary key i.e. not violating the entity integrity constraint
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is an FK?

A

A key that

t1 is referencing relation (contains FK)
t2 is referenced (contains what FK copies)

t1[FK] references t2[PK] → t1[FK] = t2[PK] or t1[FK] = NULL

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

What is Semantic Integrity Constraints?

A

based on application semantics and
cannot be expressed by the relational model…

  • e.g., “the maximum number of hours per employee for all projects
    he/she works on is 56 hrs per week”.
  • e.g., ‘each department should control 2 to 5 projects per year .’
  • e.g., ‘each department has up to 100 employees’

we require a specific constraint specification language to handle

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

Whether we need absolute consistency in our database depends on …

A

appllication and its context. To have asolute consistencies we need an optimal processing algorithm, otherwise we can use suboptimal ones that e.g. flush to db after enough data is processed

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