Aryan PrajapatKnowledge Contributor
How to find the values in a text column of a table that start with a certain letter?
How to find the values in a text column of a table that start with a certain letter?
Using the LIKE operator in combination with the % and _ wildcards. For example, we need to find all surnames in a table that start with “A”. The query is:
SELECT * FROM table_name
WHERE surname LIKE ‘A_’;
POWERED BY
Here, we assume that a surname must contain at least two letters. Without this assumption (meaning that a surname can be just A), the query is as follows:
SELECT * FROM table_name
WHERE surname LIKE ‘A%’;