Relationship and keys Flashcards

2

1
Q

Keys

A

Key create the relationships between entities

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

Relationships definition

A

How 2 or more entities are linked to another.

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

Primary key definition

A

Primary key in a database is like a unique ID for each row of data.

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

Foreign key definition

A

Foreign keys link data in one table to the data in another table.

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

Alternate key

A

Alternate key associated with one or more columns whose values uniquely identify every row in the table, but which is not the primary key.

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

Secondary key

A

A secondary key is an additional piece of information used to organize and retrieve data.

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

Foreign key example

A

You have 2 tables in a database: one for students and another for classes. In the table for classes, you might have a column that stores the ID of the teacher for each class. That ID is a foreign key because it refers to the ID of a teacher in the table for students

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

Secondary key example

A

To make this search faster, you can create a secondary key based on the author’s name. This secondary key acts like a shortcut, allowing you to directly access all books by a particular author without having to scan through every book in the database.

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

Alternate key example

A

Let’s consider a database for a company’s employees. Each employee is assigned a unique employee ID, which serves as the primary key in the database. Now, let’s say that each employee also has a unique email address. Although the email address is not the primary key, it can still uniquely identify each employee because no two employees share the same email address.

In this case, the email address serves as an alternate key. It’s an alternative way to uniquely identify employees in the database, even though it’s not the primary means of identification. So, if you wanted to look up an employee’s information using their email address, you could do so efficiently because the email address is an alternate key that uniquely identifies them.

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

Primary key example

A

Each student has a unique student ID number assigned to them when they enroll. In this table, the student ID number would serve as the primary key.

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