当前位置:网站首页>1667. 修复表中的名字
1667. 修复表中的名字
2022-08-05 02:32:00 【只是六号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连接字符串,对每条结果进行处理
concat(upper(left(name,1)),lower(substr(name,2))) as name
from
users
order by
user_id;
边栏推荐
猜你喜欢

QT语言文件制作

DAY23:命令执行&代码执行漏洞

使用SuperMap iDesktopX数据迁移工具迁移ArcGIS数据

【OpenCV 图像处理2】:OpenCV 基础知识

关于#sql shell#的问题,如何解决?
![02 [Development Server Resource Module]](/img/60/f77ed0bb0e5654c9dcd70b73a5bee8.png)
02 [Development Server Resource Module]

编译预处理等细节
![[ROS] (10) ROS Communication - Service Communication](/img/4d/4657f24bd7809abb4bdc4b418076f7.png)
[ROS] (10) ROS Communication - Service Communication

How do programmers without objects spend the Chinese Valentine's Day

使用SuperMap iDesktopX数据迁移工具迁移地图文档和符号
随机推荐
What should I do if the self-incrementing id of online MySQL is exhausted?
树表的查找
注意潍坊开具发票一般需要注意
hypervisor相关的知识点
[ROS] (10) ROS Communication - Service Communication
Quickly learn chess from zero to one
Greenplum Database Fault Analysis - Why Does gpstart -a Return Failure After Version Upgrade?
浅谈数据安全治理与隐私计算
matlab绘制用颜色表示模值大小的箭头图
leetcode 15
View handler stepping record
关于#sql shell#的问题,如何解决?
02 【开发服务器 资源模块】
树形查找(二叉查找树)
Solve connect: The requested address is not valid in its context
Unleashing the engine of technological innovation, Intel joins hands with ecological partners to promote the vigorous development of smart retail
"Dilili, wait for the lights, wait for the lights", the prompt sound for safe production in the factory
继承关系下构造方法的访问特点
select tag custom style
线性表的查找