当前位置:网站首页>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;
边栏推荐
- [深入研究4G/5G/6G专题-51]: URLLC-16-《3GPP URLLC相关协议、规范、技术原理深度解读》-11-高可靠性技术-2-链路自适应增强(根据无线链路状态动态选择高可靠性MCS)
- STM32使用stm32cubemx LL库系列教程
- C language implements a simple number guessing game
- 浅谈数据安全治理与隐私计算
- Dotnet 6 Why does the network request not follow the change of the system network proxy and dynamically switch the proxy?
- mysql tree structure query problem
- Hypervisor related knowledge points
- [LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)
- nodeJs--encapsulate routing
- 甘特图来啦,项目管理神器,模板直接用
猜你喜欢
随机推荐
the mechanism of ideology
2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。
继承关系下构造方法的访问特点
DAY23:命令执行&代码执行漏洞
View handler 踩坑记录
线上MySQL的自增id用尽怎么办?
关于#sql shell#的问题,如何解决?
Greenplum Database Fault Analysis - Why Does gpstart -a Return Failure After Version Upgrade?
Images using redis cache Linux master-slave synchronization server hard drive full of moved to the new directory which points to be modified
Greenplum Database Fault Analysis - Can a Soft Connection Be Made to the Database Base Folder?
post-study program
亚马逊云科技 + 英特尔 + 中科创达为行业客户构建 AIoT 平台
线性表的查找
01 【前言 基础使用 核心概念】
用@Mapper查询oracle的分区情况报错
QT语言文件制作
SDC简介
【LeetCode刷题】-数之和专题(待补充更多题目)
转:查尔斯·汉迪:你是谁,比你做什么更重要
力扣-二叉树的最大的深度
ROS通信 —— 服务(Service)通信](/img/4d/4657f24bd7809abb4bdc4b418076f7.png)








