Example 1
Find email addresses regardless of capitalization
Both stored variants of Alice's email normalize to alice@example.com, 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, 'Alice@example.com'),
(2, 'bob@example.com'),
(3, 'ALICE@EXAMPLE.COM');SELECT
id,
email
FROM
users
WHERE
LOWER(email) = LOWER('alice@example.com')
ORDER BY
id;| id | |
|---|---|
| 1 | Alice@example.com |
| 3 | ALICE@EXAMPLE.COM |
The same LOWER-based comparison works across the supported engines.