Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Concatenation
Simple text functions
11. Function initcap
How to modify strings
Review

Instruction

Nice! Yet another function is initcap(), which will change the first letter of a text value to upper case and the rest to lower case. For instance, if someone mistakenly inserted another lastname with caps lock as 'sMITH', the query:

SELECT initcap(last_name) AS last_name_initcap
FROM copywriter;

will show 'Smith' for that last name. That's often a convenient way to show all names in the proper way.

The initcap() is only present in PostgreSQL and Oracle. It does not exist in MySQL and SQL Server.

Exercise

The boss wants you to update the names of all the items so that they start with a capital letter, followed by lowercase. Show the id of each item together with its old name (as old_name) and updated name (as new_name).

Stuck? Here's a hint!

Use initcap(name).