The SQL Like operator is used in WHERE clauses to search for a specified pattern in a column. It allows you to filter rows based on specific text patterns.
SQL Like Syntax
SELECT column_name(s) FROM table_name WHERE column_name LIKE pattern;
SQL Like Finding Names Starting with ‘A’ Example
This query retrieves all names from the Students table where the name starts with the letter “A”.
SELECT name FROM Students WHERE name LIKE 'A%';
SQL Like Finding Patients Whose Last Name End with ‘son’ Example
This query retrieves patients whose last names end with “son”. The % symbol allows for any number of characters before “son”.
SELECT first_name, last_name FROM Patients WHERE last_name LIKE '%son';