CH 4 - Relational Modelling Flashcards

know how to perfom RESTRICT , CASCADE , NULLIFY, TRIGGERS, draw fk and pk

1
Q

What is a data model in the context of databases?

A

A data model is a representation or a way to organize data for databases.

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

Name three types of data models and briefly describe them.

A

Hierarchical Data Model: Organizes data as a tree structure where a record is linked to only one parent record.

Network Data Model: Organizes data as a network where a record can be linked to other records in an arbitrary way.

Relational Data Model: Organizes data into sets but appears to the user as tables.

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

What are the three main concerns of the Relational Model?

A

Data Structure: How data is represented.

Data Integrity: What data is allowed.

Data Manipulation: What you can do with the data.

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

What are the three components of a data model?

Data Model = Structure + Rules + Manipulation

A

Structure: Concepts in the data model available to store data (e.g., tables).

Rules: Constraints applied to maintain data integrity (e.g., primary keys).

Manipulation: Query language used to create, delete, update, and retrieve data (e.g., SQL).

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

In a relational database, how is data stored and represented?

A

Data is stored in relations (tables),

where each relation has a scheme (heading) that defines the relation’s attributes (columns).
Data takes the form of tuples (rows).

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

What are the properties of relations in a relational database?

A

The tuples (rows) of a relation are unique and unordered.

The number of tuples is called the cardinality of the relation.

The attributes (columns) of a relation are unique and unordered.

The number of attributes is called the degree of the relation.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the role of data integrity in a relational database?

A

Data integrity controls what data can be in a relation.

ensuring the correctness and consistency of data by enforcing domains, candidate keys, primary keys, and foreign keys.

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

What is a domain in the context of attributes in a relational database?

A

A domain is a set of possible values for a specific attribute. Each tuple contains a value for each attribute from the domain of the attribute.

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

What is a candidate key?

A

A candidate key is a set of attributes in a relation that uniquely identifies a tuple and has the properties of uniqueness and minimality.

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

What is a primary key in a relational database?

A

A primary key is one of the candidate keys chosen to uniquely identify tuples in a relation. It cannot contain NULL values, ensuring entity integrity.

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

How is missing information represented in a relational database?

A

Missing or unknown values are represented using NULLs.

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

What is a foreign key, and what does it enforce?

A

A foreign key is a set of attributes in one relation (the referencing relation) that matches a candidate key in another relation (the referenced relation), enforcing referential integrity between the two relations.

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

What is referential integrity, and how can it be violated?

A

Referential integrity ensures that relationships between tables remain consistent.

It can be violated when a referenced tuple is updated or deleted.

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

What are the options to handle violations of referential integrity?

A

RESTRICT: Stop the action that violates integrity.

CASCADE: Let the changes flow on to related records.

NULLIFY: Set the problematic values to NULL.

Triggers: Use user-defined actions to handle the changes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the RESTRICT option do in the context of referential integrity?

A

RESTRICT stops any action that would violate referential integrity, preventing updates or deletions that would break relationships between records.

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

What does the CASCADE option do in referential integrity?

A

CASCADE allows changes made to a referenced tuple to flow through to the related tuples, updating or deleting them accordingly.

17
Q

What does the NULLIFY option do in referential integrity?

A

NULLIFY sets the foreign key values to NULL in the referencing relation when the referenced tuple is deleted or updated, thereby preserving referential integrity without breaking the relationship.