'search in MySQL database based on alphabet's position?

I want to search in my database "emp" for names which have the alphabet "A" as third alphabet from left in their names.

This is what I tried:

select empname from emp
where left(empname,3)="a"
order by empname;

It returns an empty set. Can you check my syntax, whether it is correct or not!

(Upvote promised ;) )



Solution 1:[1]

The INSTR() function returns the position of the first occurrence of a string in another string. This function performs a case-insensitive search.

Select INSTR(first_name, 'm') from Tablename where first_name = 'monika';

Reference:- https://www.w3schools.com/sql/func_mysql_instr.asp

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1