Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

LENGTH

Example

Provide the size of the string in bytes.

SELECT LENGTH(“SQL Tutorial”) AS LengthOfString; 

Definition and Usage

The LENGTH() function gives you the size of a string, measured in bytes.

Syntax

LENGTH(string)

Parameter Values

Parameter

Description

string

Input required: The string for which to determine the length.

Technical Details

Works in: From MySQL 4.0

More Examples

Example

Retrieve the byte length of the text in the “CustomerName” column.

SELECT LENGTH(CustomerName) AS LengthOfName
FROM Customers;