SQL Length Function |
SQL > SQL String Functions >
Length Function
The Length function in SQL is used to get the length of a string. This function has a different name for different databases:
SyntaxThe syntax for the Length function is as follows: Length (str)
The length of the string str is returned. ExamplesWe use the following table for our examples. Table Geography
Example 1SELECT Length (Store_Name)
FROM Geography WHERE Store_Name = 'Los Angeles'; Result:
Example 2SELECT Region_Name, Length (Region_Name)
FROM Geography; Result:
|