Database Definition Flashcards

1
Q

What is an entity?

A

An entity is the object / thing of interest about which data is to be recorded (a table in SQL).

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

What is an attribute?

A

An attribute is property of an entity (a field in SQL).

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

What is a relationship?

A

A relationship is the link or association between entities (primary keys ←→ foreign keys)

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

What is a key (in a database)?

A
  • A key is the name given to a special field in a database where the values in the field can be used to identify particular records, e.g. CustomerID.
  • Sometimes a field that is already in the database can be used as the key field.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a primary key?

A

A key which has a unique value for each record, and acts as a unique identifier for each record

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

Give three problems with a flat file database:

A
  1. One small change can involve tediously changing many records
  2. Deleting the only instance of a record containing a particular category will also delete that category
  3. You can’t add a new category until you create a record that contains that particular category
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you solve the problems with flat file databases?

A
  • Relational databases that are made up of two or more linked tables.
  • Linked tables can be used to find records which are linked together by using the value of the shared key column. They are a feature of relational databases.
  • This shared key column acts as the primary key in the table in which its defined, and as a foreign key in the table it is used.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a flat file database?

A

A simple store of information
- Columns are called fields
- Rows are called records
- A table is a group of records

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

What does DDL stand for (in SQL)?

A

Data Definition Language

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

What does DML stand for (in SQL)?

A

Data manipulation language

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

What is a foreign key?

A

An attribute in one table that is the primary key field of another table.
It exists to make a link between the tables.

The name is misleading as it don’t have to be a key in the foreign table

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

What is a composite key?

A

A key composed of two or more attributes that together uniquely identify a record.

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

When is normalisation (database) achieved?

A
  • When there is no redundant data and all related data is stored together
  • (When each attribute depends on the key, the whole key and nothing but the key)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the saying for databases to be fully normalised?

A

“Each attribute must depend on the key, the whole key, and nothing but the key”

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

What are the requirements for 1st normal form?

A
  1. Every record has a primary key
  2. No repeating groups → must include a copy of the primary key in the new table (creating a composite key)
  3. The data in each field must be atomic (i.e. data cannot be sensibly subdivided e.g. name → fname & sname)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a repeating group?

A

A set of attributes whose structure repeats between rows

17
Q

Requirements for 2nd normal form

A

No partial dependencies
this means…
- Do all non-key attributes depend on all parts of the composite key?
- If not, take them out and create a new entity.
(So check all tables with composite keys)

18
Q

Requirements for 3rd normal form

A

No non-key dependencies
- All non-key attributes are checked to see if they are only dependent on the primary key.

19
Q

How do you signify the key in an entity relationship diagram?

A

Underlining

20
Q

Problems that can occur with databases that are not fully normalised

A
  • Redundant/duplicated data may waste storage space
  • If data is stored more than once then it could be inconsistent // two copies of the ‘same’ data item might store different values
  • If data is stored more than once then each copy of the data would need to be updated if it changed
  • It might not be possible to store data about one type of entity without creating a record for another type of entity // if a record for one type of entity does not exist then it might not be possible to store data about another type of entity
  • When a record for one type of entity is deleted it might delete the data about another type of entity // it might not be possible to delete a record for one type of entity without deleting the data about another type of entity
  • May be difficult to select/edit data if it is not atomic // if there are repeating groups