- Introduction To SQL
- RDBMS
- Data Integrity and Normalization
- Function in SQL
- SQL Syntax
- Data Types
- Operators
- SQL Expressions
- Database
- Tables
- Query
- Select Query
- Update query
- Delete Query
- Distinct Keyword
- Sorting
- Null Values
- Alias Syntax
- Drop a Table
- Alter Table
- Truncate Command
- Select Query
- Update query
- Delete Query
- Distinct Keyword
- Sorting
- Null Values
- Alias Syntax
- Drop a Table
- Alter Table
- Truncate Command
- Select Query
- Update query
- Delete Query
- Distinct Keyword
- Sorting
- Null Values
- Alias Syntax
- Drop a Table
- Alter Table
- Truncate Command
- Select Query
- Update query
- Delete Query
- Distinct Keyword
- Sorting
- Null Values
- Alias Syntax
- Drop a Table
- Alter Table
- Truncate Command
- Select Query
- Update query
- Delete Query
- Distinct Keyword
- Sorting
- Null Values
- Alias Syntax
- Drop a Table
- Alter Table
- Truncate Command
- Select Query
- Update query
- Delete Query
- Distinct Keyword
- Sorting
- Null Values
- Alias Syntax
- Drop a Table
- Alter Table
- Truncate Command
- Select Query
- Update query
- Delete Query
- Distinct Keyword
- Sorting
- Null Values
- Alias Syntax
- Drop a Table
- Alter Table
- Truncate Command
- Select Query
- Update query
- Delete Query
- Distinct Keyword
- Sorting
- Null Values
- Alias Syntax
- Drop a Table
- Alter Table
- Truncate Command
- Select Query
- Update query
- Delete Query
- Distinct Keyword
- Sorting
- Null Values
- Alias Syntax
- Drop a Table
- Alter Table
- Truncate Command
- Select Query
- Update query
- Delete Query
- Distinct Keyword
- Sorting
- Null Values
- Alias Syntax
- Drop a Table
- Alter Table
- Truncate Command
- Clauses
- Like Clause
- Top Clause
- Order By Clause
- Group By Clause
- Except Clause
- Intersect Clause
- Union Clause
- Union All Clause
- Having Clause
- Like Clause
- Top Clause
- Order By Clause
- Group By Clause
- Except Clause
- Intersect Clause
- Union Clause
- Union All Clause
- Having Clause
- Like Clause
- Top Clause
- Order By Clause
- Group By Clause
- Except Clause
- Intersect Clause
- Union Clause
- Union All Clause
- Having Clause
- Like Clause
- Top Clause
- Order By Clause
- Group By Clause
- Except Clause
- Intersect Clause
- Union Clause
- Union All Clause
- Having Clause
- Like Clause
- Top Clause
- Order By Clause
- Group By Clause
- Except Clause
- Intersect Clause
- Union Clause
- Union All Clause
- Having Clause
- Like Clause
- Top Clause
- Order By Clause
- Group By Clause
- Except Clause
- Intersect Clause
- Union Clause
- Union All Clause
- Having Clause
- Like Clause
- Top Clause
- Order By Clause
- Group By Clause
- Except Clause
- Intersect Clause
- Union Clause
- Union All Clause
- Having Clause
- Like Clause
- Top Clause
- Order By Clause
- Group By Clause
- Except Clause
- Intersect Clause
- Union Clause
- Union All Clause
- Having Clause
- Like Clause
- Top Clause
- Order By Clause
- Group By Clause
- Except Clause
- Intersect Clause
- Union Clause
- Union All Clause
- Having Clause
- SQL Constraints
- Joins
- Indexes
- Views
- Transactions
- Date Functions
- Sequences
- Sub Queries
- Handling Duplicates
- SQL Injection
- Stored Procedure
- Triggers
Like Clause
How To Use Like Clause In SQL
Introduction:
In this article, you will learn, what like clause is and how to use the clause in SQL.
This is used to find the value to the similar values, according to your instruction. In order to perform pattern matching, we can use four wildcards (%, _, [], [^] ) along with the like clause. This clause uses two sign to express the syntax:
- The percent sign (%)
- The underscore (_)
The % (percent) sign allows us to match a string of any length and the _ (underscore) sign is used to show a single character.
Like clause includes many conditions. Some are as follows-
Description |
Syntax |
---|---|
This statement is used to find the values, which starts with 1. |
Select * employee where age like '1%'; |
This statement is used to find the values, which are 00 in the second and third positions. |
Select * employee where salary like '_00%'; |
This statement is used, which has 12 in any position. |
Select * employee where age like '12%'; |
This statement is used to find the value, which starts with 2 and are at least 3 characters in the length. |
Select * employee where salary like '2_%_%'; |
Find any values, which ends with 2. |
Select * employee where age like '%2'; |
Finds any values in a five-digit number, which starts with 2 and ends with 3. |
Select * employee where salary like '2_3'; |
Finds any values, which has 2 in the second position and ends with 3. |
Select * employee where salary like '_2%3'; |
Example :
Step 1: We write the query and the syntax of this query is:
Syntax
select * from employee where age like '1%';
Now, select and execute this query.
Step 2: The result is:
Step 3: We used this clause to find the particular record in the current table. The syntax of this query is:
Syntax
select * from employee where age like '%12%';
Step 4: The output is:
Summary:
Thus, we learned that like clause is used to find the particular value in SQL.