Knowledge Walls
John Peter
Pune, Maharashtra, India
Uppercase first letter(ucfirst) in mysql with example
60863 Views
ucfirst function is defined to change first letter of the sentence to upper case letter and remains other letter's are same as from orginal string.
Ucfirst() method definition
DROP FUNCTION IF EXISTS ucfirst;

DELIMITER $$
CREATE FUNCTION ucfirst(str_value VARCHAR(5000))
RETURNS VARCHAR(5000)
DETERMINISTIC
BEGIN
    RETURN CONCAT(UCASE(LEFT(str_value, 1)),SUBSTRING(str_value, 2));
END
$$
Example 
SELECT ucfirst("example");
SELECT ucfirst("NAME OF FATHER");
SELECT ucfirst("mother");

Output
Example
NAME OF FATHER
Mother
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details