SQL Tutorial

SQL LENGTH Function

To get the length of a string we can use SQL LENGTH or LEN function. The syntax is simple as follows:

	LENGTH(expression)
	LEN(expression)

Here is a query which gets the most longest name in employee table

SELECT MAX(LENGTH(name)) AS longest_name
FROM employees

Here is the output

longest_name
------------
           8
Read On