SELECT CHARACTER_LENGTH('Welcome to plus2net')
Output is 19
SELECT LENGTH(_utf8 '€'), CHARACTER_LENGTH(_utf8 '€')
Output is
3, 1
SELECT character_length(title) as no, title FROM `photo_img` where img_id=47
Without giving any where clause we can display the length of all the titles along with the title for the total table. Let us try to find out what are the titles using maximum space or the titles of maximum length. This will display records with maximum character in the title field. This we will manage by using sql order by clause. Check this query.
SELECT character_length(title) as no, title FROM `photo_img` order by no desc
SQL String References
SQL to get length of string
substring_index to get part of string using delimiter
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.