Home » SQL Basics » Retrieving Data » Using Wildcards

Using Wildcards

Using Wildcards: Wildcards are used with the LIKE keyword in SQL.

Syntax: Example: Select “column_name1”, “column_name2″,….”column_nameZ” FROM “table_name” where name like ‘%”Characters”%’ Or ‘_”characters”_’

% (percent sign) represents zero, one, or more characters.

_ (underscore) represents exactly one character.

Example: Example: SELECT name, age FROM employee where name like ‘J%’ or ‘Smit_’

In the above example it only displays all employees whose name is Either starting with Character ‘J’ or Named Starts with Smit followed by one character like Smith or Smitt.

Leave a Reply

Your email address will not be published. Required fields are marked *