SQL

Blog posts using SQL code – structure, patterns and useful snippets.

First-Pass PII data redaction with SQL Regex at the core

Analytics Engineering · SQL · Regex First-Pass PII Redaction with SQL Regex Using regular expressions to reduce obvious personal data exposure before analysing free-text feedback comments. Why Regex Redaction Can Still Be Useful Cloud NLP tools can identify names, addresses, emails and other personal information with much greater sophistication than regex. But there are still […]

First-Pass PII data redaction with SQL Regex at the core Read More »

Lightweight Device Categorisation from User-Agent Strings in SQL

Analytics Engineering · SQL · Regex Lightweight Device Categorisation from User-Agent Strings in SQL A pragmatic way to classify mobile, tablet and desktop traffic without adding a full user-agent parsing library. NOTE: Originally published pre-UA reduction. The lightweight categorisation method remains useful for high-level mobile/desktop and OS classification, but Chrome User-Agent reduction means detailed device

Lightweight Device Categorisation from User-Agent Strings in SQL Read More »

Joining CSAT Survey Scores to Page View Data in SQL

Analytics Engineering · SQL · Feedback Scoring Joining CSAT Survey Scores to Page View Data in SQL How to connect customer feedback to behavioural analytics so satisfaction scores can be analysed by journey, page and service area. The Problem Customer satisfaction survey data is useful on its own, but it becomes much more useful when

Joining CSAT Survey Scores to Page View Data in SQL Read More »

Taming URL Chaos: Regex Strategies for Normalising GOV.UK Page Paths

Analytics Engineering · SQL · Regex Taming URL Chaos: Regex Strategies for Normalising GOV.UK Page Paths How to group analytics events by meaningful page structure when your URLs contain user IDs, tax reference numbers, and random alphanumeric tokens The Complete Query Here’s the full SQL in context. The sections below break down each regex component

Taming URL Chaos: Regex Strategies for Normalising GOV.UK Page Paths Read More »