How can we extract the first 5 characters of an email address?
SUBSTRING(str, start, length) extracts a portion of a string based on 1-based start index and length.
Extracting area codes, parsing prefix codes, masking sensitive PII fields.
SELECT
SUBSTRING(email, 1, 5) AS email_prefix
FROM employees;Practice typing production-grade SQL code for SUBSTRING.