databases Flashcards

1
Q

what is a

database

A

an organised collection of data

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

organising

data in a database is

A
  • easy adding
  • ability to modify
  • deletion
  • searching
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

electronic databases =

A
  • easy to add, retrieve, delete, update and modify data
  • easy to back up
  • can be accesed by multiple poeple at the same time from different locations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

flat file

A

A flat file is a database that consists of a ​single file. The flat file will most likely be based around a single entity and its attributes

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

advantages of

flat file

A
  • quick to set up
  • require little expertise to maintain
  • suitable for small amounts of data

eg: storing contact detales, playlist

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

drawbacks of

flat file

A
  • take up uncessary space
  • be slow to query
  • become increasingly difficult to maintain
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

relationship

A
  • recognisesthe differences between entities by creating different tables for each entity
  • need a common field for the relationship to work

the link between two tables

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

Primary Key

A

A primary key is a unique identifier for each record in the table

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

Foreign Key

A

A foreign key is the attribute which links two tables together. The foreign key will exist in one table as the primary key and act as the foreign key in another

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

Secondary Key

A

A secondary key allows a database to be searched quickly

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

One-to-one

A

Each entity can only be linked to one other entity

relationship between a husband and wife. 1 wife to 1 husband

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

One-to-many

A

One table can be associated with many other tables, such as a mother having multiple children. Similarly, multiple child entities can be linked to the same mother entity.

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

Many-to-many

A

One entity can be associated with many other entities and the same applies the other way round. An example is students and courses - each student can enrol in more than one course and each course can have more than one student.

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

normalisation

A

The process of coming up with the best possible layout for a relational database

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

normalisation tries to acomplish:

A

No redundancy​ (unnecessary duplicates).
● Consistent data​ throughout linked tables.
● Records can be​ added and removed without issues.
● Complex ​queries ​can be carried out.

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

first normal form (1NF)

A

There must be ​no attribute​ that contains ​more than a single value
1) all field names must be unique
2) values in feilds should be from the same domain
3) values in fields should be atomic (single value)
4) no two records can be identical
5) each table needs primary key

17
Q

second normal form (2NF)

A

1) already in 1NF
2) any partial dependencies have been removed

18
Q

to fix

many to many tables

A

1) create link tables
2) assigning the primary key from the two linking tables as the composite key from the new linking table
3) flip the M:M crows feet to become two 1:M relationships joined by the new table

19
Q

third normal form 3NF

A

1) data already in 2NF
2) any transitive dependances (non-key) has been removed

all keys are dependant on the key, the whole key and nothing but the key

20
Q

why should

all field names must be unique

1NF

A

to avoid confusion about which record should be retrieved or updated

21
Q

1NF

values in feilds should be from the same domain

because

A

each feild must contain the same type of data

22
Q

values in fields should be atomic (single value)

because

A

each field should only contain a single item of data

23
Q

1NF

no two records should be identical

because

A

duplicarte data take up space unnecisarly and can cause inconsistances if updates are not performed on all of them

24
Q

1NF

each table needs primary key

because

A

a field or several fields (composite key) that gives a record of a unique identity

25
Q

2NF

needs to already be in 1NF

A

a partial dependancy means one or more feilds depend on only part of the primary key

26
Q

2NF

remove of partial dependances

because

A

this sitch can occur if the primary key is a composite key comprised of more than 1 field

27
Q

2NF

fix any M:M relationships

because

A

we are aiming to make sure every table seves a single purpose

28
Q

3NF

remove any transitive dependances

A

to ensure that non-key fields are not dependant on each other