如何为以下场景编写带有正则表达式的查询。
id name
1 Müllere
2 Kees
3 Hernández
4 Björn
上面给出的是我的 MySQL 表。我想得到结果,名称包含重音字母且名称长度大于 5
试试这个查询:
Select * from test where Length(name) > '5' and name REGEXP '[accentedcharacters]+';
WHERE length(name) > 5 and name REGEXP '[accentedcharacters]+'
但是,我不确定重音字符的 mysql REGEXP
SELECT * FROM letters
+--------+
| letter |
+--------+
| ' |
| - |
| a |
| b |
| c |
| d |
| e |
| f |
| g |
| h |
| i |
| j |
| k |
| l |
| m |
| n |
| o |
| p |
| q |
| r |
| s |
| t |
| u |
| v |
| w |
| x |
| y |
| z |
| å |
| ä |
| ö |
| ÿ |
+--------+
SELECT *
FROM letters
WHERE letter NOT REGEXP '[a-z\'|A-Z\-]';
+--------+
| letter |
+--------+
| å |
| ä |
| ö |
| ÿ |
+--------+