Format College Names
You are working for a national education portal that aggregates data from various colleges across India. The college names are entered inconsistently, with mixed cases. Your task is to standardize these names.
Tables:
colleges:college_id(integer, PK),college_name(varchar(100))
Return the college_name for all colleges, formatted such that the first letter of each word is capitalized and the rest are lowercase. The result should be ordered by college_id.
Handle NULLs by returning NULL. Empty results are possible if the table is empty. Ties in ordering are broken by college_id.
Tables
CREATE TABLE colleges ( college_id integer PRIMARY KEY, college_name varchar(100) );
Example data
INSERT INTO colleges (college_id, college_name) VALUES (1, 'indian institute of technology'), (2, 'DELHI UNIVERSITY'), (3, 'National law school of india university'), (4, 'iit bombay'), (5, 'BITS Pilani');
Your query is also checked on hidden datasets with different data.
Hints
-- Write your query here
SELECT
Your query runs on the example tables shown with the problem, then on hidden datasets when you submit.
Write standard SQL. MySQL habits work too: IFNULL, IF, YEAR(), DATE_FORMAT, GROUP_CONCAT, `backticks` and LIMIT 5, 10. It runs on PostgreSQL, so integer division keeps whole numbers (5 / 2 = 2): write 5.0 / 2 for 2.5.