Example 1
Find email addresses regardless of capitalization
Both stored variants of Alice's email normalize to [email protected], so both rows match. Bob's email normalizes to a different value and is excluded.
CREATE TABLE users (id INT, email VARCHAR(100));
INSERT INTO
users (id, email)
VALUES
(1, '[email protected]'),
(2, '[email protected]'),
(3, '[email protected]');SELECT
id,
email
FROM
users
WHERE
LOWER(email) = LOWER('[email protected]')
ORDER BY
id;| id | |
|---|---|
| 1 | [email protected] |
| 3 | [email protected] |
The same LOWER-based comparison works across the supported engines.