Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

MySQL 8.4 does not provide a built-in INITCAP()-style function. If you only need to capitalize the first character of each complete value, combine UPPER(), LEFT(), SUBSTRING(), and CONCAT(). Capitalizing every word is a different problem: you must define word boundaries and apply the transformation in application code or a custom stored routine.

MySQL’s documented string functions, including UPPER() and LOWER(), are described in the MySQL 8.4 string-functions reference.

Capitalize only the first character of the column value

For a column named name in a table named people, use:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
SELECT CONCAT(UPPER(LEFT(name, 1)), SUBSTRING(name, 2)) AS capitalized_name
FROM people;

For example, mARY jane becomes MARY jane. The expression changes only the first character; it does not identify or change later words.

Persist the result after previewing it

Preview the values first, protect any data that must remain unchanged, and then run the update:

UPDATE people
SET name = CONCAT(UPPER(LEFT(name, 1)), SUBSTRING(name, 2));

Use a restrictive WHERE clause when only some rows should change. This statement is a first-character transformation, not a title-case operation.

If you also want to lowercase the remainder

To normalize the rest of each value to lowercase, add LOWER() around the substring:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
SELECT CONCAT(UPPER(LEFT(name, 1)), LOWER(SUBSTRING(name, 2))) AS normalized_name
FROM people;

This turns mARY jane into Mary jane. It also changes intentional capitalization, so values such as acronyms, product names, and names with internal capitals may be damaged. Choose this form only when that normalization is wanted.

Rank #3
Sale
MySQL Cookbook
  • Used Book in Good Condition

Capitalize the first letter of every word

“Every word” requires a rule for what separates words. Spaces are one possibility; punctuation, hyphens, apostrophes, and other characters may also matter. UPPER() changes character case, but it does not find each word boundary for you.

Why INITCAP() is not a MySQL solution

PostgreSQL documents an initcap(text) function, but that is PostgreSQL behavior, not a MySQL built-in. PostgreSQL also notes that word splitting and results can vary with locale providers and ICU versions; see its string-functions documentation.

Choose the implementation location

Approach Best when Important decisions
Application code You control the import, form, or API that writes the value Define handling for spaces, punctuation, hyphens, apostrophes, Unicode, and whether the rest of each word is lowercased
Custom MySQL routine The transformation must run inside the database Implement and test the same boundary and Unicode rules explicitly before updating stored data
First-character SQL expression You need only the initial character of the entire value It does not capitalize subsequent words

For application-side processing, split the input according to your stated boundary rule, uppercase the first character of each resulting token, decide whether to lowercase the remaining characters, reassemble the value, and validate examples such as hyphenated names, apostrophes, multiple spaces, and acronyms. Store the transformed value only after reviewing representative output.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Character-set and binary-string considerations

UPPER() and LOWER() use the current character-set mapping. For Unicode collations, case conversion is related to the Unicode Collation Algorithm version associated with the collation. MySQL states that these functions are ineffective on binary strings such as BINARY, VARBINARY, and BLOB; convert binary data to an appropriate nonbinary character set before applying case conversion. These details are documented in the MySQL 8.4 string-functions reference.

For simple string functions such as UPPER(), the result normally keeps the principal input value’s character set and collation. Inspect an expression with:

SELECT
  CHARSET(UPPER(name))    AS result_charset,
  COLLATION(UPPER(name))  AS result_collation
FROM people
LIMIT 1;

The return-character-set rules are documented in the MySQL character-set and collation reference.

A safe workflow for changing stored names

  1. Define the desired result. Decide whether you mean one initial character or one initial per word, which separators count, and whether the rest of each word should be lowercased.
  2. Check the column type and encoding. Binary columns need conversion to a suitable nonbinary character set before case conversion.
  3. Preview a SELECT. Compare original and transformed values, including empty strings, NULLs, punctuation, acronyms, and non-ASCII text.
  4. Protect the original data. Back up the table or retain an unchanged source column when the capitalization rule is not reversible.
  5. Update narrowly. Apply the expression or routine with an appropriate WHERE clause, then verify the affected rows.
  6. Keep the rule at the write boundary. Applying the same tested normalization during ingestion prevents later cleanup jobs from repeatedly changing user-entered text.

Which expression should you use?

Requirement Expression or method Result
Uppercase only the first character CONCAT(UPPER(LEFT(name, 1)), SUBSTRING(name, 2)) Changes the first character and leaves the remainder as stored
Uppercase the first character and lowercase the remainder CONCAT(UPPER(LEFT(name, 1)), LOWER(SUBSTRING(name, 2))) Normalizes the remainder, potentially removing meaningful capitals
Uppercase the first character of every word Application code or a custom stored routine Requires explicit word-boundary and Unicode rules; no documented MySQL 8.4 built-in performs it automatically

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.