Is there any function like "strlen" in mysql?
To query for string fields with a specific length, use the char_length() or length() from MySQL.
LEN() function calculates the number of characters of an input string, excluding the trailing spaces. It is an expression that can be a constant, variable, or column of either character or binary data. Returns : It returns the number of characters of an input string, excluding the trailing spaces.
The answer is YES, you can use LEN like above.
(SELECT min(len(<string_column>)) FROM<table_name> ) ; Example : SELECT TOP 1 * FROM friends WHERE len(firstName) = (SELECT min(len(firstName)) FROM friends);
Mysql does have a length function to return the length of a string.
so you could do something like.
select * from some_table where length(some_string) > 0;
You can do it with using LENGTH
keyword
SELECT * FROM table WHERE LENGTH (name) > 150;
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