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, 'alice@example.com'),
(2, 'bob@example.com'),
(3, 'carol@test.org');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 | alice@example.com |
| 2 | bob@example.com |
Output is identical across all engines.