当前位置:网站首页>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;
边栏推荐
- 解决端口占用问题 Port xxxx was already in use
- Error: Not a signal or slot declaration
- 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
- DAY22:sqli-labs 靶场通关wp(Less01~~Less20)
- select tag custom style
- Opening - Open a new .NET modern application development experience
- Live preview | 30 minutes started quickly!Look at credible distributed AI chain oar architectural design
- 行业案例|世界 500 强险企如何建设指标驱动的经营分析系统
- Semi-Decentralized Federated Learning for Cooperative D2D Local Model Aggregation
- Gantt chart is here, project management artifact, template is used directly
猜你喜欢
The 20th day of the special assault version of the sword offer
正则表达式,匹配中间的某一段字符串
[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)
Pisanix v0.2.0 发布|新增动态读写分离支持
云原生(三十二) | Kubernetes篇之平台存储系统介绍
select 标签自定义样式
LeetCode使用最小花费爬楼梯----dp问题
sql语句多字段多个值如何进行排序
C language diary 9 3 kinds of statements of if
使用SuperMap iDesktopX数据迁移工具迁移ArcGIS数据
随机推荐
lua学习
torch.roll()
leetcode-另一棵树的子树
KingbaseES V8 GIS data migration solution (2. Introduction to the capabilities of Kingbase GIS)
View handler 踩坑记录
继承关系下构造方法的访问特点
22-07-31周总结
Chinese characters to Pinyin
汉字转拼音
Matlab画图3
The 2022 EdgeX China Challenge will be grandly opened on August 3
【LeetCode刷题】-数之和专题(待补充更多题目)
Error: Not a signal or slot declaration
如何逐步执行数据风险评估
Introduction to SDC
nodeJs--encapsulate routing
基于左序遍历的数据存储实践
使用SuperMap iDesktopX数据迁移工具迁移地图文档和符号
[ROS] (10) ROS Communication - Service Communication
Snapback - same tree