Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

6.12 (1 of 2): Mining, reports and customer data

The whole lesson, free. Read it and have a go at the activities. To work the tasks and labs in the real lesson, press Start lab, with no account needed.

50 minutes

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

Phone cases and screen protectors

A phone shop looks at its sales. Nobody asked a question. But a computer finds something: people who buy a phone case often buy a screen protector in the same week.

Now the shop puts the screen protectors next to the cases. Sales go up. This is what happens when a business learns from its data.

Key words

WordWhat it meansExample
Data miningSearching a large amount of data for patterns nobody asked for.Cases and screen protectors are bought together
ReportingAnswering known questions on a regular schedule.Sales each month
Business intelligenceUsing data to help a business decide.Which shop should open late?
Financial planning and analysisUsing data to plan money: a budget (a plan for money), costs and a forecast (a guess about next year).What will we earn next year?
CRMCustomer relationship management: software that holds what a business knows about each customer.A list of customers and their orders
Customer analyticsStudying customer data: who buys what, and when.Who has stopped buying?
PatternSomething that repeats in the data.Sales rise every December
ScaleHow much data there is, and how fast it grows.50 rows or 50 million rows
DatabaseAn organised store of data that you can ask questions of.Customers and orders
Data warehouseA store of cleaned data (checked and fixed) in one agreed shape, for reports.All sales of a chain
Data lakeA store of raw data (not changed yet) in any format.Shop payment logs and emails

The cells students fill in are left blank in this preview.

Data mining: find what nobody asked

Data mining searches a large amount of data for patterns. You do not start with a question. The computer looks for things that repeat or go together.

Mining needs a lot of data. A pattern in 10 rows may be luck. A pattern in 10 million rows is much more likely to be real.

Quick check: mining or reporting?

Have a go

Quick check: mining or reporting?

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Business intelligence helps people decide

Business intelligence means using data to decide better. Reports, charts and mining all give it facts.

Two big uses are money and customers. Finance teams use data to plan. Customer teams use data to look after customers and to write to them.

What business intelligence does

UseWhat it doesExample
Financial planning and analysisPlans money. Compares real costs and the money coming in with the plan.The shop sees that costs are rising and changes its budget.
CRM: customer analyticsStudies what customers buy and when.Finds the customers who have not ordered this year.
CRM: communicationsSends the right message to the right customer.Sends a discount email to customers who stopped buying.

The cells students fill in are left blank in this preview.

Match the job to the use

Have a go

Loading…

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The tool depends on the scale

A small club with 50 members can keep a spreadsheet. A shop with 10,000 orders needs a database.

A chain (many shops with one name) with millions of sales a day needs a data warehouse, a data lake and mining tools. The bigger the scale, the stronger the tool must be.

Scale and tool

ScaleExampleTool that fitsWhy
Small: tens of rowsA club listA spreadsheetEasy and cheap
Medium: thousands of rowsOne shop's ordersA databaseFast questions, safe storage
Big: millions of rowsA chain's salesA data warehouse and mining toolsToo much for one spreadsheet or one server

The cells students fill in are left blank in this preview.

Try it: find the big orders

Code: python
orders = [
    [1, "Sam", "2025-03-02", 20.0],
    [2, "Sam", "2025-05-10", 35.5],
    [3, "Aisha", "2024-11-20", 12.0],
    [4, "Leo", "2025-02-14", 50.0],
    [5, "Leo", "2025-04-01", 15.0],
    [6, "Leo", "2025-06-30", 27.5],
    [7, "Tom", "2023-12-25", 40.0],
    [8, "Aisha", "2024-12-01", 18.0],
]

# Each order is: [order id, customer, date, total in pounds]
# Reporting: show the big orders, more than 20 pounds.
for order in orders:
    if order[3] > 20:
        print("Order", order[0], "by", order[1], "costs", order[3])

# Change 20 to 30 and run it again.

Make a free account to save your work and track your progress.

Your turn: the biggest orders

The shop wants a report of its big orders. Fill in two functions. The first lists the ids of the orders of a set amount or more. The second finds the id of the biggest order. Press Run Tests to check.

Code: python
def big_orders(orders, limit):
    # Each order is: [order id, customer, date, total in pounds].
    # Give back a list of the ids of the orders whose total is limit or more.
    # Keep them in the same order as the list.
    return None


def biggest_order(orders):
    # Give back the id of the order with the biggest total.
    # The list is never empty.
    return None

Make a free account to save your work, or press Start lab to work through the whole lesson.

Who has stopped buying?

A CRM team wants to write to customers who have not bought for a long time. A first step is to list the old orders. The customers in that list may need a message.

Try it: old orders

Code: python
orders = [
    [1, "Sam", "2025-03-02", 20.0],
    [2, "Sam", "2025-05-10", 35.5],
    [3, "Aisha", "2024-11-20", 12.0],
    [4, "Leo", "2025-02-14", 50.0],
    [5, "Leo", "2025-04-01", 15.0],
    [6, "Leo", "2025-06-30", 27.5],
    [7, "Tom", "2023-12-25", 40.0],
    [8, "Aisha", "2024-12-01", 18.0],
]

# Each order is: [order id, customer, date, total in pounds]
# Old orders, from before 2025. A year-month-day date compares as text.
for order in orders:
    if order[2] < "2025-01-01":
        print(order[1], "ordered on", order[2])

# Who is in the list? Did they also order after 2025 began?

Make a free account to save your work and track your progress.

Your turn: the old orders

The CRM team wants to write to customers who have stopped buying. Fill in two functions. The first says if one customer has ordered since a date. The second lists every customer who has not. Press Run Tests to check.

Code: python
def bought_since(orders, name, date):
    # Each order is: [order id, customer, date, total in pounds].
    # Give back True if this customer has an order on or after the date.
    # Dates are written year-month-day, so you can compare them as text.
    return None


def lapsed(orders, date):
    # Give back a list of the customers with NO order on or after the date.
    # Each name appears once, in the order it first appears in orders.
    return None

Make a free account to save your work, or press Start lab to work through the whole lesson.

Extra: Try it: CRM questions in SQL

Code: sql
-- 1. How much has each customer spent? SUM adds. GROUP BY makes one row per customer.
SELECT customers.name, SUM(orders.total) AS spent
FROM customers
JOIN orders ON orders.customer_id = customers.id
GROUP BY customers.id
ORDER BY spent DESC;

-- 2. Who has NOT ordered since 1 January 2025? This also finds Maya, who never ordered.
SELECT name FROM customers
WHERE id NOT IN (SELECT customer_id FROM orders WHERE order_date >= '2025-01-01')
ORDER BY name;

Make a free account to save your work and track your progress.

Key words crossword

Have a go

Loading…

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Watch: from a pattern to the right tool

Press Play on the short film below. It starts with the phone shop and its pattern, then shows business intelligence and the tool for each scale. Listen for the myth about mining and reporting.

Film: Mining, reports and customer data

Mining, reports and customer data

Every scene, as text

  1. Phone cases and screen protectors. People who buy a phone case often buy a screen protector in the same week (pattern: something that repeats in the data). The shop puts the screen protectors next to the cases (because: a computer found the pattern). Sales go up (so: the business learns from its data).
  2. Data mining: find what nobody asked. You do not start with a question (looks for: what repeats or goes together). A pattern in 10 rows may be luck. A pattern in 10 million rows is much more likely to be real (so: mining needs a lot of data).
  3. Myth (false): mining is reporting. That is not true: reporting answers known questions. Mining finds new ones. Sales each month (reporting: a known question, on a schedule). Cases and screen protectors are bought together (mining: a new pattern a computer found).
  4. What business intelligence does. Financial planning and analysis: plans money (example: costs rise, so the budget changes). CRM: customer analytics: who buys what, and when (example: Leo bought three times in 2025). CRM: communications: the right message to the right customer (example: a thank-you to every new customer).
  5. The tool depends on the scale. Tens of rows: a spreadsheet (why: easy and cheap). Thousands of rows: a database (why: fast questions, safe storage). Millions of rows: a data warehouse, a data lake and mining tools (why: too much for one spreadsheet or server).

Final check

Have a go

Final check

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Remember

Important

Reporting answers known questions. Mining finds new ones. Business intelligence uses both to decide, for money and for customers. The bigger the data, the stronger the tool.

Teach this lesson with your class

On a college account your students work the tasks and the labs as well, and every mark is kept for you.