mySql  length function

the mysql length function is used to get the length of the string in bytes and in characters.

mysql length() function syntax

         select    length(string_exp)    from   table_name;

demo database table use in the below mysql length function example

below is a selection from the "users" table:

useridfirstnamelastnamesalarybonus
1sandeepkumar10,0001000
2ankitkumar20,0002000
3ramnehra30,0003000
4vikashnehra12,0002000

mysql length function example

               
    select    length('name');

output : try it yourself