Fix Names in a Table
EasyLeetCodeSQL: CASE, String & Date Functions
Hint and exampleShowHide
Split the text into its first character and the rest with LEFT and SUBSTRING, change the case of each part, and join them with CONCAT.
Example: cities(id, city)
id | city
1 | pUNE
2 | delhi
SELECT id,
CONCAT(UPPER(LEFT(city, 1)), LOWER(SUBSTRING(city, 2))) AS city
FROM cities
ORDER BY id; -- 1 | Pune, 2 | Delhi
More in SQL: CASE, String & Date Functions
| # | Problem | Platform | Difficulty | Open | 1st1st Visit | 2nd2nd Visit | RevRevise |
|---|---|---|---|---|---|---|---|
| 1 | Triangle Judgement | LeetCode | Easy | Solve Triangle Judgement on LeetCode (opens in a new tab) | |||
| 2 | Fix Names in a Table | LeetCode | Easy | Solve Fix Names in a Table on LeetCode (opens in a new tab) | |||
| 3 | Rising Temperature | LeetCode | Easy | Solve Rising Temperature on LeetCode (opens in a new tab) | |||
| 4 | Group Sold Products By The Date | LeetCode | Easy | Solve Group Sold Products By The Date on LeetCode (opens in a new tab) | |||
| 5 | Monthly Transactions I | LeetCode | Medium | Solve Monthly Transactions I on LeetCode (opens in a new tab) | |||
| 6 | Confirmation Rate | LeetCode | Medium | Solve Confirmation Rate on LeetCode (opens in a new tab) |