当前位置:网站首页>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;
边栏推荐
- Regular expression to match a certain string in the middle
- 蚁剑高级模块开发
- DAY22:sqli-labs 靶场通关wp(Less01~~Less20)
- KingbaseES V8 GIS data migration solution (2. Introduction to the capabilities of Kingbase GIS)
- 程序员失眠时的数羊列表 | 每日趣闻
- 云原生(三十二) | Kubernetes篇之平台存储系统介绍
- 02 [Development Server Resource Module]
- shell statement to modify txt file or sh file
- leetcode-另一棵树的子树
- 树表的查找
猜你喜欢

VSCode Change Default Terminal 如何修改vscode的默认terminal

KingbaseES V8 GIS data migration solution (2. Introduction to the capabilities of Kingbase GIS)

线性表的查找

Compressed storage of special matrices

蚁剑高级模块开发

使用SuperMap iDesktopX数据迁移工具迁移地图文档和符号

云原生(三十二) | Kubernetes篇之平台存储系统介绍

Using OpenVINO to implement the flying paddle version of the PGNet inference program

LPQ (local phase quantization) study notes

【MySQL系列】- LIKE查询 以%开头一定会让索引失效吗
随机推荐
Industry case | insurance companies of the world's top 500 construction standards can be used to drive the business analysis system
【MySQL series】- Does LIKE query start with % will make the index invalid?
关于#sql shell#的问题,如何解决?
VSCode Change Default Terminal 如何修改vscode的默认terminal
C language implements a simple number guessing game
hypervisor相关的知识点
C student management system Find student nodes based on student ID
iNFTnews | What can NFTs bring to the sports industry and fans?
Error: Not a signal or slot declaration
DAY23:命令执行&代码执行漏洞
2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
编译预处理等细节
从零到一快速学会三子棋
云原生(三十二) | Kubernetes篇之平台存储系统介绍
[深入研究4G/5G/6G专题-51]: URLLC-16-《3GPP URLLC相关协议、规范、技术原理深度解读》-11-高可靠性技术-2-链路自适应增强(根据无线链路状态动态选择高可靠性MCS)
1484. 按日期分组销售产品
LPQ(局部相位量化)学习笔记
Flink 1.15.1 集群搭建(StandaloneSession)
Using OpenVINO to implement the flying paddle version of the PGNet inference program
意识形态的机制