Lecture 3: Relational Model Flashcards

1
Q

Explain what a relational Model is.

A
  • in a relational model all data is structured within relations (tables).
  • this is the dominant database solution
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

So what is a relation?

A

table with columns and rows

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

What is an attribute?

A

a column of a relation

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

What is a tuple?

A

a row in a relation.

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

what is a domain?

A

set of allowable values for one or more attributes.

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

Explain the term degree (of a relation).

A

number of attributes it contains

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

Describe Cardinality (of a relation)

A

number of tuples it contains.

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

In a relational model we have constraints that impose restrictions on values in a column or a combination of columns within a table.

What is a constraint?

A

a column or a group of columns must be unique across all rows in the table.

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

Explain what a: Superkey, Candidate Key and Primary Key is.

A

Superkey: attribute or set of attributes that uniquely identify a typle in a relation.

Candidate Key: a superkey such that none if its subset is a superkey for that relation. e.g.

  • its unique
  • itrs irreducible.

Primary Key: the candidate key that is used to uniquely identify tupes in a relation

  • thus, there may be candidate keys, but only one is chosed as PK
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain what a Foreign Key is.

A
  • an attribute or a set of attributes within one relation (home relation), that matches the candidate key in another relation.
  • The foreigner key targets the candidate key in the home relation.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Explain the use of Null

A
  • represents a value that is unknown or the absence of a value
  • null can be used when we dont know the value for an attribute to prevent inserting a false value.
  • stock = 0, stock = null. is not the same
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Name and provide a description of the two Integrity constraints.

A

Entity integrity: no attribute of a primary key can be null

Referential integrity: if a foreign key exists, either the value of the foreign key matches the value of the candidate key in the home relation or the value of the foreign key is null.

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

Give the example of how data can be modeled from different perspectives.

A

Relational Perspective (How the Users view the data):

  • Table, Row, Column

Conceptual Perspective:

  • Relation, Tuple, Attribute

Storage Perspective (Describes the details of how the data is stored in the computer):

  • File, Record, Field
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Explain the constraints:

  • Entity Integrity
  • Referential integrity
  • Domain Constraints
  • Primary Key Constraints
A

Referential Integrity: if a foreign key exist, either the value of the foreign key matches the value of the candidate key in the home relation or the value of the foreign key is NULL

Entity integrity: no attribute of a primary key can be NULL

Domain Constraints: the value of each attribute in each tuple must be from the domain assigned to this attribute

Primary Key Constraints: two distinct tuples in any state of the relation cannot have identical values for all attributes in the key

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