Search code examples
mysqlstringstring-length

Select rows from database by strlen


Is there a way to select database table rows where a given value is a certain length, for example, less than 5 chars long?

In PHP that would be strlen.

Is there anything similar in MySQL?


Solution

  • SELECT * FROM table_name WHERE CHAR_LENGTH(column_name) < 5