- 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
Wildcard Operators
How To Use Wildcard Operators In SQL
Introduction:
In this article, you will learn what Wildcard Operators are and how to use Wildcard Operators in SQL.
The wildcard is used in “like operator”. With the wildcards, we can easily find and compare the values.
In order to define the matching pattern, we can use four wildcards (%, _, [], [^]) with the Like clause. These clauses use mainly two sign to express the syntax:
- The percent sign (%)
- The underscore (_)
The % (percent) sign except for the same string of any length and the _ (underscore) sign are used to define a single character.
Now, see how, we use wildcard operators ('%' and '_') in SQL database with some syntax:
- This statement is used to find the value, which starts with any fixed number.
Syntax:
select from table_name where column like '[condition]%'
- This statement is used to find any fixed value position.
Syntax:
select from table_name where column like '%[condition]%'
- This statement is used to find the value, which has a fixed end value.
Syntax:
select from table_name where column like '%[condition]'
- This statement is used to find the value, which has a fixed starting and an end value.
Syntax:
select from table_name where column like '[condition]_[condition]'
- This statement is used to find the value, where the second and third value is fixed.
Syntax:
select from table_name where column like '_[condition]%[condition]'
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: To find the particular record in the current table, we will use this syntax and query-
Syntax:
select * from employee where age like '%12%';
Step 4: The output is-
Summary:
Thus, we learned that wildcard operators are used to the find the values and also learn, it’s used in SQL.