Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
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;