chapter 2 Flashcards

(14 cards)

1
Q

Q: What is a relation in the relational data model?

A

A: A relation is a table with rows (tuples) and columns (attributes) in a relational database.

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

Q: What is a tuple in a table?

A

A: A tuple is a single row in a table, representing a single record.

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

Q: What is an attribute?

A

A: An attribute is a column in a table, representing a property of the entity (e.g., Name, Age).

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

Q: What is the schema of a relation?

A

A: The schema defines the structure of a table, including its name, attributes, and data types.

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

Q: Name the four main types of constraints in the relational data model.

A

Domain Constraints: Restrict values in an attribute (e.g., Age must be a number).
Key Constraints: Ensure each row is unique (e.g., Primary Key).
Entity Integrity: The primary key cannot be NULL.
Referential Integrity: Foreign keys must match primary keys or be NULL.

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

Q: What is a primary key?

A

A: A unique identifier for each tuple (row) in a table.

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

Q: What is a foreign key?

A

A: An attribute in one table that references the primary key of another table to create relationships.

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

Q: What is cardinality in a relation?

A

A: The number of rows (tuples) in a table.

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

Q: What is degree/arity in a relation?

A

A: The number of columns (attributes) in a table.

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

Q: What is the difference between a candidate key and a super key?

A

Candidate Key: A minimal set of attributes that can uniquely identify a row.
Super Key: Any set of attributes that uniquely identify a row (may include extra attributes).

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

Q: What is a composite key?

A

A: A primary key made up of two or more attributes.

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

Q: What does the Referential Integrity Constraint ensure?

A

A: It ensures that a foreign key value matches a primary key value in the referenced table or is NULL.

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

Q: What is the difference between a simple and composite attribute?

A

Simple Attribute: Cannot be divided (e.g., Age).
Composite Attribute: Can be divided into smaller parts (e.g., FullName → FirstName, LastName).

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

Q: What is the main purpose of constraints in a relational database?

A

A: To ensure data accuracy, consistency, and integrity.

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