Will the following query evaluate to true (1), false (0), or NULL? SELECT '%' LIKE ' % ';
提供的答案是MySQL的比較和 '%'
The '%' character is matched by '%', but not by the space characters surrounding it, so the expression evaluates to false. +----------------+ | '%' LIKE ' % ' | +----------------+ | 0 | +----------------+
但我以爲%可匹配零以上字符?所以%可以匹配%+ Spaces?或者字符是否包含通配符?
UPDATE:
哦,但如果發生了比較其他方式ARND這是真的...嗯...
SELECT ' % ' LIKE '%';
Any non-NULL string is matched by the '%' metacharacter, so the expression evaluates to true. +----------------+ | ' % ' LIKE '%' | +----------------+ | 1 | +----------------+