🔒 Pro · Component 1 · 1.3.2 Databases
1.3.2d Database Management Systems (DBMS)
OCR H446 · A Level Computer Science · ~12 min read
Notes
Video
Slides
Worksheet
Quiz

What is a DBMS?

A Database Management System (DBMS) is software that provides an interface between users/applications and a database. Users never interact with the raw data files directly — all access goes through the DBMS. Examples: MySQL, PostgreSQL, Microsoft SQL Server, Oracle, SQLite.

A DBMS provides controlled, organised access to stored data while ensuring security, integrity, and efficiency. Without a DBMS, each application would need to manage its own files, leading to data inconsistency and duplication.

Functions of a DBMS

  • Data storage management: organises how data is physically stored on disk; manages indexes for fast retrieval.
  • Data retrieval: accepts SQL queries and returns the requested data efficiently.
  • Access control / security: manages user accounts and permissions — different users can have different levels of access (read-only, write, admin). Protects sensitive data from unauthorised access.
  • Data integrity enforcement: enforces constraints (primary key, foreign key, NOT NULL, UNIQUE) to ensure data remains valid and consistent. Prevents invalid data from being entered.
  • Concurrency control: manages simultaneous access by multiple users to prevent data corruption. Uses locking mechanisms to ensure transactions do not interfere with each other.
  • Backup and recovery: automatically backs up data and can restore the database to a consistent state after a crash or failure.
  • Transaction management: ensures that groups of operations (transactions) are completed fully or not at all — preventing partial updates that would leave the database in an inconsistent state.

The ACID Properties of Transactions

A transaction is a logical unit of work — a group of one or more SQL operations that must be treated as a single, indivisible operation. For example, transferring money between two bank accounts: debit one, credit another — both must succeed or neither should.

The DBMS guarantees the ACID properties for every transaction:

PropertyMeaning
AtomicityA transaction is all-or-nothing. Either ALL operations complete successfully, or NONE of them are applied. If any step fails, all changes are rolled back. No partial updates.
ConsistencyA transaction brings the database from one valid state to another valid state. All integrity constraints (keys, rules) must hold before and after the transaction. No transaction can violate the database rules.
IsolationConcurrent transactions are executed in isolation — each transaction behaves as if it is the only transaction running. Intermediate states of a transaction are not visible to other transactions.
DurabilityOnce a transaction has been committed (confirmed as complete), its changes are permanent — even if the system crashes immediately afterwards. The data is written to persistent storage.

Concurrency Control

When multiple users access a database simultaneously, problems can occur without concurrency control:

  • Lost update: two users read the same value, both modify it, and the second write overwrites the first — one update is lost.
  • Dirty read: one transaction reads data that another uncommitted transaction has written — if the second transaction is rolled back, the first read invalid data.
  • Incorrect summary: one transaction reads data while another is in the middle of updating it — the summary includes some but not all updates.

The main mechanism used to prevent these is record locking: when a transaction accesses data, it places a lock on it so no other transaction can modify the same data simultaneously. Deadlock can occur if two transactions each hold a lock the other needs — the DBMS must detect and break deadlocks.

Database Schemas

A schema defines the structure of the database — the tables, their columns, data types, and constraints. The schema describes the database's logical structure independently of the data it contains.

In a three-level ANSI/SPARC architecture:

  • External schema (view): the user's view of the data — only the subset they are permitted to see (e.g. a HR user sees employee salary but not performance reviews).
  • Conceptual schema: the logical structure of the whole database — tables, columns, keys, relationships.
  • Internal schema: how data is physically stored on disk — indexes, file structures.

This separation allows the physical storage to be changed without affecting the logical structure, and the logical structure to change without affecting users' views — known as data independence.

Advantages of Using a DBMS

  • Reduces data redundancy through normalisation and centralised storage.
  • Enforces data integrity via constraints.
  • Provides access control and security — user roles and permissions.
  • Supports multi-user concurrent access safely.
  • Provides backup and recovery mechanisms.
  • Data independence — applications are insulated from changes to the physical storage.

Disadvantages of a DBMS

  • High cost of software licences (enterprise DBMS can be very expensive).
  • Complex to set up, maintain, and administer — requires specialist knowledge.
  • Can be slower than direct file access for simple tasks due to overhead.
  • A single point of failure — if the DBMS fails, all applications lose access to data.
Exam tip: Know the ACID properties by heart — exam questions often give a scenario and ask which ACID property is being described. Atomicity = all-or-nothing; Consistency = valid state before and after; Isolation = concurrent transactions don't interfere; Durability = committed changes are permanent.
Exam tip: Concurrency control is a common exam topic. Know the three problems (lost update, dirty read, incorrect summary) and how record locking solves them. Also know what deadlock is.
⚠ Common Mistakes
  • Confusing Atomicity and Durability — Atomicity = a transaction is all-or-nothing (won't be partially applied). Durability = once committed, changes survive crashes (persistent). They are different properties.
  • Saying a DBMS IS the database — the DBMS is the SOFTWARE that manages the database. The database itself is the collection of data. MySQL is a DBMS; your student records are the database.
  • Forgetting that locking can cause deadlock — when discussing concurrency control, mention both the benefit (prevents lost updates) and the risk (deadlock if two transactions wait for each other's locks).
✓ Notes completed!
Video coming soon
Click to advance · Arrow keys also work
Click slide or press arrow keys to navigate

Worksheet — 1.3.2d DBMS

8 questions · 20 marks · instantly marked

Q1What is a Database Management System (DBMS)? State THREE functions it provides.[4 marks]
✓ Mark scheme
A DBMS is software that provides an interface between users/applications and a database, managing all access to stored data [1]; any 3 from: data storage management — organises physical storage and indexing [1]; access control/security — manages user permissions [1]; data integrity enforcement — enforces constraints like PK, FK, NOT NULL [1]; concurrency control — manages simultaneous multi-user access [1]; backup and recovery [1]; transaction management — ensures ACID properties [1].
Q2Explain what a 'transaction' is in database terms. Why is it important that transactions are treated as atomic?[3 marks]
✓ Mark scheme
A transaction is a logical unit of work — a group of one or more SQL operations that must be treated as a single, indivisible operation (either all succeed or none are applied) [1]; atomicity is important because real-world operations often involve multiple steps that must all complete together — e.g. a bank transfer must debit one account AND credit another [1]; if the system crashes partway through, without atomicity the debit would be applied but not the credit, leaving the database in an inconsistent state — money would be 'lost' [1].
Q3State and explain each of the four ACID properties of transactions.[4 marks]
✓ Mark scheme
Atomicity: a transaction is all-or-nothing — either all operations complete or none are applied; if any step fails, all changes are rolled back [1]; Consistency: a transaction brings the database from one valid state to another — all constraints must hold before and after the transaction [1]; Isolation: concurrent transactions are executed in isolation — each behaves as if it is the only transaction running; intermediate states are not visible to others [1]; Durability: once a transaction has been committed, its changes are permanent and survive system crashes — written to persistent storage [1].
Q4Describe the 'lost update' problem in concurrent database access and explain how record locking prevents it.[3 marks]
✓ Mark scheme
Lost update: two users (transactions) simultaneously read the same value; both modify it based on the original value; the second write overwrites the first — one update is permanently lost [1]; e.g. two ticket booking systems both read 'seats available: 1'; both process a booking; both write back 'seats available: 0'; one booking is lost but not recorded [1]; record locking prevents this by allowing only one transaction to hold a write lock on a record at a time — the second transaction must wait until the first releases the lock before it can read or write the record [1].
Q5Explain what 'deadlock' is in database concurrency control. How can a DBMS respond to deadlock?[3 marks]
✓ Mark scheme
Deadlock occurs when two or more transactions each hold a lock that the other needs, and both are waiting for the other to release its lock — creating a circular wait that neither can resolve on its own [1]; example: transaction A holds a lock on Record 1 and waits for Record 2; transaction B holds a lock on Record 2 and waits for Record 1 — both wait indefinitely [1]; the DBMS can detect deadlock and resolve it by aborting (rolling back) one of the transactions to free its locks, allowing the other to proceed [1].
Q6Explain the concept of 'data independence' in a three-level database architecture.[2 marks]
✓ Mark scheme
Data independence means that changes to how data is physically stored (internal schema) do not require changes to the logical structure of the database (conceptual schema) — and changes to the logical structure do not require changes to users' views (external schemas) [1]; this allows database administrators to reorganise physical storage or add new tables without rewriting applications or disrupting users [1].
Q7Give TWO advantages and ONE disadvantage of using a DBMS compared to using flat-file storage.[3 marks]
✓ Mark scheme
Any 2 from advantages: reduces data redundancy through centralised storage and normalisation [1]; enforces data integrity through constraints (PK, FK, NOT NULL) [1]; provides access control and security through user roles and permissions [1]; supports multi-user concurrent access safely via concurrency control [1]; provides backup and recovery [1]; data independence — applications insulated from storage changes [1]. Disadvantage (any 1 from): expensive licence cost for enterprise DBMS [1]; complex to set up and requires specialist knowledge to administer [1]; additional overhead can make simple queries slower than direct file access [1]; single point of failure — if DBMS crashes all applications lose data access [1].
Q8A bank transfer system debits £500 from Account A and credits £500 to Account B. Explain how EACH of the four ACID properties applies to this transaction.[4 marks]
✓ Mark scheme
Atomicity: both the debit from Account A and the credit to Account B must both complete — if the system crashes after the debit but before the credit, the entire transaction is rolled back so neither change is applied [1]; Consistency: before the transfer Account A has ≥£500; after the transfer the total balance across both accounts is the same (£500 moved, not created or destroyed) — all constraints are satisfied [1]; Isolation: if another transfer involving Account A or B is happening simultaneously, each transfer sees only the committed state — the intermediate state (A debited but B not yet credited) is not visible to other transactions [1]; Durability: once the transaction is committed, the new balances are permanently stored — even if the system crashes immediately afterwards, the completed transfer will not be lost [1].
Topic Quiz
1 of 15
You scored
out of 15
🎯

Mini Test — 1.3.2d DBMS

  • 10 questions · 10 marks · 10 minutes
  • 5 MCQ + 5 short answer
Card 1 of 15
Click to reveal
🎉
Complete!
TermDefinition
← 1.3.2c Normalisation 1.3.2 Databases Next: 1.3.3a Network Topologies →
🔒
Pro Content
Subscribe to access all 69 OCR H446 A Level lessons.
£7.99/month
or £59/year
Subscribe now →