In my database application I'm intending to give the users simple glob pattern search possibility besides standard search of text literal. (Let's not mention other search options to keep this question simple.)
They will be able to use wildcards *
, ?
and [
...]
for character matching. Jo*n
will match John
, Jon
or Johann
. Such an entered pattern will be converted to LIKE for T-SQL queries, to RLIKE in MariaDB queries and to VB.NET Like or C# LikeString() invocation for in-memory search.
Is it OK to lead users to get familiar with wildcard characters *
and ?
if these (used in SQL-89) were abandoned since SQL-92 standard in favor of %
and _
?.
Honestly, I think that for non-advanced users, *
and ?
suit better than %
and _
because:
- users know them from OS file masks
- they appear in data less often than
%
and_
, so there is lesser need to deal with escaping them - they are better indicating their wildcard nature than
%
and_
which are a bit ambiguous (50%
can confuse inexperienced users to think it is a literal) - they are somewhat easier to type because
*
is directly available at key * on numeric pad, while all others need pressing Shift.
Are there any real reasons why I should favorize %
and _
? If SQL-92 switched to them, perhaps they had some reasons.
*
and?
are now treated as regular characters except of some non-standard database engines like Jet which powers Microsoft Access.*
or?
while searching. If those options aren't going to do anything, then why should those be used?