1. Unfold the array
arrayJoin() expands an array column into one row per element.
arrayJoin(tags) AS tagTyporithm · medium
Step 1 of 8 · intro card
Querying
ClickHouse stores arrays in columns; arrayJoin(col) (or ARRAY JOIN) unfolds an array into one output row per element, repeating the other columns.
ClickHouse can store arrays directly in a column, so a single event row may carry many tags.
arrayJoin(col) unfolds that array, emitting one row per element while repeating the row's scalar columns.
The ARRAY JOIN clause does the same in the FROM section and is preferred when joining multiple arrays together.
Arrays live inside a single column.
arrayJoin(col) = one row per element.
Scalar columns repeat across the rows.
SELECT
user_id,
arrayJoin(tags) AS tag
FROM events;Connect each part of the code to the concept before you type.
arrayJoin() expands an array column into one row per element.
arrayJoin(tags) AS tagScalar columns like user_id are repeated for each unfolded element.
user_idThe events table holds an array column, tags, per row.
FROM eventsRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.