Databases Flashcards

1
Q

Entity Relationship Database:

A

Allows to visual how data will be organised

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

One to one relationship:

A

A record in one table relates to only one record in another.

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

One to many relationship:

A

A record in one table relates to multiple records in another table

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

Many to many relationship:

A

Not desirable, means a table isn’t fully normalised, not to 3NF

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

Primary Key:

A

Entity identifiers which are used to uniquely identify each entity in a table. (represented with a line)

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

Composite Primary Keys:

A

Multiple fields combined to form a composite primary key

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

Foreign Keys:

A

When an attribute appears in multiple tables and it is the primary key in one table, it is a foreign key in the other.

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

Normalisation:

A

To reduce redundancies (duplicated data), ensure data is stored logically, reduce the amount of storage space used.

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

First Normal Form:

A

Data must be atomic (a cell only has one value), each record is unique

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

Second Normal Form:

A

Must already be in 1NF, must only be a single column primary key (no composite primary key)

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

Third Normal Form:

A

Must already be in 2NF, no transitive functional dependencies

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

Atomic Data:

A

Each cell only holds one value.

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

Single Column Primary Key:

A

No composite primary key.

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

Functional Dependencies:

A

An attribute uniquely determines another attribute.

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

Transitive Functional Dependencies:

A

Functional dependencies which don’t rely on the primary key.

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

What does SQL stand for:

A

Structured Query Language

17
Q

What does DDL stand for:

A

Data Definition Language

18
Q

DDL uses:

A

Create and delete tables and databases

19
Q

SQL uses:

A

Select, insert, update, and delete

20
Q

Example of SELECT:

A

SELECT *
FROM table
WHERE Attribute = ‘example’
ORDER BY Attribute 2 Asc;

21
Q

Example of INSERT:

A

INSERT INTO Table (Attribute1, Attribute2)

VALUES (‘Example’, 123);

22
Q

Example of UPDATE:

A

UPDATE table
SET Attribute = ‘example’
WHERE Attribute2 = ‘example2’;

23
Q

Example of DELETE:1

A

DELETE FROM table

WHERE Attribute = ‘example’;

24
Q

Example of DDL create database:

A
CREATE TABLE TableName(
Column1 datatype
Column2 datatype
Column3 datatype
);
25
SQL datatypes:
TEXT, INTEGER, NUMERIC, REAL, BLOB
26
Example of DDL drop:
DROP TABLE TableName;
27
Constraints:
Rules for data e.g. unique, or not null.
28
Client Server Database:
Allows for simultaneous access to a database
29
Client Server Database Advantages:
Improved data sharing Minimised data inconsistency Improved data security
30
Client Server Database Disadvantages:
Concurrent Access
31
Concurrent Access:
Two people accessing/editing the same data at the same time
32
Solving concurrent access:
Record Locks Timestamp/ordering Commitment Serialisation = ordering or commitment
33
Record Locks:
Locks a record when someone is using it
34
Serialisation:
Each query is scheduled to happen one after the previous query.
35
Timestamp ordering:
Each query is assigned a timestamp, so if two querys are on the same record, the earliest happens first.
36
Commitment Ordering:
If a record is dependant on another, then this query will happen first.