IB Computer Science HL · Year 2 · Lesson 47

Aggregates, views and ACID transactions

SQL defines and manipulates relational data, while transactions protect consistency when multiple changes occur.

Paper 150 minutesA3.3.4 · A3.3.5 · A3.3.6
Today’s targets

What you need to be able to do

2 / 9
  • ConstructCalculations within a database using SQL’s aggregate functions
  • DescribeDifferent database views
  • DescribeHow transactions maintain data integrity in a database
A3.3.4A3.3.5A3.3.6
Paper 1 lensMatch the depth of every response to the command term. Previously learned content can move quickly, but retrieval must still be accurate.
Retrieve

Rapid Recall Deck

3 / 9

Say the answer aloud before flipping. Mark secure knowledge quickly and spend time on the gaps.

  • What are the main SQL aggregate functions?: COUNT, MAX, MIN, SUM, and an average function (commonly AVG).
  • Why are GROUP BY and aggregate functions often used together?: GROUP BY divides rows into categories, and aggregate functions calculate a summary value for each group.
  • What is a virtual database view?: A stored query whose result is generated from underlying tables when the view is used rather than storing a separate full copy of the result.
  • What is a materialized view?: A stored snapshot/result of a query that can improve read performance but must be refreshed to stay current.
  • What does ACID stand for?: Atomicity, Consistency, Isolation, and Durability.
  • What do BEGIN TRANSACTION, COMMIT, and ROLLBACK do?: BEGIN starts a transaction; COMMIT makes its successful changes permanent; ROLLBACK undoes the transaction's uncommitted changes.
A3.3.4 + A3.3.5 · Learn

Core knowledge and application

4 / 9
A3.3.4Construct

Calculations within a database using SQL’s aggregate functions

SQL defines and manipulates relational data, while transactions protect consistency when multiple changes occur.

Exam moveProduce the required code, diagram, query, model or representation accurately.
Required detail 1Aggregate functions on grouped data to aid reporting and decision-making
Required detail 2Aggregate commands: AVERAGE, COUNT, MAX, MIN, SUM

Explain it without notes

Construct: Calculations within a database using SQL’s aggregate functions in the context of a relational database used for reporting and transactional updates.

  • Aggregate functions on grouped data to aid reporting and decision-making
  • Aggregate commands: AVERAGE, COUNT, MAX, MIN, SUM
A3.3.5Describe

Different database views

SQL defines and manipulates relational data, while transactions protect consistency when multiple changes occur.

Exam moveGive a detailed, accurate account of what happens or what something is like.
Required detail 1Virtual views and materialized (snapshot) views
Required detail 2Hiding data complexity, data consistency, independence, performance, query simplification, read-only data or updatable data, security

Explain it without notes

Describe: Different database views in the context of a relational database used for reporting and transactional updates.

  • Virtual views and materialized (snapshot) views
  • Hiding data complexity, data consistency, independence, performance, query simplification, read-only data or updatable data, security
A3.3.6 · Learn

Core knowledge and application

5 / 9
A3.3.6Describe

How transactions maintain data integrity in a database

SQL defines and manipulates relational data, while transactions protect consistency when multiple changes occur.

Exam moveGive a detailed, accurate account of what happens or what something is like.
Required detail 1Role of atomicity, consistency, isolation and durability (ACID) to ensure reliable processing of transactions
Required detail 2Transaction control language (TCL) commands: BEGIN TRANSACTION, COMMIT, ROLLBACK

Explain it without notes

Describe: How transactions maintain data integrity in a database in the context of a relational database used for reporting and transactional updates.

  • Role of atomicity, consistency, isolation and durability (ACID) to ensure reliable processing of transactions
  • Transaction control language (TCL) commands: BEGIN TRANSACTION, COMMIT, ROLLBACK
Worked example · A3.3.4–A3.3.6

Aggregates, views and ACID transactions

6 / 9
SELECT CourseID,
       COUNT(*) AS N,
       AVG(Score) AS MeanScore,
       MAX(Score) AS Highest,
       MIN(Score) AS Lowest,
       SUM(Score) AS Total
FROM ENROLLMENT
GROUP BY CourseID
HAVING COUNT(*) >= 5;

Virtual view

Stores the query definition and computes the current result when accessed. Useful for simplification, security and logical independence.

Materialized view

Stores a snapshot/result for faster reads, but the stored result must be refreshed to remain current.

BEGIN TRANSACTION;
UPDATE ACCOUNT SET Balance = Balance - 100 WHERE ID = 1;
UPDATE ACCOUNT SET Balance = Balance + 100 WHERE ID = 2;
COMMIT;
-- ROLLBACK would undo the transaction if the operation cannot complete safely.
ACIDAtomicity: all or nothing. Consistency: rules remain valid. Isolation: concurrent work does not interfere incorrectly. Durability: committed changes persist.
Apply

Transfer to a new scenario

7 / 9
ScenarioA relational database used for reporting and transactional updates needs a design or technical decision related to today’s topic. Explain what matters and why.
  • Aggregate functions on grouped data to aid reporting and decision-making
  • Aggregate commands: AVERAGE, COUNT, MAX, MIN, SUM
  • Virtual views and materialized (snapshot) views
  • Hiding data complexity, data consistency, independence, performance, query simplification, read-only data or updatable data, security
  • Role of atomicity, consistency, isolation and durability (ACID) to ensure reliable processing of transactions
  • Transaction control language (TCL) commands: BEGIN TRANSACTION, COMMIT, ROLLBACK
Exam lens

Paper 1 practice

8 / 9
Build the response before checking notesUse precise terminology and match the required depth.
  1. Construct: Calculations within a database using SQL’s aggregate functions in the context of a relational database used for reporting and transactional updates.
  2. Describe: Different database views in the context of a relational database used for reporting and transactional updates.
  3. Describe: How transactions maintain data integrity in a database in the context of a relational database used for reporting and transactional updates.
Self-checkAnswer the exact command term. For explain, include mechanism/reason; for compare, pair criteria; for discuss/evaluate/justify, build supported reasoning and a conclusion.
Homework

Finish the learning cycle

9 / 9

Exam preparation — main task

Complete targeted 2027 case-study research and cumulative Paper 1/Paper 2 practice. Record evidence and technical vocabulary you can use in extended responses.

Retrieval

Repeat today’s recall deck and revisit any item marked ‘Review again’.