The SQL LIKE operator enables a comparison to a part of a string using the % wild card character.
The SQL LIKE operator is a powerful way to check for matching strings. It is often used for interactive display of lists.
SQL LIKE is used as follows.
SQL LIKE Syntax
The <like_condition> supports the following patterns:
SQL LIKE Example
The following example lists rows from the branch table where branch_name begins with the leading characters 'San'.
Here are the contents of the table:
Table: BRANCH
branch_nbr | branch_name | region_nbr | employee_count |
108 | New York | 100 | 10 |
110 | Boston | 100 | 6 |
212 | Chicago | 200 | 5 |
404 | San Diego | 400 | 6 |
415 | San Jose | 400 | 3 |
This SQL Statement with LIKE is executed:
Here is the result.
branch_nbr | branch_name | employee_count |
404 | San Diego | 6 |
415 | San Jose | 3 |
Advertisements:
Infogoal.com is organized to help you gain mastery.
Examples may be simplified to facilitate learning.
Content is reviewed for errors but is not warranted to be 100% correct.
In order to use this site, you must read and agree to the
terms of use, privacy policy and cookie policy.
Copyright 2006-2020 by Infogoal, LLC. All Rights Reserved.