- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we retrieve the length of a specified string in MySQL?
CHAR_LENGTH() or CHARACTER_LENGTH() string functions in MySQL are used to retrieve the length of a specified string. This function will simply count the number of characters and ignores whether the characters are of single-byte or multi-byte.
Example
mysql> Select CHAR_LENGTH('New Delhi'); +--------------------------+ | CHAR_LENGTH('New Delhi') | +--------------------------+ | 9 | +--------------------------+ 1 row in set (0.00 sec) mysql> Select CHAR_LENGTH('NewDelhi'); +-------------------------+ | CHAR_LENGTH('NewDelhi') | +-------------------------+ | 8 | +-------------------------+ 1 row in set (0.00 sec) mysql> Select CHARACTER_LENGTH('NewDelhi'); +------------------------------+ | CHARACTER_LENGTH('NewDelhi') | +------------------------------+ | 8 | +------------------------------+ 1 row in set (0.00 sec) mysql> Select CHARACTER_LENGTH('New Delhi'); +-------------------------------+ | CHARACTER_LENGTH('New Delhi') | +-------------------------------+ | 9 | +-------------------------------+ 1 row in set (0.00 sec)
- Related Articles
- How can we retrieve the output having decimal values of a column in a specified format?
- In MySQL, how can we insert a substring at the specified position in a string?
- In MySQL, how can we check whether a string of a specified pattern is not present within another string?
- How to retrieve the system’s reference to the specified String in C#?
- In MySQL, how can we pad a string with another string?
- How can you retrieve a particular number of records from a table starting from some specified row number in Python MySQL?
- In MySQL, how can we display time in other format specified by the user?
- How can we retrieve time from a table in JDBC?
- In MySQL, how can we display the date in other format specified by the user?
- How can we extract a substring from a string in MySQL?
- How can we reverse a MySQL string connected by the dash?
- Generating random string of specified length in JavaScript
- How can I store the fixed length string as well as variable length string in the same MySQL table?
- Limiting string up to a specified length in JavaScript
- In MySQL, how we can get the corresponding string representation of the binary value of a number?

Advertisements