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


Prompt Examples

ChatGPT Prompt Examples

posted on 2023-06-21 22:37:19 - ChatGPT Tutorials


Use Cases

Chat GPT Key Use Cases

posted on 2023-06-21 21:03:17 - ChatGPT Tutorials


Prompt Frameworks

Prompt Frameworks

posted on 2023-06-21 19:33:06 - ChatGPT Tutorials