Databases Flashcards

Exchanging data

1
Q

What is a database

A

A structured, persistent (held for as long as required) store of data, organised so that it can be easily accessed managed and updated

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

What is a field

A

A single piece of data (represented by columns on a table)

  • Has a specified data type
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a record

A

A collection of fields (rows in a table )

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

What is a table

A

Complete set of records

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

What is a flat-file database

A

A database in which all data is stored in a single table

  • Good for small amounts of data (prone to data redundancy)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define data redundancy

A

When the same data is stored in different locations

  • Wastes space
  • Can lead to errors ( If all instances of the data aren’t changed during updates)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are relational databases

A

Multiple tables linked together.
Each table represents an entity

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

How are relational databases linked

A

They are linked using primary and foreign keys

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

What is an entity

A

An instance of a class (anything which we can store data about)

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

What is a primary key

A

A field that has a unique value (Identifier) for every record in the table

Eg. registration plate (no two cars have the same one

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

What is a foreign key

A

The primary key in one table being used as a field in another table, creating a link

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

What is a secondary key

A

A field by which records are likely to be searched and is therefore indexed

Used when we want to search by a field that isn’t the primary key

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

What is an entity relationship diagram

A

A diagram showing the tables, which hold the entities and their links

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

What does it mean when entities have a one-to-one relationship

A

This is when each instance of an entity connects to a single instance of another entity

Eg. one student will have one mentor

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

What does it mean when entities have a one-to-many relationship

A

This is when a single instance of an entity may be linked to many instances of another entity. (a good way to resolve redundancy)

Eg. A computer science teacher may have many classes

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

What does it mean when entities have a many-to-many relationship

A

This is when multiple instances of one entity may be linked to multiple instances of another entity

Eg. Each order may have many items and each item can be ordered many times

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

How can we get rid of many-to-many relationships

A

Creating a link table containing its primary key and two primary keys from the other tables used as foreign keys (composite key)

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

What is optical mark recognition (OMR)

A

A data input method that recognises the position of marks made on paper

  • Allows you to collect data from printed forms
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is Optical character recognition (OCR)

A

It can be used to convert documents into readable text

Eg. When speed cameras scan car number plates

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

What is the DBMS

A

Database management system - a layer of software that ensures the database is manipulated in a consistent way while ensuring integrity and security

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

Examples of the DBMS

A
  • MySQL
  • Microsoft Access
  • PostgreSQL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What are the two main methods DBMSs offer to manage a database

A
  • Structured query language (SQL)
  • Query by example (QBE)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

what is SQL

A

Structured query language - Used for selecting and updating data within a database.

24
Q

How does QBE work

A

The user has a graphical interface into which required fields can be dropped, as well as allowing the user to set up conditions to filter the results

25
Q

Give some examples of standard data formats that are used to exchange data

A
  • SQL standard query language
  • CSV comma-separated value
  • XML eXtensible markup language
  • JSON JavaScript Object Notation
26
Q

How does SQL work

A

A DBMS can generate a sequence of SQL instructions that when run on a receiving DBMS, will create the relevant tables, relationships and insert data

27
Q

How do CSV files work

A

This is a simple way of exchanging data in a CSV file where each field can be separated by a comma

28
Q

How does XML work

A

This markup language uses tags to designate different things within a document.

In the case of a database, each record could be enclosed within tags, and inside those, each field enclosed within further tags

29
Q

How does JSON work

A

A format that represents things as objects.

In the case of a database, each record is an object that can contain an array of objects that represent the fields.

JSON is beneficial when sending data to a JavaScript program, for example, on a webpage, as JavaScript can read the data directly

30
Q

What is normalisation

A

The process of changing the structure of a relational database to remove the potential for data redundancy

31
Q

What are the stages of normalisation

A
  • Unnormalised form (UNF) - This is before any normalisation
  • First normal form
  • Second normal form
  • Third normal form
32
Q

What is first normal form

A

Data after the first stage of normalisation. Every record has a primary key, no repeating fields, and all are atomic.

33
Q

What is a composite key

A

A primary key is made of two or more fields. While on their own, they may not be unique, each record’s combination of them will be

34
Q

What is second normal form

A

Data after the second stage of normalisation. In 2NF, all data is in 1NF and has no field depending on only part of the primary key.

  • Every field must only depend on all of the primary keys (only applies to tables with composite keys) - we can use a link table to do this
35
Q

What is third normal form 3NF

A

Data in a relational database after the third stage of normalisation. In addition to being in 2NF, every field depends solely on the primary key and no other field.

36
Q

What are the SQL commands you need to know

A
  • DELETE
  • INSERT
  • DROP
  • JOIN
  • AND and OR
  • LIKE
  • WHERE
  • SELECT … FROM
37
Q

what is SELECT … FROM used for (SQL)

A

This is used to retrieve specified fields from a specified table

38
Q

What is FROM used for (SQL)

A

Used to filter the results that are returned

39
Q

What is LIKED used for (SQL)

A

This is used with WHERE to select fields that match a given pattern. It is used with the % wildcard which represents 0 or more characters

40
Q

What is DELETE used for (SQL)

A

Used to delete records

41
Q

What is INSERT used for (SQL)

A

Adds records into a table

42
Q

What is DROP used for (SQL)

A

Used to delete whole tables

43
Q

What is JOIN used for (SQL)

A

Used to combine information. It selects data every time it finds a match between the specified fields

44
Q

What is referential integrity

A

Guaranteeing the consistency of a database by ensuring no record points to another record that doesn’t exist.

DBMS ensures that a change wasn’t made to one table that would impact another table

45
Q

What does referential integrity ensure

A
  • A record cannot be deleted if its primary key appears as a foreign key on another table
  • A value cannot be entered into a foreign key field if there isn’t a corresponding primary key value
46
Q

What is a transaction

A

A group of actions in a database creating a unit of work

47
Q

What is ACID

A

Properties that a transaction must adhere to, to ensure the data within the database remains valid

48
Q

What does ACID stand for

A
  • Atomicity
  • Consistency
  • Isolation
  • Durability
49
Q

what does atomicity refer to (ACID)

A

A change is performed or not performed. Half-finished changes must not be saved

50
Q

What does consistency refer to (ACID)

A

Databases have rules (called constraints) that must be adhered to by all the data they contain.

eg. values representing money must not go below 0

51
Q

What does isolation refer to (ACID)

A

Transactions can only run simultaneously if their end result is the same as if they were run one after another.

Any new transaction is locked until the change is committed, then the new transaction is released.

52
Q

What does durability refer to (ACID)

A

Once made transactions cannot be lost. Changes must be written to storage to preserve them.

53
Q

Why do we need record-locking

A

It is usual for databases to be accessed at the same time.
This can cause issues if they are trying to access the same record at the same time as one person could overwrite the other’s changes.

Record locking avoids this by preventing anyone from accessing a record in use by another person.

54
Q

What is a redundant system

A

One that duplicated the work of another. Eg. a mirror database

This is needed so that if the primary server with the database fails, the mirror can be switched to, preventing loss of service

55
Q

What is a mirror database

A

An identical instance of a database kept on a separate server