当前位置:网站首页>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;
边栏推荐
- Cloud Native (32) | Introduction to Platform Storage System in Kubernetes
- [Fortune-telling-60]: "The Soldier, the Tricky Way"-2-Interpretation of Sun Tzu's Art of War
- the mechanism of ideology
- Opening - Open a new .NET modern application development experience
- 2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
- 02 [Development Server Resource Module]
- 浅谈数据安全治理与隐私计算
- select tag custom style
- Programmer's Tanabata Romantic Moment
- C student management system Find student nodes based on student ID
猜你喜欢
多线程(2)
LeetCode使用最小花费爬楼梯----dp问题
shell statement to modify txt file or sh file
VSCode Change Default Terminal 如何修改vscode的默认terminal
[ROS](10)ROS通信 —— 服务(Service)通信
[ROS] (10) ROS Communication - Service Communication
[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)
J9数字货币论:web3的创作者经济是什么?
2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。
Optimizing the feed flow encountered obstacles, who helped Baidu break the "memory wall"?
随机推荐
Error: Not a signal or slot declaration
[Decryption] Can the NFTs created by OpenSea for free appear in my wallet without being chained?
Error: Not a signal or slot declaration
倒计时 2 天|云原生 Meetup 广州站,等你来!
继承关系下构造方法的访问特点
Quickly learn chess from zero to one
使用SuperMap iDesktopX数据迁移工具迁移ArcGIS数据
北斗三号短报文终端露天矿山高边坡监测方案
[机缘参悟-60]:《兵者,诡道也》-2-孙子兵法解读
重新审视分布式系统:永远不会有完美的一致性方案……
dmp(dump)转储文件
How to deal with your own shame
从零到一快速学会三子棋
【OpenCV 图像处理2】:OpenCV 基础知识
Solve connect: The requested address is not valid in its context
VSCode Change Default Terminal 如何修改vscode的默认terminal
Unleashing the engine of technological innovation, Intel joins hands with ecological partners to promote the vigorous development of smart retail
STM32使用stm32cubemx LL库系列教程
627. Change of gender
select 标签自定义样式