topic: databases Flashcards

(8 cards)

1
Q

define a foreign key and its use

A
  • its a primary key from one table used as an attribute in another table
  • it links tables / represent relationship
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

define a primary key

A
  • a unique identifier
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

describe the form a table has to be in for it to be in 1NF

A

each field has a unique name
no fields representing grouped data
data is atomic
has a primary key/ each record is unique

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

describe the form a table has to be in for it to be in 2NF

A

Is in First Normal Form
Every field is dependent on every part of the primary key - if primary key is not composite this will be met already

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

describe the form a table has to be in for it to be in 3NF

A

data is in the 2NF
non-key field depend only on the one primary key

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

what’s one advantage and one disadvantage in indexing a random field

A

pro - Searches of the field can be performed more quickly
con - The index takes up extra space
in the database

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

The user’s password is passed to a function that generates a hash and the result is stored in
passwordHash.
Describe what is meant by the term ‘hash’.

A

a result generated by applying an algorithm/numeric
process to a value

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

what is a pro of storing a password as a hash

A

hash functions are one way/can’t be reverse
if someone gains access to the database they cannot
access user’s password

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