Skip to content

Commit e8a7216

Browse files
committed
task: #1667
1 parent 276016f commit e8a7216

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Have a good contributing!
6363
- [1581. Customer Who Visited but Did Not Make Any Transactions](./leetcode/easy/1581.%20Customer%20Who%20Visited%20but%20Did%20Not%20Make%20Any%20Transactions.sql)
6464
- [1587. Bank Account Summary II](./leetcode/easy/1587.%20Bank%20Account%20Summary%20II.sql)
6565
- [1633. Percentage of Users Attended a Contest](./leetcode/easy/1633.%20Percentage%20of%20Users%20Attended%20a%20Contest.sql)
66+
- [1667. Fix Names in a Table](./leetcode/easy/1667.%20Fix%20Names%20in%20a%20Table.sql)
6667
- [1683. Invalid Tweets](./leetcode/easy/1683.%20Invalid%20Tweets.sql)
6768
- [1693. Daily Leads and Partners](./leetcode/easy/1693.%20Daily%20Leads%20and%20Partners.sql)
6869
- [1729. Find Followers Count](./leetcode/easy/1729.%20Find%20Followers%20Count.sql)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Question 1667. Fix Names in a Table
3+
Link: https://leetcode.com/problems/fix-names-in-a-table/description/?envType=study-plan-v2&envId=top-sql-50
4+
5+
Table: Users
6+
7+
+----------------+---------+
8+
| Column Name | Type |
9+
+----------------+---------+
10+
| user_id | int |
11+
| name | varchar |
12+
+----------------+---------+
13+
user_id is the primary key (column with unique values) for this table.
14+
This table contains the ID and the name of the user. The name consists of only lowercase and uppercase characters.
15+
16+
17+
Write a solution to fix the names so that only the first character is uppercase and the rest are lowercase.
18+
19+
Return the result table ordered by user_id.
20+
*/
21+
22+
SELECT
23+
user_id,
24+
UPPER(SUBSTRING(name FROM 1 FOR 1)) || '' || LOWER(SUBSTRING(name FROM 2 FOR LENGTH(name))) AS name --noqa: RF04
25+
FROM Users
26+
ORDER BY user_id

0 commit comments

Comments
 (0)