1.3.2 databases Flashcards

some notes on paper and some rewritten from flashcards as stuff i didn't get

1
Q

what is a database

A
  • An organised collection of data (persistent organised store of related data)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what does organising data in an electronic database allow for? (advantages)

A
  • easier + quicker adding, modification, deletion, updating and searching
  • easier to back up data
  • can be accessed by multiple people at the same time from different locations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is data

A
  • information stored which can to be personal in some cases
  • it can be collected and analysed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is information

A
  • facts and details about a certain thing in context.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is knowledge

A
  • something humans obtain/acquire and remember by reading or searching up topics to broaden understanding.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is a relational database

A
  • Where data is stored in tables grouped by entity and linked (related) together.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is a relationship and what is needed in both tables for it to work

A
  • link between tables
  • we need a common field in both tables for relationship to work
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

when designing a relational database and linking tables, relationships come in what 3 forms?

A
  • one-to-one
  • one-to-many
  • many-to-many
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what do we use to sketch the relationships between tables

A
  • entity-relationship diagram (ERD)
  • can also call it entity-relationship model
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is a flat file database. what is a suitable use for this type of database (think in terms of quantity of data)

A
  • A database with multiple independent tables or only 1 table
  • no links between tables
  • suitable to store small amount of data e.g contact details, small product database, maintain game/music collection
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is a flat file database normally saved as

A
  • a comma-separated values file (CSV)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what are the positives to a flat file database

A
  • simple + require little expertise to maintain
  • quick to set up
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what are the downsides to a flat file database

A
  • no links –> inefficient
  • can become difficult to maintain and update
  • not easy to query
  • data can be easily duplicated (take up unnecessary space due to redundancy)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what are the advantages of a relational database

A

Data Integrity
Linked tables
Easier to change format
Provides security features

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

what is a primary key

A
  • field in a table that is unique for every record
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what does the primary key ensure for each record

A
  • primary key ensures that each record is distinct from the others.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

what is a foreign key

A
  • it’s the unique primary key field of one table that is stored in another for purpose of creating a link between the tables.

(linking field in a table that is a primary key in a related table)

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

fill the gaps:

  • a foreign key value must have a corresponding _________ ____ value in another _____
A
  • primary key
  • table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

In order to combine information from two tables, there must be a what?

A
  • there must be a primary/foreign key pair.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

what are composite keys are made up of.

A
  • more than one attribute
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

give an example of composite key used for taking one school course

A
  • none of the attributes on their own (Subject and StudentID) can be guaranteed unique.
  • But, a student can only enrol for a subject just once so combination of  Subject and StudentId will be unique.
  • Combining these two attributes will form a composite primary key. (to uniquely identify a record)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

what is a secondary key

A
  • a field by which records are likely to be searched and is therefore indexed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

what is meant by “indexed”

A
  • process of creating a linked list (database index) to improve speed of data retrieval operations on a dataset table at the cost of additional writes and storage space to maintain the index data structure.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

why do we consider using secondary keys

A
  • we may wish to search by field other than primary key
  • filed being indexed takes up extra space but speeds up searching
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

what is an entity

what are the 2 types of entity existence (1st begins with p and 2nd begins with c)

A
  • real world object that we want to store data about.
  • physical existence e.g. a customer / product
  • conceptual existence e.g. an order / booking
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

There is a standard notation for describing entities. what is it

A
  • standard notation for describing entities:

EntityName (PrimaryKey, attribute1, attribute2, attribute3, …)

27
Q

how is each specific entity uniquely identified (use of what key and what is it)

A

Each specific entity is uniquely identified by a primary key.

  • an attribute, or set of attributes, that will allow that entity to be identified
28
Q

what is an attribute

A
  • A property of an entity.
29
Q

each attribute will have a specific what?

A
  • data type
30
Q

what is a record

A
  • All fields relevant to an entity (row of table)
  • stores data relevant to specific entity
  • also called tuple
31
Q

within a table, we should make sure each record is what

A
  • uniquely identifiable
32
Q

if each record within a table needs to be uniquely identifiable, what must there be at least one of

A
  • one field (column) in each record (row) that is guaranteed to be unique
  • this field is known as primary key
33
Q

what is a field and what does each column represent

A
  • column in a table
  • each column represents an attribute
34
Q

what are serial files

A

Serial files: I.e. bank statements (data stored in order entered, no order maintained)

35
Q

what are sequential files

A

Sequential files: data stored in order of key field

36
Q

if identification of a suitable primary key field is more difficult, what is the solution?

A
  • solution = allocate a number as the primary key (e.g. student ID, employee ID).
37
Q

Most database management systems will allow you to specify that a primary key field is what?

A
  • Most  DBMS’s will allow you to specify that such a field is auto-incremented (for the next record).
38
Q

It is also possible to have a primary key that is made up of more than one attribute. What is the technical name for this?

A
  • primary key made up of more than one attribute = a composite primary key.
39
Q

what is a set?

A
  • collection of distinct elements / collection of records stored in a table.
40
Q

what do databases avoid and what can they have different levels of

A
  • databases avoid redundancy
  • can also have levels of access for different users
41
Q

what is data integrity

A
  • refers to process of maintaining consistency, accuracy + reliability of data in a database
  • is of prime importance in any computer system
42
Q

What 2 techniques can help ensure data integrity.

A
  • Validation and verification techniques
43
Q

what can cause reduced data integrity

A
  • duplicate data
  • inaccurate data (information produced from systems with inaccurate data will be discredited)
44
Q

what is Referential Integrity.

A

– accuracy + consistency when data is referenced.

  • Ensuring that changes are consistent across a database e.g if a record is removed, all references to it are removed.
45
Q

what does referential integrity prevent from happening

A
  • prevents operation that could damage relationships between tables (e.g. deleting a table that is linked to another in a database)
46
Q

What is the benefit of enforcing referential integrity on relational databases

A
  • improving data integrity with relational databases, by enforcing referential integrity.
47
Q

Fill the gaps: referential integrity

the underlying system will ensure that when a _______ is added to a table and a value is entered into a _______ key field, the value exists in the ________ key field of the related table.

A
  • record
  • foreign
  • primary
48
Q

what is a database management system (DBMS)?

A
  • a software package that allows a database administrator to maintain one or more relational databases.
49
Q

describe some features of a Database Management System

A
  • allows different apps to access data at same time
  • provide backups +ability to restore backup
  • controls access to data (security features provided to limit who can do what)
  • supports a query language used to extract, add + amend data and alter database structure
  • can enforce referential integrity and controls concurrency (can lock data while someone working on it so data isn’t amended at same time)
  • hides complexity of physical implementation (allows the administrator to define the database structures at a conceptual or logical level)
50
Q

why is there a need to separate the database from the program

(hint: explain why DBMS is regarded as a guardian of the data and what this means apps can’t do + the implication of it if that scenario did happen)

A
  • DBMS acts as guardian of the data and any app needing to access data has to do so via guardian. This prevents apps from handling data wrongly which could compromise integrity of database
  • if code of programs are edited, programmers don’t need to worry about compromising data (it’s stored elsewhere)
51
Q

what is a query language and give example

A
  • commands an app will use to reference database and extract, update, delete or add data
  • SQL
52
Q

when it comes to retrieving data, an app is querying the database.

What does this mean

A
  • querying the database means asking it questions to find required data
53
Q

what is a dependency

A
  • every other field depends on primary key
54
Q

what is a partial dependency

A
  • one or more of fields depend on part of primary key
  • arises when a table has a composite key
55
Q

different database queries happening often results in multiple what?

A
  • multiple transactions taking place
56
Q

what should the transaction process never cause and why

A
  • a database to become inconsistent or corrupt
  • if database becomes inconsistent, we can no longer guarantee accuracy
57
Q

what does it mean if a cascade delete restrain is enforced on the primary key relationship between tables

A
  • means referential integrity is maintained
  • if a record is deleted from one table, any associated rows from another table are also deleted
58
Q

what is a Transaction

A

 A single logical unit of work. A transaction can be single operation but most = multiple steps.

59
Q

what is Concurrent Processing

A

A concurrent request is one that is made at the same time as another.

60
Q

how is concurrent processing managed

A

managed by use of serialisation, record locks, commitment ordering and timestamp ordering.

61
Q

what is Serialisation

A

concept that, when two or more transactions are executed concurrently, the effect should be the same as if they had been executed serially.

62
Q

what is Record locking

A

common method to allow concurrent transactions by locking records.

63
Q

what does ACID stand for

A

Atomicity
Consistency
Isolation
Durability