MAKE FULL WEB APPLICATION WITH JUST SQL KNOWLEDGE? CLICK HERE
The LIKE operator is applicable in case of character columns.It
allows for a comparison of one string value with another string
value which is not identical. We use two wildcards (% and
_ ) for this purpose.The LIKE condition can be used in any
valid SQL statement - select, insert, update, or delete. LIKE is
another keyword that is used in the WHERE clause.
The Syntax of LIKE pattern is :-
SELECT "column_name"
FROM "table_name"
WHERE "column_name" LIKE {PATTERN} |
EXAMPLE # I:-
We will use the Name Table to illustrate the SQL LIKE clause
usage:-
FIRST NAME |
LAST NAME |
ADDRESS |
Deepali |
Shah |
Prithvi Classic |
Nirvi |
Vora |
Raj Gardens |
Krupa |
Desai |
Kunj Dham |
Deesha |
Shah |
Raghunath Palace
|
If you want to select all Name having FirstName starting with
'D' you need to use the following SQL statement:
SELECT *FROM NAME WHERE First Name LIKE 'D%' |
RESULT:-
FIRST NAME
|
LAST NAME
|
ADDRESS
|
Deepali
|
Shah
|
Prithvi Classic
|
Deesha
|
Shah
|
Raghunath Palace
|
If you don't find what you are looking for. Please click
here to submit your query, our experts will reply soon.
|