1667. 修复表中的名字
https://leetcode.cn/problems/fix-names-in-a-table/
CONCAT() 函数,CONCAT 可以将多个字符串拼接在一起。
1. LEFT(str, length) 函数
从左开始截取字符串,length 是截取的长度。
2. UPPER(str) 与 LOWER(str)
UPPER(str) 将字符串中所有字符转为大写
LOWER(str) 将字符串中所有字符转为小写
3. SUBSTRING(str, begin, end)
截取字符串,end 不写默认为空。
SUBSTRING(name, 2) 从第二个截取到末尾,注意并不是下标,就是第二个。
# CONCAT 用来拼接字符串
● LEFT 从左边截取字符
扫描二维码关注公众号,回复:
16177745 查看本文章
● RIGHT 从右边截取字符
● UPPER 变为大写
● LOWER 变为小写
● LENGTH 获取字符串长度
select user_id,
concat(upper(left(name,1)),lower(substr(name,2)))
as name
from Users
order by user_id;