Databases Flashcards

(53 cards)

1
Q

What is a database?

A
  • An organised collection of data
  • It allows easy storage, retrieval and management of information
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the benefits of electronic databases?

A
  • Easier to add, delete, modify and update data
  • Data can be backed up and copied more easily
  • Multiple users, from multiple locations, can access the database at the same time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a field?

A
  • A single piece of data in a record
  • Columns
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a record?

A
  • A group of related fields, representing one data entry
  • Rows
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a table?

A
  • A collection of records with a similar structure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a primary key?

A
  • A unique identifier for each record in a table
  • Usually an ID number
  • The primary key for all different entries MUST be different
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a compound primary key?

A
  • A combination of two or more fields that is unique for all records
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a foreign key?

A
  • A field in a table that relates to the primary key in another table
  • Used to link tables and create relationships
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a secondary key?

A
  • A field or fields that are indexed for fast searching
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a database management system (DBMS)?

A
  • Software used to manage databases
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is indexing?

A
  • Indexing is a technique used to speed up data retrieval in a database
  • Certain columns can be indexed so the DBMS does not have to look at every single record during a search
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a flat file database?

A
  • One that stores all data in a single table
  • It’s simple and easy to understand but causes data redundancy, inefficient storage and is harder to maintain
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a relational database?

A
  • One that organises data into multiple different tables
  • It uses keys to connect related data which reduces data redundancy, makes efficient use of storage and is easier to maintain
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is normalisation?

A
  • The process of organising a database to reduce data duplication and improve data accuracy and consistency
  • Enhances data efficiency and maintainability
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is required for first normal form (1NF)?

A
  • Contain atomic values (each column in a table must contain single, indivisible values)
  • Have no repeating groups (columns must not contain arrays or lists)
  • Have unique column names
  • Have a unique identifier (primary key)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is required for second normal form (2NF)?

A
  • Must be in first normal form
  • Only apply to tables with a compound primary key (more than one primary key)
  • Have full functional dependency: all non-prime attributes must be fully dependent on the primary key
  • Have no partial dependencies: non-prime attributes must not depend on only part of the primary key
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is required for third normal form (3NF)?

A
  • Fulfil all second normal form requirements
  • Have no transitive dependencies: non-prime attributes must not depend on other non-prime attributes
  • Each non-prime attribute MUST depend on the primary key
  • Have separate tables for attributes with transitive dependencies, and the table should be linked using a foreign key
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is an entity?

A
  • Something worth of capturing and storing data about
  • Entities become tables in relational databases
  • Relational databases store different entities in different tables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are the different types of entity relationships?

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
20
Q

What is resolving many to many relationships?

A
  • Many to many relationships can not exist in an actual database and need to be resolved
  • This involves creating a new table known as a “link” table that goes between the identities
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How can data be captured?

A
  • Forms
  • Optical mark recognition (OMR)
  • Optical character recognition (OCR)
  • Sensors
  • Barcodes
  • Data mining
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is optical mark recognition?

A
  • Detects marked areas on paper by using a special machine to read marks
  • Used for exams, surveys and lottery tickets
  • Automates data collection and entry
23
Q

What is optical character recognition?

A
  • Converts printed or handwritten text into a digital format
  • Useful for digitising documents
  • Assists in searching and editing text
24
Q

How do sensors work in data collection?

A
  • Devices that detect and respond to changes in the environment
  • Convert physical signals into digital data
25
How do barcodes work in data collection?
- Machine-readable representation of data using parallel lines of varying widths and spacing
26
What is QBE in data selection?
- Query by example - Allows users to search for data by providing an example of the desired output
27
What are some common query operations?
- FIltering - Sorting - Joining - Aggregation
28
Pros and cons of QBE?
- Pros: easy to learn, visual interface makes it simple to understand, provides a more accessible way to perform database searches - Cons: less powerful and flexible than SQL, may not support advanced database features, can be slower than SQL queries
29
What is CSV?
- Comma Separated Values - Simple data exchange format - Stores tabular data in plain text - Uses commas to separate different values - Widely supported and easy to parse
30
What is JSON?
- JavaScript Object Notation - Lightweight data interchange format - Human-readable and easy to analyse - Uses key-value pairs - Common in web applications
31
What is an EDI?
- Electronic Data Interchange - Standardised electronic communication method - Transfers documents and data between businesses - Reduces paper usage and manual processes - Streamlines transactions and increases efficiency
32
What is an API?
- Application Programming Interface - A set of protocols that allow different software applications to communicate with eachother - Facilitate data exchange between applications and platforms
33
What is referential integrity?
- Ensures consistency between related tables in a relational database - Maintains valid relationships between primary and foreign keys - There must not be foreign keys for which a matching primary key in a linked table does not exist
34
What are the constraints of referential integrity?
- A foreign key must either: - Match a primary key in a linked table - Or be null
35
Cascade actions for referential integrity
- CASCADE: automatically makes changes to related records - SET NULL: sets foreign key value to null in related records - SET DEFAULT: sets foreign key value to its default in related records - NO ACTION/RESTRICT: prevents changes if related records exist
36
Pros and cons of referential integrity
- Pros: ensures data consistency and accuracy, prevents orphaned records - Cons: can impact performance due to additional checks, may require additional planning and design
37
What is a transaction?
- A sequence of database operations treated as one single unit of work
38
What is the aim of transaction processing?
- Ensure data consistency and integrity during simultaneous access
39
What problems arise from transaction processing?
- Concurrency: when multiple transactions occur at the same time, they might try to access the same piece of data, leading to inconsistencies - Deadlock: when two or more transactions are waiting for resources that the other is using - Data integrity: transactions may leave the database in an inconsistent state if they fail mid-execution - Isolation: one user's transaction may affect another user's transaction, leading to unpredictable problems - Durability: if a system fails after a transaction has been confirmed, it may lead to a loss of data
40
What are the solutions to overcome the problems that arise from transaction processing?
- Locking: no two transactions can access the same data simultaneously; shared locks and exclusive locks - Deadlock prevention: ordering the way in which resources are requested - Logging and recovery: system can recover to a consistent state after a crash - Commit and rollback: the commit operation saves all changes made in a transaction. The rollback operation reverts the changes made - Two-phase commit protocol - Concurrency control - Transaction management
41
What is the two-phase commit protocol?
- In distributed systems, this protocol ensures that a transaction is completed in all participating nodes, or none at all, to maintain consistency
42
What is the concurrency control?
- Manages simultaneous access to data in a multi-user environment - The two methods are locking and time-stamping - Locking: prevents multiple transactions from accessing the same data simultaneously - Time-stamping: assigns a unique timestamp to each transaction
43
What is transaction management?
- Uses database management systems (DBMS) with built-in transaction support - Implement custom transaction logic using SQL or other query languages - Test and monitor transactions to ensure ACID compliance and performance
44
What is ACID and what is its aim?
- A set of rules that database management systems (DBMS) must use to ensure data integrity - Stands for Atomicity, Consistency, Isolation and Durability - It guarantees reliable processing of transactions
45
What is atomicity in ACID?
- All operations in a transaction will succeed or fail as a whole - If any operation fails, the transaction is rolled back - Ensures partial transactions do not occur
46
What is consistency in ACID?
- Ensures data remains in a consistent state after a transaction - Transactions must follow database rules and constraints - Starts and ends with a consistent state
47
What is isolation in ACID?
- Transactions are isolated from eachother - Immediate states are not visible to other transactions - Prevents conflict and data inconsistencies
48
What is durability in ACID?
- Committed transactions persist even in case of system failure - Ensures data is not lost once a transaction is complete
49
What is record locking?
- A technique used in database management systems (DBMS) to prevent conflicting access to data by multiple transactions - It ensures data consistency and integrity when multiple users or processes try to read, modify or delete records simultaneously
50
What are the key concepts of record locking?
- Lock: a mechanism that prevents access to a database record while a specific transaction is using the record - Lock granularity: refers to the size of the locked data, ranging from a single row to an entire table
51
What are the types of record locks?
- Shared lock: allows multiple transactions to read a record simultaneously, but prevents modifications or deletions until the record is released - Exclusive lock: allows only one transaction to read and modify a record, blocking other transactions until it is released
52
What are the benefits of record locking?
- Maintains data consistency and integrity by preventing conflicting modifications - Allows concurrent read access to records without compromising data consistency
53
What is data redundancy?
- Can occur when the same piece of data is stored in more than one table in the same database - It can lead to inconsistencies in the data and/or wasted storage