File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ Useful for preparing for technical interviews and improving your SQL skills.
176176 - [ 3475. DNA Pattern Recognition] ( ./leetcode/medium/3475.%20DNA%20Pattern%20Recognition.sql )
1771773 . [ Hard] ( ./leetcode/hard/ )
178178 - [ 185. Department Top Three Salaries] ( ./leetcode/hard/185.%20Department%20Top%20Three%20Salaries.sql )
179+ - [ 3374. First Letter Capitalization II] ( ./leetcode/hard/3374.%20First%20Letter%20Capitalization%20II.sql )
179180
180181## Contributing
181182
Original file line number Diff line number Diff line change 1+ /*
2+ Question 3374. First Letter Capitalization II
3+ Link: https://leetcode.com/problems/first-letter-capitalization-ii/description/?envType=problem-list-v2&envId=database
4+
5+ Table: user_content
6+
7+ +-------------+---------+
8+ | Column Name | Type |
9+ +-------------+---------+
10+ | content_id | int |
11+ | content_text| varchar |
12+ +-------------+---------+
13+ content_id is the unique key for this table.
14+ Each row contains a unique ID and the corresponding text content.
15+ Write a solution to transform the text in the content_text column by applying the following rules:
16+
17+ Convert the first letter of each word to uppercase and the remaining letters to lowercase
18+ Special handling for words containing special characters:
19+ For words connected with a hyphen -, both parts should be capitalized (e.g., top-rated → Top-Rated)
20+ All other formatting and spacing should remain unchanged
21+ Return the result table that includes both the original content_text and the modified text following the above rules.
22+ */
23+
24+ -- The easiest solution :)
25+
26+ SELECT
27+ content_id,
28+ content_text AS original_text,
29+ INITCAP(content_text) AS converted_text
30+ FROM user_content
You can’t perform that action at this time.
0 commit comments