当前位置:网站首页>1667. Fix names in tables
1667. Fix names in tables
2022-08-05 02:33:00 【Only 6 z】
前言
表: Users
+----------------+---------+
| Column Name | Type |
+----------------+---------+
| user_id | int |
| name | varchar |
+----------------+---------+
user_id 是该表的主键.
该表包含用户的 ID 和名字.名字仅由小写和大写字符组成.
来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/fix-names-in-a-table
著作权归领扣网络所有.商业转载请联系官方授权,非商业转载请注明出处.
编写一个 SQL 查询来修复名字,使得只有第一个字符是大写的,其余都是小写的.
返回按 user_id 排序的结果表.
查询结果格式示例如下.
示例 1:
输入:
Users table:
+---------+-------+
| user_id | name |
+---------+-------+
| 1 | aLice |
| 2 | bOB |
+---------+-------+
输出:
+---------+-------+
| user_id | name |
+---------+-------+
| 1 | Alice |
| 2 | Bob |
+---------+-------+
concat
select
user_id,
// 使用concat连接字符串,process each result
concat(upper(left(name,1)),lower(substr(name,2))) as name
from
users
order by
user_id;
边栏推荐
- Semi-Decentralized Federated Learning for Cooperative D2D Local Model Aggregation
- [In-depth study of 4G/5G/6G topic-51]: URLLC-16-"3GPP URLLC related protocols, specifications, and technical principles in-depth interpretation"-11-High reliability technology-2-Link adaptive enhancem
- 解决端口占用问题 Port xxxx was already in use
- select tag custom style
- 重新审视分布式系统:永远不会有完美的一致性方案……
- DAY23:命令执行&代码执行漏洞
- 基于左序遍历的数据存储实践
- Introduction to SDC
- View handler 踩坑记录
- 1667. 修复表中的名字
猜你喜欢
How to simply implement the quantization and compression of the model based on the OpenVINO POT tool
The design idea of DMicro, the Go microservice development framework
VSCode Change Default Terminal 如何修改vscode的默认terminal
正则表达式,匹配中间的某一段字符串
01 [Foreword Basic Use Core Concepts]
Regular expression to match a certain string in the middle
Data storage practice based on left-order traversal
02 [Development Server Resource Module]
甘特图来啦,项目管理神器,模板直接用
lua学习
随机推荐
网络安全与元宇宙:找出薄弱环节
【genius_platform软件平台开发】第七十六讲:vs预处理器定义的牛逼写法!!!!(其他组牛逼conding人员告知这么配置来取消宏定义)
百日刷题计划 ———— DAY2
力扣-相同的树
1873. 计算特殊奖金
OpenGL 工作原理
View handler stepping record
Data to enhance Mixup principle and code reading
2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
How to simply implement the quantization and compression of the model based on the OpenVINO POT tool
C学生管理系统 指定位置插入学生节点
甘特图来啦,项目管理神器,模板直接用
Error: Not a signal or slot declaration
The design idea of DMicro, the Go microservice development framework
Advanced Numbers_Review_Chapter 1: Functions, Limits, Continuity
从零到一快速学会三子棋
继承关系下构造方法的访问特点
[ROS] (10) ROS Communication - Service Communication
How OpenGL works
1873. The special bonus calculation