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?
Well, you can use the LEN() function to find the length of a String value in SQL Server, for example, LEN(emp_name) will give you the length of values stored in the column emp_name.
MySQL LENGTH() Function The LENGTH() function returns the length of a string (in bytes).
SELECT * FROM table_name WHERE CHAR_LENGTH(column_name) < 5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With