Skip to content

Commit dd56d01

Browse files
committed
task: #3374
1 parent 294fdb4 commit dd56d01

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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)
177177
3. [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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy