Example 1
Find all users with an example.com email address
The % before @example.com matches any username prefix of any length. Carol's test.org address does not match and is excluded. Use ILIKE in PostgreSQL for a case-insensitive pattern match.
Source table data Rows loaded before the example query runs.
Setup
CREATE TABLE users (id INT, email VARCHAR(100));
INSERT INTO
users (id, email)
VALUES
(1, '[email protected]'),
(2, '[email protected]'),
(3, '[email protected]');Validated query Shared across supported engines.
SQL
SELECT
id,
email
FROM
users
WHERE
email LIKE '%@example.com'
ORDER BY
id;Expected result Returned rows for the shared example.
| id | |
|---|---|
| 1 | [email protected] |
| 2 | [email protected] |
Output is identical across all engines.