Example 1
Display names in both uppercase and lowercase
The stored values are unchanged — UPPER and LOWER only affect the query output. Use them in a WHERE clause like WHERE LOWER(name) = 'alice smith' for case-insensitive lookups that work regardless of how data was stored.
Source table data Rows loaded before the example query runs.
Setup
CREATE TABLE users (id INT, name VARCHAR(50));
INSERT INTO
users (id, name)
VALUES
(1, 'alice smith'),
(2, 'BOB JONES');Validated query Shared across supported engines.
SQL
SELECT
id,
UPPER(name) AS upper_name,
LOWER(name) AS lower_name
FROM
users
ORDER BY
id;Expected result Returned rows for the shared example.
| id | upper_name | lower_name |
|---|---|---|
| 1 | ALICE SMITH | alice smith |
| 2 | BOB JONES | bob jones |
Output is identical across all engines.