-
1667. Fix Names in a Table oracleLeetCode_Study_Plan/SQL 2022. 9. 27. 12:34
https://leetcode.com/problems/fix-names-in-a-table/
Fix Names in a Table - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
select user_id, initcap(name) as name from users order by user_id;
SQL 문법 참고 : https://1day1code.tistory.com/entry/SQL-%EB%AC%B8%EC%9E%90-%ED%95%A8%EC%88%98-LOWER-UPPER-INITCAP
[SQL] 문자 함수 (LOWER/ UPPER/ INITCAP/ CONCAT/ SUBSTR/ LENGTH/ INSTR/ LPAD/ RPAD/ REPLACE/ TRIM)
1. LOWER ※ dual 은 문법을 맞춰주기 위한 더미 테이블 (가짜 테이블) 이다. select lower ( 'SOON TOFU' ) from dual; -- 결과 : soon tofu lower 은 영문자 값을 소문자로 변환한다. 2. UPPER se..
1day1code.tistory.com
MySQL에는 initcap이란 문법이 없길래 어떻게 하나 찾아봤다.
select user_id, concat(upper(left(name, 1)), lower(right(name, length(name) - 1))) as name from Users group by 1 order by 1;
출처 :
https://medium.com/jen-li-chen-in-data-science/leetcode-sql-9aa7dab0f56b
Leetcode SQL
1667. Fix Names in a Table
medium.com
'LeetCode_Study_Plan > SQL' 카테고리의 다른 글
1527. Patients With a Condition mysql (0) 2022.09.27 1484. Group Sold Products By The Date mysql (0) 2022.09.27 196. Delete Duplicate Emails mysql (0) 2022.09.26 627. Swap Salary mysql (0) 2022.09.26 1873. Calculate Special Bonus mysql (0) 2022.09.26