Skip to content
Datasets/Website Analytics
Dataset

Website Analytics SQL Practice Dataset

Sessions, pageviews, events, users, and campaigns for funnel and attribution practice.

Download this dataset, free

No account, no email, no attribution required — free for any use, including commercially. Take the single .sql file to load everything into PostgreSQL, MySQL, SQLite, DuckDB, or SQL Server, or grab the raw CSVs.

website_analytics.sqlAll 5 tables, 161 rows, as CREATE TABLE and INSERT statements.Download →

Website Analytics models a small SaaS marketing site. It includes sessions, pageviews, funnel events, known users, and campaign metadata, so it is built for SQL questions about traffic quality, conversion, content performance, and attribution.

The data intentionally mixes anonymous and known sessions, direct and campaign traffic, repeated pageviews, and events that only appear for some sessions. That makes it a good fit for practicing COUNT DISTINCT, rates, left joins, and null-aware filters.

Schema

Schema · Website AnalyticsView dataset schema5 tables
Table · users

One row per known (signed-up) user.

6 columns · 12 rows
user_id intfirst_name textlast_name textsignup_date datecountry textplan text
Table · campaigns

Marketing campaigns with their channel and UTM tags.

5 columns · 5 rows
campaign_id intcampaign_name textchannel textutm_source textutm_medium text
Table · sessions

One row per visit. Anonymous visits have a null user_id; organic and direct visits have a null campaign_id.

7 columns · 30 rows
session_id intuser_id intsession_date datechannel textcampaign_id intdevice textduration_seconds int
Table · pageviews

One row per page viewed within a session, in view_order.

4 columns · 75 rows
pageview_id intsession_id intpath textview_order int
Table · events

Funnel events (signup, add_to_cart, checkout, purchase). Only purchase events carry a value.

4 columns · 39 rows
event_id intsession_id intevent_name textvalue decimal

Best for

  • COUNT DISTINCT, conversion rates, and funnel reports.
  • LEFT JOIN attribution from sessions to campaigns.
  • NULL handling for anonymous users and uncampaigned traffic.

Starter questions

  • Which channels drive the highest purchase rate?
  • Which pages are viewed most often?
  • How many sessions are anonymous?

Practice lessons