2. Relational Model Flashcards

(9 cards)

1
Q

What are the three core components of a formal logical data model?

A

Structure (how data is organised, e.g., relations)

Integrity Rules (how data is kept correct/consistent)

and Operators (how data is manipulated).

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

What is a Relation?

A

Informally like a table; formally, a set of n-tuples. Tuples (rows) are unordered. Attributes (column headers) are unordered. No two tuples are identical across all attributes. Attribute values must be single-valued (“atomic”)

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

What is a relation heading?

A

Denoted R{A1, A2, …, An}, consisting of a relation name R and a set of attributes {A1, …, An}.
Each attribute draws values from a specific domain. The degree is the number of attributes.

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

What are the keys?

A

◦ Superkey: Any subset of attributes whose combined value is unique across all tuples.
◦ Key (Candidate Key - CK): A minimal superkey (removing any attribute means it’s no longer unique). A relation can have multiple CKs.
◦ Primary Key (PK): One designated CK. The PK uniquely identifies each tuple.

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

Key and Non-Key attributes:

A

A key (prime) attribute is part of some CK.
A non-key (nonprime) attribute is not part of any CK.

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

Domain Integrity Constraint:

A

Values must be from the attribute’s domain (data type, range, etc.).

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

Entity Entegrity Constraints:

A

The PK cannot be null, and the entire PK value must be unique. Implies NOT NULL on PK attributes

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

Referential Integrity:

A

A foreign key (FK) in a referencing relation must match an existing PK value in the referenced relation or be entirely null. Prevents “broken links”.
A FK can reference its own relation (recursive). Oracle doesn’t support ON UPDATE CASCADE natively, requiring triggers.
PostgreSQL does support FK actions like ON DELETE/ON UPDATE CASCADE, SET NULL, RESTRICT, NO ACTION

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

Nulls:

A

A special marker representing “value not known”, “not applicable”, etc..
Comparisons with null (even x = null) evaluate to “unknown” (behaves like false).
IS NULL or IS NOT NULL must be used. Nulls can cause storage issues, make meanings unclear, affect joins/aggregates, break uniqueness checks, and make understanding difficult

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