Skip to main content
SQL โ€ข LESSON 167

UNION ALL for Event Data

How can we merge web and mobile events adding a source tag to each record?

Advancedโฑ 3 Minutesโญ 1800 XP
๐Ÿค” THE QUESTION

How can we merge web and mobile events adding a source tag to each record?

๐Ÿ’ก WHAT IS IT?

Projecting static literal tags ('web', 'mobile') alongside UNION ALL creates unified event streams.

๐ŸŽฏ WHAT IS IT USED FOR?

Clickstream ingestion, multi-platform analytics, centralized logging pipelines.

๐Ÿ’ป EXAMPLE
SELECT event_id, event_date, 'web' AS source
FROM web_events
UNION ALL
SELECT event_id, event_date, 'mobile' AS source
FROM mobile_events;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for UNION ALL for Event Data.

  • โœ“ Event stream concatenation
  • โœ“ Literal source tags
  • โœ“ UNION ALL pipelines
  • โœ“ Clickstream modeling