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?

Advanced3 Minutes1800 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