DS L9 Flashcards

1
Q

What is a database transaction?

A

A logical unit of database operations which are executed as a whole for retrieving data or updating the database.

Examples include borrowing or reserving a book.

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

What is the purpose of transaction management?

A

To ensure that all updates to the database are completed successfully or none at all, maintaining data integrity.

This is achieved through a transaction log.

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

What are the four properties of transactions known as ACID?

A
  • Atomicity
  • Consistency
  • Isolation
  • Durability

These properties ensure reliable processing of database transactions.

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

What is atomicity in the context of transactions?

A

Ensures that all operations within the work unit are completed successfully; otherwise, the transaction is aborted, and previous operations are rolled back.

This is crucial for maintaining the integrity of the database.

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

What does consistency ensure in transactions?

A

Any transaction brings the database from one valid state to another, ensuring data validity according to defined rules.

This includes referential integrity constraints.

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

What is isolation in transactions?

A

Enables transactions to operate independently and transparently of each other, supporting concurrent database use.

This prevents interference between transactions.

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

What does durability guarantee in a transaction?

A

Ensures that the result of a committed transaction persists in case of a system failure.

This means once a transaction is committed, it remains so even if a crash occurs.

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

What is a transaction log?

A

A record that keeps track of all transactions that update the database, storing the pre-image of records to be updated.

This log facilitates rollback in case of abnormal terminations.

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

What is the rollback process?

A

A process triggered to restore an inconsistent database to its original state using the pre-image in case of abnormal termination of a transaction.

This occurs when there is a power failure or other interruptions.

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

What SQL command is used to start a transaction in MySQL?

A

START TRANSACTION or BEGIN.

This command is necessary to initiate a transaction before executing any SQL operations.

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

What is concurrency control?

A

A mechanism that manages simultaneous operations without conflicting, ensuring database integrity.

It is essential in multi-user database environments.

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

What are the two major types of concurrency control?

A
  • Pessimistic concurrency control
  • Optimistic concurrency control

Each type has its own method of handling data access and conflicts.

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

What is pessimistic concurrency control?

A

A method that locks records before updates, preventing other transactions from accessing the same data simultaneously.

This approach can limit concurrency but ensures data consistency.

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

What is optimistic concurrency control?

A

A method where records are not locked, and updates are validated through a versioning mechanism.

It allows higher concurrency but requires additional checks.

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

What is a deadlock?

A

A situation where two or more transactions are waiting indefinitely for resources locked by each other.

Deadlocks can severely affect database performance.

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

What are the four conditions for deadlock?

A
  • Non-sharable resources
  • No preemption
  • Multiple independent requests
  • Circularity in the graph of requests

These conditions must exist simultaneously for a deadlock to occur.

17
Q

What is the role of the Personal Data (Privacy) Ordinance of Hong Kong?

A

It outlines principles for the ethical use and protection of personal data collected from individuals.

The ordinance includes six key principles.

18
Q

What are the six data protection principles outlined in the Personal Data (Privacy) Ordinance?

A
  • Purpose and manner of collection
  • Accuracy and duration of retention
  • Use of personal data
  • Security of personal data
  • Information to be generally available
  • Access to personal data

These principles guide data users in handling personal data responsibly.

19
Q

What is access control in the context of data privacy?

A

A mechanism that restricts user access to only necessary data to prevent unauthorized access.

It involves granting specific privileges for database operations.

20
Q

What is the main concern of data privacy?

A

The protection of identifiable information of individuals or organizations when collected and stored.

Ethical use and prevention of unauthorized access are critical aspects.

21
Q

True or False: MyISAM storage engine in MySQL supports transaction management.

A

False.

The InnoDB and BDB storage engines support transaction management.

22
Q

What is the main difference between pessimistic and optimistic concurrency control?

A

Pessimistic concurrency control uses locks, while optimistic concurrency control does not lock records but checks version numbers for updates.

This leads to different performance and scalability outcomes.

23
Q

Fill in the blank: Data privacy is concerned about the _______ of identifiable information.

A

[protection]

This includes both personal and organizational data.