Write a query to find the names of students that begin with ‘A’
Description: Find all the students whose name starts with the letter A.
Tables: the exercises use the students (id, name, city, marks, course_id) and courses (id, course_name) tables, with the data from our MySQL INSERT chapter. The students are: Robin (Delhi, 85), Maria (Mumbai, 92), John (Pune, 78), Asha (Jaipur, 88), Vikram (Delhi, 65), Neha (Mumbai, 45).
Hint:
- Use
LIKE 'A%'.
MySQL query for names that begin with A
SELECT name
FROM students
WHERE name LIKE 'A%';
Output:
Tutorials Class - Output Window
| name |
|---|
| Asha |
How it works
%matches any number of characters after the A.- For names ending with A use
'%a'.
Read MySQL LIKE.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |