Subject | Why does LIKE uses '%' as a wildcard |
---|---|
Author | Scott Morgan |
Post date | 2011-07-29T15:12:40Z |
Just an idle question for the weekend, perhaps one for the old hands.
Been wondering why the LIKE statement uses '%' as the wildcard character
rather than more common '*' (familiar in file globbing and regex). A bit
of googling doesn't turn up much.
I could understand that it may pre-date the '*' convention and whoever
picked it just went with the first ASCII char they thought of, but it
seems odd if you consider that you can use '*' in SELECT statements as a
kind of 'field-wildcard', why not 'SELECT % FROM ...'?
Anybody else been kept up at night with this pointless question? :)
Scott
Been wondering why the LIKE statement uses '%' as the wildcard character
rather than more common '*' (familiar in file globbing and regex). A bit
of googling doesn't turn up much.
I could understand that it may pre-date the '*' convention and whoever
picked it just went with the first ASCII char they thought of, but it
seems odd if you consider that you can use '*' in SELECT statements as a
kind of 'field-wildcard', why not 'SELECT % FROM ...'?
Anybody else been kept up at night with this pointless question? :)
Scott