LIKE CLAUSE



MySQL - Like Clause


MySQL LIKE condition allows wildcards to be used in the WHERE clause of a SELECT, INSERT, UPDATE, or DELETE statement. This allows you to perform pattern matching.


Syntax

The syntax for the LIKE Condition in MySQL is:

expression LIKE pattern [ ESCAPE 'escape_character' ]

Parameters or Arguments :

Expression :

A character expression such as a column or field.

pattern :

A character expression that contains pattern matching. The patterns that you can choose from are:

WildcardExplanation
%Allows you to match any string of any length (including zero length)
_Allows you to match on a single character

escape_character :

Optional. It allows you to test for literal instances of a wildcard character such as % or _. If you do not provide the escape_character, MySQL assumes that "\" is the escape_character.


EXAMPLE :

SELECT * FROM studentinfo
WHERE StudentName LIKE 'S%';

StudentIDStudentNameStudentclass
5SahayanaSixth
6SweekruthaSixth

Example - Using _ wildcard (underscore wildcard) :

SELECT StudentName 
FROM studentinfo
WHERE StudentName LIKE 'Ajaa_hi';


--------RESULT---------


-------------------
| StudentName     |
-------------------
| Ajaashi         |
-------------------


MySQL TRIGGERS

MySQL - Triggers

posted on 2019-11-29 21:44:07 - mysql Tutorials


Grant_ Revoke Privilege

MySQL - Grant_ Revoke Privilege

posted on 2019-11-26 23:15:04 - mysql Tutorials


MySQL Vs SQL

MySQL Vs SQL

posted on 2019-11-25 05:02:26 - mysql Tutorials


What Is Oracle

What Is Oracle

posted on 2019-11-29 01:11:21 - ORACLE Tutorials


TRIGGER

ORACLE - Trigger

posted on 2019-11-28 22:14:22 - ORACLE Tutorials


CURSOR

ORACLE - Cursor

posted on 2019-11-28 22:13:54 - ORACLE Tutorials