Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法选择给定值是特定长度的数据库表行,例如,长度小于 5 个字符?
在 PHP 中,这将是strlen.
strlen
MySQL中有类似的东西吗?
SELECT * FROM table_name WHERE CHAR_LENGTH(column_name) < 5
LENGTH("my_string")返回字符串的长度(以字节为单位)
LENGTH("my_string")
SELECT * FROM table_name WHERE LENGTH(column_name) < 5
请记住,字符可以由多个字节组成,就像 UTF-8 中的字符一样。