mysql length function

Rate this post


MySQL LENGTH() returns the length of a given string.


LENGTH (str)


Name      Description
str            A string whose length is to be returned.

Example of MySQL LENGTH() function

Result: NULL

mysql> SELECT LENGTH(”);
Result: 0

mysql> SELECT LENGTH(‘ ‘);
Result: 1

mysql> SELECT LENGTH(‘satya prakash’);
Result: 13

mysql> SELECT LENGTH(‘’);
Result: 15

Related Posts

  • 59
    Syntax: IF(expr,if_true_expr,if_false_expr) MySQL IF function is control flow functions that returns a value based on a condition. The IF function is sometimes referred to as IF ELSE or IF THEN ELSE function. If the expr evaluates to TRUE i.e., expr is not NULL and expr is not 0, the IF…
    Tags: function, select, mysql
  • 55
    MySQL LOCATE() returns the position of the first occurrence of a string within a string. Both of these strings are passed as arguments. An optional argument may be used to specify from which position of the string (i.e. string to be searched) searching will start. If this position is not…
    Tags: mysql, string, str, select, result, function
  • 54
    MySQL TRIM() function returns a string after removing all prefixes or suffixes from the given string. Syntax TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM ] str) Arguments Name Description BOTH Indicates that prefixes from both left and right are to be removed. LEADING Indicates that only leading prefixes are to…
    Tags: string, mysql, str, function, select, description
  • 53
    MySQL has a RAND function that can be invoked to produce random numbers between 0 and 1: mysql> SELECT RAND( ), RAND( ), RAND( ); +------------------+-----------------+------------------+ | 0.45464584925645 | 0.1824410643265 | 0.54826780459682 | +------------------+-----------------+------------------+ 1 row in set (0.00 sec) When invoked with an integer argument, RAND( ) uses that…
    Tags: mysql, select, function, string
  • 50
    MySQL SUBSTRING() returns a specified number of characters from a particular position of a given string. Syntax: SUBSTRING(str, pos, len) or SUBSTRING(str FROM pos FOR len) Arguments Name       Description str              A string. pos             Starting position.…
    Tags: mysql, select, len, function, string

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: