CH3 - The relational data model and relational database constraints Flashcards

1
Q

relation

A

mathematical concept based on the ideas of sets. Informally, a relation looks like a table of values. It typically contains a set of rows. The data elements in each row represent certain facts that correspond to a real-world entity or relationship (in the formal model, rows are called tuples). Each column has a column header that gives an indication of the meaning of the data items in that column (in the formal model, the column header is called an attribute).

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

key

A

a value of a data item (or set of items) that uniquely identifies that row in the table. Sometimes row-ids or sequential numbers are assigned as keys to identify the rows in a table, these are called artificial key or surrogate key.

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

schema (or description)

A

relation is denoted by R(A1, A2,…, An) where R is the name of the relation and A1, A2,…, An are the attributes of the relation. Each attribute has a domain or set of valid values.

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

tuple

A

ordered set of values (). Each value is derived from an appropriate domain. A relation is a set of such tuple

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

domain

A

domain has a logical definition as well as a data-type or a format defined for it. The attribute name designates the role played by a domain in a relation.

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

relation state

A

a subset of the cartesian product of the domains of its attributes, where each domain contains the set of all possible values the attribute can take

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

 Ordering of tuples in a relation r(R)

A

the tuples are not considered to be ordered, even though they appear to be in the tabular form.

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

 Ordering of attributes in a relation schema R

A

the attributes and their values are considered to be ordered. However, this ordering is not required with self-describing representation which includes both the name and the value for each attribute.

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

 Values in a tuple

A

all values are considered atomic (indivisible). Each value in a tuple must be from the domain of the attribute for that column. A special null value is used to represent values that are unknown or not available or inapplicable in certain tuples

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

 Constraints

A

determine which values are permissible and which are not in the database. They are of three main types :
- Inherent or implici constraints, which are based on the data model itself
- Schema-based or explicit constraints, which are expressed in the schema by using the facilities provided by the model
- Application based or semantic constraints, which are beyond the expressive power of the model and must be specified and enforced by the application programs
Constraints are conditions that must hold on all valid relation states

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

three main types of explicit schema-based constraints that can be expressed in the relational model

A
  • Key constraints
  • Entity integrity constraints
  • Referential integrity constraints
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

domain constraint

A

every value in a tuple must be from the domain of its attribute

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

 Superkey

A

a set of attributes with the following condition : no two tuples in any valid relation state r(R) will have the same value and this condition must hold in any valid state

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

 Key

A

a minimal superkey. That is, a key is a superkey such that removal of any attribute results in a set of attributes that is not a superkey (that does not possess the superkey uniqueness property). A key is a superkey but not vice versa.

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

relational database schema

A

is a set S of relation schemas that belong to the same database. S is the name of the whole database schema S = {R1, R2,…, Rn} and a set IC of integrity constraints. R1, R2,…, Rn are the names of the individual relation schemas within the database S.

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

relational database state

A

a set of relation states DB = {r1, r2, …, rm} such that each ri is a state of Ri and such that the ri relation states satisfy the integrity constraints specified in IC. A relational database state is sometimes called a relational database snapshot or instance. A database state that does not meet the constraints is an invalid state. Each relation will have many tuples in its current relation state. The relational database state is a union of all the individual relation states. Whenever the database is changed, a new state arises. Basic operation for changing the database :

  • INSERT a new tuple in a relation
  • DELETE an existing tuple from a relation
  • MODIFY an attribute of an existing tuple
17
Q

 Entity integrity

A

the primary key attributes of each relation schema R in S cannot have null values in any tuple of r(R). This is because primary key values are used to identify the individual tuples. If the primary key has several attributes, null is not allowed in any of these attributes

18
Q

 Referential integrity

A

a constraint involving two relations which is used to specify a relationship among tuples in two relations, namely the referencing relation and the referenced relation. Tuples in the referencing relation R1 have attributes called foreign key that reference the primary key attributes of the referenced relation R2. A referential integrity constraint can be displayed in a relational database schema as a directed arc from R1.FK to R2

19
Q

 Semantic integrity constraints

A

based on application semantics and cannot be expressed by the model per se. A constraint specification language may have to be used to express these.

20
Q

 INSERT, DELETE, MODIFY a tuple

A

Integrity constraints should not be violated by the update operations. Several update operations may have to be grouped together. Updates may propagate to cause other updates automatically. This may be necessary to maintain integrity constraints. In case of integrity violation, several actions can be taken :

  • Cancel the operation that causes the violation (RESTRICT or REJECT)
  • Perform the operation but inform the user of the violation
  • Trigger additional updates so the violation is corrected (CASCADE or SET NULL)
  • Execute a user-specified error-correction routine

INSERT may violate : domain constraint (if one of the attribute values provided for the new tuple is not of the specified attribute domain), key constraint (if the value of a key attribute in the new tuple already exists in another tuple in the relation), referential integrity (if a foreign key value in the new tuple references a primary key value that does not exist in the referenced relation) and entity integrity (if the primary key value is null in the new tuple).

DELETE may only violate referential integrity (if the primary key value of the tuple being deleted is referenced from other tuples in the database)

UPDATE may violate domain constraint and NOT NULL constraint on an attribute being modified.