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
SQL
x
1
SELECT column_name(s)
2
FROM table_name
3
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”.
SQL
1
1
SELECT name
2
FROM Students
3
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”.
SQL
1
1
SELECT first_name, last_name
2
FROM Patients
3
WHERE last_name LIKE '%son';

SQL Like Visual Diagram
