INTRODUCTION TO THE RELATIONAL MODEL Flashcards

1
Q

What is a relation?

A

A table in a database that has tuples (rows) and attributes (columns)

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

What is a set?

A

A collection of related objects considered an object in it’s own right

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

What is an attribute?

A

A named column of a relation. Each attribute of a relation is a set

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

Describe a domain

A

Every attribute in a relation is defined based on a domain
This allows a database designer to define all the acceptable values that can be held by an attribute and all semantically correct relational operations

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

How can a domain be specified?

A

A common method of specifying a domain is to specify a data type from which the data values (that are elements of the attribute) are drawn
For example, the attribute
National_ID_number should store data values that are of the type integer. More specifically, only 8 integers (in Kenya).

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

What is the intension of a relation (relation schema) ?

A

The structure of a relation, together with a specification of the domains and any other restrictions on possible values is called its intension

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

What is the extension of a relation ?

A

The tuples are called the extension (or state) of a relation. This changes over time.

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

What is a relational database schema

A

a set of relation schemas, each with a distinct name

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

What is the degree of a relation?

A

The number of attributes it contains

*The degree is a property of the intension of a relation

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

Examples of degrees of relations

A
  • Unary relation (one attribute)
  • Binary (two attributes),
  • Ternary (three attributes),
  • n-ary
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the cardinality of a relation?

A

The cardinality of a relation is the number of tuples it contains

  • The cardinality is a property of the extension of a relation. The cardinality is therefore determined
    from the particular state of the relation at
    any given moment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

List the properties of a relation.

A
  • A relation must have a distinct name
  • Each cell of a tuple’s relation consists of exactly one atomic (single) value
  • Each attribute must have a distinct name
  • The values of an attribute are all from the same domain
  • The order of attributes does not matter
  • The order of tuples does not matter
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Define a relational key

A

One or more attributes are needed to uniquely identify each tuple in a relation.

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

Give the different types of relational keys

A

1.Superkey- an attribute or a set of attributes that uniquely identifies a tuple within a relation
2.Candidate key- an attribute, or set of attributes, in a relation that can uniquely identify any tuple without referring to any other data
• A candidate key is therefore a special subset of a superkey
• Each relation may have one or more candidate keys, but one candidate key is special, and it is called the primary key
3. Primary key- The candidate key that is selected to
identify tuples uniquely within the relation
• Candidate keys that are not selected to be the primary key are called alternate keys
4.Foreign key-An attribute, or set of attributes, within
one relation that matches a relational key of another relation
5.Composite key- A relational key that is made up of more than one attribute

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

Describe integrity constraints and give the different types with examples (actual relations)

A

Integrity constraints are a set of rules. It is used to maintain the quality of information based on guidelines set by the database administrator

1.Domain constraints - the definition of a valid set of values for an attribute. (Data types) Eg no strings in age attribute
2.The entity integrity constraint states that primary key value can’t be null. Draw a table with one tuple with a null value
3.Referential Integrity Constraints -specified between two tables. In the Referential integrity constraints, if a foreign key in Table 1 refers to the Primary Key of Table 2, then every value of the Foreign Key in Table 1 must be available in Table 2. Draw two tables one with more tuples than the other
4.Key constraints
Keys are the entity set that is used to identify an entity within its entity set uniquely. Draw table with two tuples with same PK
5.A CHECK integrity constraint on a column or set of columns requires that a specified condition be true or unknown for every row of the tabl

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

What is a base relation?

A

A named relation corresponding to an entity in the

conceptual schema, whose tuples are physically stored in the database

17
Q

Describe entity integrity.

A

In a base relation, no attribute of a primary key can be null. Null represents the absence of a value

18
Q

Describe referential integrity

A

if a foreign key (FK) exists in a relation, the FK value must match a candidate key value of some tuple
in its home relation

19
Q

Describe general constraints

A

Additional rules specified by the users or database

administrators of a database that define or constrain some aspect of the enterprise

20
Q

What is a view?

A

the dynamic result of one or more relational operations operating on the base relations to define another
relation without changing the original relation

21
Q

What is the purpose of a view?

A
  • Views provide confidentiality by hiding parts of a relation that are not relevant to a user
  • Views permit users to access data in a way that is customized to their needs
  • Views can simplify complex operations on the base relations
22
Q

The relational data model emphasizes two principal integrity rules. Define the rules and state
why it is desirable to enforce each of these rules

A

Entity integrity- It says that no component of a primary key may be null.
Referential integrity
The referential integrity constraint is specified between two relations and is used to maintain the consistency among tuples of the two relations. The referential integrity constraint states that, a tuple in one relation that refers to another relation must refer to the existing tuple in that relation.

Integrity constraints ensure that the data insertion, updating, and other processes have to be performed in such a way that data integrity is not affected.
Thus, integrity constraint is used to guard against accidental damage to the database.