Easy Filtering rows Employees database

Match text patterns with LIKE

Question

Show the name of every employee whose name starts with the letter L.

employeesid, name, salary, department_id, manager_id, hired_on
departmentsid, name, city

Your query

Ctrl+Enter to run

Result

Press Run to see your query's result, or Check answer to compare it with the expected result.

Expected result

name
Lucas Moreau
Liam Walsh

Rows can come in any order. Column names do not have to match.

Hint

In LIKE, % stands for "any characters".

Show the solution
solution.sql Run this code
SELECT name
FROM employees
WHERE name LIKE 'L%';

Why it works

'L%' means: an L, then anything. In SQLite, LIKE ignores the case of ASCII letters, so 'l%' would find the same two people.

Common mistake

Writing WHERE name = 'L%' looks for a name that is literally L followed by a percent sign, and finds nothing. Patterns only work with LIKE.

Want to try the query on MySQL or PostgreSQL? Open it in the SQL Online Compiler or SQLite Online.