Names starting with A
SQL data engineering interview problem. Difficulty: beginner. Pattern: String Functions. About 8 minutes. Free to practice.
You are building a name search box, and the first feature is 'show everyone whose name starts with A'. From the employees table, find the employees whose name begins with the letter A. Return employee_id and name, sorted by name from A to Z.
Requirements
- Keep only the names that start with the capital letter A.
- Use LIKE with a pattern. The % sign means 'any characters can follow'.
- Sort by name from A to Z.
Constraints
- The table is employees.
- Return only these 2 columns, in this order: employee_id, name.
- Matching is case-sensitive here. All names are written in title case, so the first letter is always a capital.
Examples
Input: employees employee_id | name 1 | Alice Chen 2 | Bob Kumar 5 | Omar Ali Output: employee_id | name 1 | Alice Chen Why this passes: LIKE 'A%' matches the first character only. Bob and Omar are excluded.
Topics: lakebench, sql, like, strings.
More SQL interview questions · All interview problems · Learn data engineering
Names starting with A
Interview-style drill: LIKE filter for employee names starting with A.
Find employees whose `name` starts with 'A'. Columns: `employee_id`, `name`. Order by `name`.