Database relationships Flashcards

(13 cards)

1
Q

What is a relationship in relational databases?

A

A relationship links two tables in a database using a field that exists in each of the tables.

Relationships are fundamental for organizing data in relational databases.

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

What must exist to create a relationship between two tables?

A

A common field must exist in both tables.

This common field often serves as a primary key in one table and a foreign key in another.

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

What is the primary key in a database?

A

The key field that uniquely identifies a record in a table.

It is essential for establishing relationships between tables.

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

What is a foreign key in a database?

A

A primary key from one table that is stored in another table to establish a relationship.

It helps maintain referential integrity between tables.

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

What are the different degrees of relationships in a database?

A

One to Many, One to One, Many to Many.

These categories help in modeling the relationships between entities.

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

What does a One to Many (1:M) relationship mean?

A

One record in one table relates to many records in another table.

Example: One manager oversees many employees.

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

What does a One to One (1:1) relationship mean?

A

One record in one table relates to one record in another table.

Example: One country has one capital city.

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

What does a Many to Many (M:N) relationship mean?

A

Many records in one table relate to many records in another table.

Example: Many students take many courses.

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

What is an Entity Relationship Diagram (ERD)?

A

A visual representation of the relationships between entities in a database.

ERDs are used to model the structure of a database.

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

Identify an example of a One to Many relationship.

A

1 Manager oversees many Employees.

This relationship shows how one entity can relate to multiple entities.

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

Identify an example of a One to One relationship.

A

1 Country has 1 Capital City.

This relationship indicates a unique pairing of entities.

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

Identify an example of a Many to Many relationship.

A

Many Students take many Courses.

This shows that multiple entities can relate to each other in various combinations.

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

What is the significance of the Pupil ID in the context of relationships?

A

It serves as both a primary key and a foreign key in different tables.

This allows for linking pupil data across multiple tables.

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