LIKE Operator: Pattern Matching
The LIKE operator used to select data by comparing the values of a character variable to a specified pattern. It is case sensitive.
Task 1: To select all students with a name that starts with the letter S.
There are two special characters patterns available for specifying a pattern:
percent sign (%) – Wildcard Character
underscore ( _ ) – Fill in the blanks
In a given dataset, the above statements would produce the same result in both cases.
where name like '%ul';
It contains all the data where the name ends with ‘ul’.
where name like '_ah%';
It contains all the data where the name contains atleast 3 characters, which must contain ‘ah’ at second place.
where name like '_a___';
It contains all the data where the name contains atleast 5 characters, which must contain ‘a’ at second place.
- Difference between Functional Programming and Object Oriented Programming
- Arrow operator -> in C/C++ with Examples
- Modulo Operator (%) in C/C++ with Examples
- Walrus Operator in Python 3.8
- Matrix operations using operator overloading
- Introduction to SAS programming
- Use of FLAG in programming
- If-Then-Else statement in SAS Programming
- Where Statement in SAS Programming
- Contains and Between-And operators in SAS Programming
- Functions in R Programming
- I Can't Use Logic In Programming. What Should I Do?
- Looping over Objects in R Programming
- C Programming For Beginners - A 20 Day Curriculum!
- Features of C Programming Language
- Introduction to Swift Programming
- Introduction to Programming Languages
- Which Programming Language to Choose?
- Swift Programming Language
- 5 Most Difficult Programming Languages of the World
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.