L.03 Flashcards

EER and Relational Modelling

1
Q

What is the purpose of EER modeling?

A

Extends ER modeling to represent the subgroupings that are called subclasses or subtypes.

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

What is the difference between subclasses and superclasses?

A

Subclass: A more specific category of an entity (e.g., ENGINEER is a subclass of EMPLOYEE)
Superclass: A general category that includes multiple subclasses

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

What is an IS-A relationship in EER?

A

A relationship where a subclass is a specific type of a superclass
Example: SECRETARY IS-A EMPLOYEE

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

What is attribute inheritance in EER?

A

A subclass inherits all attributes and relationships from its superclass

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

What are the two basic constraints in EER inheritance?

A

1) Completeness Constraint:
-Total: Every entity in the superclass must be a member of at least one subclass.
-Partial: An entity may or may not belong to a subclass.

2) Disjointness Constraint:
-Disjoint: An entity can belong to only one subclass.
-Overlapping: An entity can belong to multiple subclasses.

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

What are the four combinations of completeness and disjointness constraints?

A

Disjoint / Total
Disjoint / Partial
Overlapping / Total
Overlapping / Partial

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

What is a specialization hierarchy?

A

A tree structure where each subclass can have its own subclasses.
A subtype may itself have further subtypes specified on it.
Example: EMPLOYEE → ENGINEER → SOFTWARE_ENGINEER

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

What is a union type (category) in EER?

A

A subtype that inherits attributes from multiple supertypes
Example: A VEHICLE_OWNER can be a PERSON, COMPANY, or BANK

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

What is the relational model?

A

A formal model based on relations (tables)
Forms the foundation of SQL databases

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

What are the basic components of the relational model?

A

Relations (Tables)
Attributes (Columns)
Tuples (Rows)

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

What is a primary key in a relation?

A

A unique identifier for each tuple (row) in a relation
Must be unique and cannot be NULL

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

What is a candidate key?

A

A set of attributes that can uniquely identify a row
One candidate key is chosen as the primary key.

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

What is a compound (composite) key?

A

A primary key consisting of multiple attributes
Example: HOTEL_ROOM(hotel_name, room_number, guest_name)

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

What is an artificial primary key?

A

A generated unique identifier when no natural key exists
Example: ORDER(order_id, customer, item, amount)

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

What are the rules for selecting primary keys from candidate keys?

A

(1) We usually prefer short keys, e.g., ones that consist only of a single attribute.
(2) We prefer keys that are also often used to identify real-world entities over ones that just happen to be unique.

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

What are NULL values in a relational model?

A

Used when a value is unknown, unavailable, or not applicable.

17
Q

What are the three types of constraints in RM?

A

1) Inherent Constraints – Based on relational model rules (e.g., no duplicate rows).

2) Schema-based Constraints – Defined within the schema (e.g., primary key, foreign key).

3) Application-based Constraints – Enforced by the application (e.g., salary cannot decrease).

18
Q

What are key constraints in relational databases?

A

Primary keys must be unique and not NULL
Each relation can only have one primary key

19
Q

What is referential integrity? Give example

A

A constraint involving two relations. Used to specify a relationship among tuples in two relations:
AKA referencing relation and the referenced relation.
Ensures that foreign keys reference valid primary keys

Example: An EMPLOYEE’s dept_id must exist in the DEPARTMENT table

20
Q

How is referential integrity represented? Give example

A

Foreign keys reference primary keys of other relations

21
Q

How are entities mapped from an EER model to relations?

A

Entities become relations
Attributes become columns
One of the keys becomes the primary key

22
Q

How are relationships mapped from EER to relations?

A

1:N Relationships – Foreign key in the N-side relation.
1:1 Relationships – Foreign key in either relation (but not both).
M:N Relationships – Introduce a new relation with foreign keys for both entities.

23
Q

How is generalization/specialization mapped to relations?

A

Single Table Inheritance – One table for all entities with a type attribute.
Multiple Table Inheritance – Separate tables for each subclass.
Joined Tables – Superclass and subclass tables linked via foreign keys.