当前位置:网站首页>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;
边栏推荐
- C student management system Insert the student node at the specified location
- lua learning
- Dotnet 6 Why does the network request not follow the change of the system network proxy and dynamically switch the proxy?
- C语言日记 9 if的3种语句
- Error: Not a signal or slot declaration
- [ROS] (10) ROS Communication - Service Communication
- ".NET IoT from scratch" series
- HOG特征学习笔记
- [Decryption] Can the NFTs created by OpenSea for free appear in my wallet without being chained?
- Short domain name bypass and xss related knowledge
猜你喜欢
select tag custom style
HOG特征学习笔记
线上MySQL的自增id用尽怎么办?
基于左序遍历的数据存储实践
"Dilili, wait for the lights, wait for the lights", the prompt sound for safe production in the factory
C语言日记 9 if的3种语句
DAY22:sqli-labs 靶场通关wp(Less01~~Less20)
【genius_platform软件平台开发】第七十六讲:vs预处理器定义的牛逼写法!!!!(其他组牛逼conding人员告知这么配置来取消宏定义)
js中try...catch和finally的用法
Tree search (bintree)
随机推荐
【存储】曙光存储DS800-G35 ISCSI各映射LUN给服务器
select 标签自定义样式
关于#sql shell#的问题,如何解决?
SuperMap支持的国产环境汇总
如何看待自己的羞愧感
2022-08-04: Input: deduplicated array arr, the numbers in it only contain 0~9.limit, a number.Return: The maximum number that can be spelled out with arr if the requirement is smaller than limit.from
C student management system Find student nodes based on student ID
iNFTnews | What can NFTs bring to the sports industry and fans?
常见的硬件延迟
Optimizing the feed flow encountered obstacles, who helped Baidu break the "memory wall"?
leetcode-对称二叉树
云原生(三十二) | Kubernetes篇之平台存储系统介绍
重新审视分布式系统:永远不会有完美的一致性方案……
短域名绕过及xss相关知识
sql语句多字段多个值如何进行排序
Greenplum Database Fault Analysis - Can a Soft Connection Be Made to the Database Base Folder?
DAY23: Command Execution & Code Execution Vulnerability
View handler stepping record
C student management system Insert the student node at the specified location
The 2022 EdgeX China Challenge will be grandly opened on August 3