One box, two facts
A form has one box for "Name": Amy Reed. The club wants to sort by last name. It cannot, because the first name and the last name are stuck together.
Break the box into two. Later, join the parts back in a new shape.
Key words
| Word | What it means |
|---|---|
| Decompose | split data into its smaller parts |
| Constituent part | one of the smaller pieces a value is made of |
| Recompose | join the parts back together into a whole |
| Delimiter | the mark that separates parts, such as a space or a slash |
| Atomic field | a field that holds one fact only |
| Fit for purpose | good enough for the job the data is needed for |
The cells students fill in are left blank in this preview.
By the end of this lesson
Note
I can split a value into its parts and join the parts back into a form that suits the job.
Starter
Have a go
Starter
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
Worked example: splitting and joining
| Whole | Parts (decomposed) | New whole (recomposed) | Why |
|---|---|---|---|
| Mary Jane Reed | Mary and Reed | Reed, Mary | Sort by last name |
| 07/09/2026 | 7, 9 and 2026 | 2026-09-07 | Sorts into date order |
| 12 High St, Leeds | Number, street, town | Leeds | Count members by town |
| AMY-03-Y9 | Initials, form, year | Y9 | Count pupils by year |
The cells students fill in are left blank in this preview.
Why split at all?
A field that holds two facts cannot be sorted, filtered or counted by either one. A field that holds one fact can.
Splitting is the first step. Joining is the last step: the parts are put back in the shape the next job needs.
Try it: split and join in Python
full = "Mary Jane Reed"
words = full.split()
first = words[0]
last = words[len(words) - 1]
print(last + ", " + first)
text = "07/09/2026"
parts = text.split("/")
print(parts[2] + "-" + parts[1] + "-" + parts[0])
# Change the date to 25/12/2025 and run it again.
Try it: the same jobs in SQL
SELECT full_name,
substr(date_text, 7, 4) || '-' || substr(date_text, 4, 2) || '-' || substr(date_text, 1, 2) AS iso_date
FROM sign_ups;
-- substr(text, start, length) cuts out a part.
-- The two bars join parts together.
Check
Have a go
Check
4 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.