PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches

Quick Overview

This question evaluates proficiency in SQL string parsing and regular expressions, type casting to timestamps, date-based filtering, distinct aggregation, and awareness of cross-dialect function equivalence, and is categorized under Data Manipulation (SQL/Python) and database querying.

  • Medium
  • Bloomberg
  • Data Manipulation (SQL/Python)
  • Data Engineer

Write Postgres string parsing and aggregation query

Company: Bloomberg

Role: Data Engineer

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

You are given a PostgreSQL table events(user_id TEXT, raw TEXT) where raw stores pipe-delimited key=value pairs, for example 'user=U1|country=US|ts=2025-08-31 14:25:00'. Write one SQL query that: ( 1) parses raw into columns user, country, ts using only PostgreSQL string/regex functions (e.g., substring/substr, split_part, regexp_matches/regexp_replace); ( 2) casts ts to TIMESTAMP and filters rows where country = 'US' and the timestamp falls in August 2025; and ( 3) returns the daily count of distinct user_id for those rows, ordered by day. Also name the BigQuery functions you might initially consider and state the PostgreSQL equivalents you used.

Quick Answer: This question evaluates proficiency in SQL string parsing and regular expressions, type casting to timestamps, date-based filtering, distinct aggregation, and awareness of cross-dialect function equivalence, and is categorized under Data Manipulation (SQL/Python) and database querying.

Last updated: Mar 29, 2026

Related Coding Questions

  • Write PostgreSQL string-manipulation query - Bloomberg (Medium)
  • Create SQL report of top extensions by weekday - Bloomberg (Medium)

Loading coding console...

PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.