LIKE in Teradata

Teradata LIKE operator is used for pattern matching in the specified column. This is used in the WHERE clause and may use wildcard characters and special characters to match a pattern from a word. Teradata LIKE operator is can be used within any valid SQL statement like SELECT statement, Insert statement, UPDATE or DELETE statements in Teradata.

Teradata LIKE operator syntax

The syntax of the Teradata LIKE operator is as follows.

SELECT * FROM DatabaseNAME.TableName
WHERE columnName [NOT] LIKE pattern_to_match [Escape escape_character]

Teradata LIKE operator example

Consider the following employee table.

emp_id emp_name emp_phone emp_gender department
101 Kalyan Roy 9620139678 M HR
102 Rajesh Sharma 9611895588 M ADMIN
103 Rupali Sharma 8884692570 F SALES
104 Dipankar Sen 9957889640 M HR
105 Sunitha Rai 9742067708 F SALES
106 Parag Barman 8254066054 M MARKETING
107 Vinitha Sharma 9435746645 F ADMIN
108 Abhishek Saha 9850157207 M SALES
109 Rushang Desai 9850157207 M SALES
110 Arvin Kumar 8892340054 M ADMIN

Now we are going to filter out the name of the employee whose name starts with ‘R’.

SELECT * FROM TERADATAPOINT.EMPLOYEE
WHERE EMP_NAME LIKE 'R%';

OUTPUT:

LIKE IN TERADATA