P
PRO
last month
Padmacountry asked

Can we use wildcards without the WHERE clause?

Kelish Rai
Expert
last month
Kelish Rai answered

In SQL, wildcards like % and _ are mainly used with the LIKE operator inside a WHERE clause to perform pattern matching and filter results.

Without the WHERE clause, wildcards don't really have any effect—because there's no condition to apply them to. Their purpose is to match values against a pattern, and that only happens when you're telling SQL what to search for.

For example:

SELECT * FROM customers
WHERE name LIKE 'A%';

This query returns all customers whose names start with the letter "A". The % wildcard matches any number of characters after "A".

Without the WHERE clause:

SELECT * FROM customers;

You're simply selecting everything—no pattern-matching is happening here, even if wildcards exist elsewhere (e.g., in a computed column or subquery, but those are more advanced cases).

So, to answer simply: wildcards are useful only when combined with LIKE (or sometimes NOT LIKE) inside a WHERE clause, where they serve their purpose of filtering based on patterns.

SQL
This question was asked as part of the Learn SQL Basics course.