进行OR匹配
SELECT prod_name FROM products WHRER prod_name REGEXP '1000|2000' ORDER BY prod_name;
匹配几个字符之一
SELECT prod_name FROM products WHERE produ_name REGEXP '[123] Ton' ORDER BY prod_name;
匹配特殊字符
SELECT vend_name FROM vendors WHERE vend_name REGEXP '.' ORDER BY vend_name;
转义
SELECT vend_name FROM vendors WHERE vend_name REGEXP '\\.' ORDER BY vend_name;
匹配多个实例
SELECT prod_name FROM products WHERE prod_name REGEXP '[[:digit:]]{4}' ORDER BY prod_name;
定位符
SELECT prod_name FROM products WHERE prod_name REGEXP '^[0-9\\.]';
拼接字段
Concat()
SELECT Concat (vend_name , '(',vend_country,')' FROM vendors ORDER BY vend_name;
网友评论