Module 3 Flashcards

1
Q

What is a relational database?

A

A database organized as a set of relations (tables).

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

What is a relation?

A

A two-dimensional table with rows (tuples) and columns (attributes).

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

What is a tuple in a relation?

A

A row in a table representing a single record.

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

What is an attribute in a relation?

A

A column in a table representing a specific property of entities.

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

What is a relation schema?

A

The structure of a relation, including its name and attributes.

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

What is a relation instance?

A

A specific set of tuples in a relation at a given time.

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

What is a database schema?

A

The collection of all relation schemas in a database.

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

What is a database instance?

A

The actual data stored in the database at a specific time.

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

What is a primary key?

A

A unique identifier for each tuple in a relation.

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

What is a candidate key?

A

A minimal superkey that can uniquely identify tuples.

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

What is a superkey?

A

A set of attributes that uniquely identifies a tuple, but may not be minimal.

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

What is a foreign key?

A

An attribute in one relation that references a primary key in another relation.

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

What is SQL?

A

A structured query language used to interact with relational databases.

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

Why is SQL important in relational databases?

A

It provides a high-level way to retrieve, insert, update, and delete data.

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

How do we convert an entity set to a relation?

A

Create a table with the same attributes as the entity set.

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

How do we convert a many-to-many relationship into relations?

A

Create a separate relation that includes foreign keys from both entity sets.

17
Q

How do we convert a one-to-many relationship into relations?

A

Include the primary key of the ‘one’ entity as a foreign key in the ‘many’ entity.

18
Q

How do we store a relationship set in a relational database?

A

Create a new table containing the primary keys of all participating entities.

19
Q

What is the primary key of a relationship table?

A

The combination of primary keys of all participating entities.

20
Q

How do we handle attributes on relationships?

A

Include them as additional columns in the relationship table.

21
Q

How does the multiplicity of a relationship affect its primary key?

A

In a many-to-many relationship, the primary key includes both entity keys.

22
Q

What is the primary key for a one-to-one relationship?

A

Either entity’s primary key can be used as the relationship’s primary key.

23
Q

What is a weak entity set, and how is it stored in a relation?

A

A weak entity set has no primary key and relies on a strong entity’s key plus a discriminator.

24
Q

What are the three approaches to converting ISA hierarchies to relations?

A

1) Separate tables, 2) Single table with NULLs, 3) Object-oriented method.

25
What is the NULL approach in handling ISA hierarchies?
Use a single relation with NULL values for attributes that don’t apply to all entities.
26
What is the main problem with the NULL approach?
Wasted space due to many NULL values.
27
What does a NULL value represent?
A missing or unknown value in a tuple.
28
How do NULL values affect aggregations in SQL?
NULL values are ignored in aggregation functions like SUM and AVG.
29
What happens when you perform arithmetic operations with NULL values?
The result is always NULL.
30
Why are foreign keys sometimes allowed to be NULL?
To allow relationships where an entity may not always have an associated entity.