이름의 첫 글자는 대문자로, 나머지는 소문자로 바꿔보자.
첫글자를 지정하는데 left, 대문자를 지정하는데 upper를 사용하고 그 외 글자는 substring과 lower을 사용한다. 두 덩어리를 합치는데 concat을 사용한다.
substring은 SUBSTRING(글자, 시작위치, 길이) 으로 나타내고, 시작위치는 1부터 시작한다. 이 경우에는 두번째 글자부터 긁어오기 때문에 2라고 넣었다.
select user_id, concat( upper(left(name,1)),
lower(SUBSTRING(name,2)) ) as name
from users
order by user_id;
'learning > SQL' 카테고리의 다른 글
[LeetCode 1393] Capital Gain/Loss (0) | 2023.01.29 |
---|---|
[LeetCode 176] Second Highest Salary (0) | 2023.01.29 |
[LeetCode 1527] Patients With a Condition (0) | 2023.01.28 |
[LeetCode 608] Tree Node (0) | 2023.01.28 |
[LeetCode 1965] Employees With Missing Information (0) | 2023.01.28 |
댓글