DataDriven
LearnPracticeInterviewDiscussDaily
HelpContactPrivacyTermsSecurityiOS App

© 2026 DataDriven

Loading lesson...

  1. Home
  2. Learn
  3. String Functions: Advanced

String Functions: Advanced

Production-grade text transformations

Encoding, formatting, and production-grade string handling

Category
SQL
Difficulty
advanced
Duration
20 minutes
Challenges
0 hands-on challenges

Topics covered: SPLIT_TO_MAP(), String Building with CONCAT and LPAD(), TO_BASE64() / FROM_BASE64(), TO_HEX() / FROM_HEX(), TO_UTF8() / FROM_UTF8()

Lesson Sections

  1. SPLIT_TO_MAP() (concepts: sqlSplitToMap)

    Basic Syntax Parsing Query Strings URL query strings are the most common use case. They contain parameters in key=value format separated by ampersands: Parsing Config Strings Delimiter Format Variants The same function handles different delimiter conventions. The key is matching the delimiters to your data format. Common patterns include URL-style (&/=), config-style (,/:), and pipe-style (|/=). Advanced Usage Filtering by Map Values This query finds all requests where the action parameter equal

  2. String Building with CONCAT and LPAD()

    Building Dynamic Strings Currency Formatting Zero-Padded Identifiers Building Complex Strings Best Practices When to Use String Building

  3. TO_BASE64() / FROM_BASE64()

    Basic Concepts Base64 solves a fundamental problem: binary data contains bytes that are not valid text characters. Attempting to store raw binary in a text field corrupts the data. Base64 transforms binary into safe text that survives any text processing. The = characters at the end are padding. Base64 works in groups of 4 characters, and padding fills incomplete groups. The encoded result contains only letters, numbers, plus, slash, and equals. Encoding & Decoding Decoding Base64 to Text Best P

  4. TO_HEX() / FROM_HEX()

    Basic Concepts Hexadecimal uses 16 symbols: 0-9 represent values 0-9, and A-F represent values 10-15. Two hex digits represent one byte (values 0-255). The letter "A" has ASCII value 65, which is 41 in hexadecimal (4*16 + 1 = 65). This direct byte-to-hex mapping makes hex ideal for inspecting exactly what bytes a string contains. Encoding & Decoding Each character becomes two hex digits. "Hello" is 5 characters, producing 10 hex digits. Reading the hex, 48 is "H", 65 is "e", and so on. This visi

  5. TO_UTF8() / FROM_UTF8() (concepts: sqlComplexPatterns)

    Basic Concepts Different characters require different numbers of bytes in UTF-8: ASCII letters use 1 byte each. Accented European characters use 2 bytes. East Asian characters typically use 3 bytes. Emojis use 4 bytes. Understanding this helps predict storage requirements and debug length mismatches. Encoding & Decoding Chaining Encodings UTF-8 functions are the bridge between text and binary encodings: Best Practices UTF-8 Function Uses UTF-8 functions bridge text and binary representations, es

Related

  • All Lessons
  • Practice Problems
  • Mock Interview Practice
  • Daily Challenges