Text from forms and imports needs cleaning before you can match or count it. The functions you'll use most:
TRIM(s) removes spaces at both ends; UPPER(s) and LOWER(s) change case. LOWER(TRIM(email)) is the standard way to compare emails.
LENGTH(s) counts characters.
SUBSTRING(s, start, length) takes part of a string, counting from 1. LEFT(s, n) and RIGHT(s, n) take the ends.
SPLIT_PART(s, '@', 2) splits on a separator and takes one piece: here, the email domain.
REPLACE(s, '-', '') swaps every match. REGEXP_REPLACE(s, '[^0-9]', '', 'g') removes every character that isn't a digit.
a || b and CONCAT(a, b) join text. If any part is NULL, || returns NULL while CONCAT treats it as empty text.
Names differ a little between databases: MySQL uses SUBSTRING_INDEX where PostgreSQL uses SPLIT_PART, and SQL Server uses LEN and +. The ideas are the same everywhere.