Databases Flashcards

1
Q

Database

A

An organised collection of related data

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

Flat file database

A

A database where all the data is stored in a single table.
Can be sufficient if there is a small amount of data.
Useful when data is mostly static (doesn’t change frequently)

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

Relational database

A

Where The data is held in more than one table and they are linked together using relationships.

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

Field

A

Column
Provide category headings for each item

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

Record

A

Row
A collection of data for a set of fields.

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

Primary key

A

A field that uniquely identifies each record in the table.
A table can have only one primary key. Must be unique and can’t be null.

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

Foreign key

A

A field in a table that appears as the primary key in another table. Used to join tables.

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

Data consistency

A

When a database transaction can only change data in acceptable ways - must follow pre-defined rules and constraints.
If a record is updated by a user, any user accessing this record should also receive the update.
Ensures uniformity and accuracy

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

Data redundancy

A

When there is duplication of data or unnecessary data is kept in the database.
Can happen when the same data is repeated in two or more fields, or the same field is repeated in two or more tables.
If a change is made in one place, not all the instances of the data will have the same value.

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

Data independence

A

When the database is designed in a way that reflects the natural relationships between entities and is not structured in a way that suits a specific application.
When changes are made they will not affect the existing database applications.

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

Data integrity

A

Maintaining and ensuring the reliability of the data in terms of its accuracy, completeness and consistency over its lifecycle.
Everybtable must have a primary key.
The primary key for each record must be unique and not null.

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

Domain integrity

A

Every attribute in a relational database is associated with a domain - the set of allowed values the attribute can contain.

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

Referential integrity

A

If a record is added to a table and a valuenis entered into a foreign key field, the value must exist in the primary key field of another table.
In some cases, the foreign key can be null if there is no relationship.

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

First normal form

A

Each record has a primary key
Data is atomic
Records have no repeating groups of attributes

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

Second normal form

A

No partial dependencies

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

Third normal form

A

No non-key dependencies.
Data does not depend on fields that are not the primary key.

17
Q

Normalisation

A

Technique to help reduce dat duplication, resulting in an improvement in data integrity.

18
Q

SQL to delete a database

A

DROP DATABASE DatabaseName;

19
Q

SQL to delete a table

A

DROP TABLE tableName;

20
Q

SQL select statement

A

SELECT field1, field2 (or * for all)
FROM tableName;
WHERE criteria

21
Q

SQL insert code

A

INSERT INTO tableName (field1, field2, …)
VALUES (‘value1’, ‘value2’, …)

22
Q

SQL delete code

A

DELETE FROM tableName
WHERE criteria;

23
Q

Serialisation

A

When two or more transactions are executed concurrently, the effect should be the same as if they had been executed serially.
They cannot interfere with each other.

24
Q

Record locking

A

A method to allow concurrent transactions. The DBMS (Database Management System) will lock the affected record until the update is complete.
Might cause a slight delay to others.
Under some circumstances deadlock can occur.

25
Q

Timestamp ordering

A

Each record has two timestamps: last read and last updated

26
Q

ACID

A

Atomicity: the components of a transaction are indivisible - the whole transaction must succeed or fail.

Consistency: ensures that an illegal transaction is rejected so that the integrity of the transaction is upheld.

Isolation: ensures that each transaction will be isolated and dealt with in a way that does not affect others.

Durability: ensures that data is saved once a transaction is complete. Even if there is a hardware failure immediately after a transaction, the data will be safe.