Operator Table
Operator | Description |
---|---|
% | It is used in substitute of zero or more characters. |
_ | It is used as a substitute for one character. |
– | It is used to substitute a range of characters. |
[range_of_characters] | It is used to fetch a matching set or range of characters specified inside the brackets. |
Syntax
SELECT column1,column2 FROM table_name
WHERE column LIKE wildcard_operator;
column1,column2: fields in the table
table_name: name of the table
column: name of the field used for filtering data
CREATE Table Customer
CREATE TABLE Customer(
CustomerID INT PRIMARY KEY,
CustomerName VARCHAR(50),
LastName VARCHAR(50),
Country VARCHAR(50),
Age int(2),
Phone int(10)
);
-- Insert some sample data into the Customers table
INSERT INTO Customer (CustomerID, CustomerName, LastName, Country, Age, Phone)
VALUES (1, 'Shubham', 'Thakur', 'India','23','9125368745'),
(2, 'Aman ', 'Chopra', 'Australia','21','9632784152'),
(3, 'Naveen', 'Tulasi', 'Sri lanka','24','8965741538'),
(4, 'Aditya', 'Arpan', 'Austria','21','9874589736'),
(5, 'Nishant. Salchichas S.A.', 'Jain', 'Spain','22','8754128965');
Select * from Customer;
Output
SQL | Wildcard operators
Wildcard operators are used with the LIKE operator, which is generally used to search the data in the database and there are four basic operators %, _,-,[range_of_chracters]. Let us explain all these operators in brief –
Contact Us