当前位置:网站首页>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;
边栏推荐
猜你喜欢

Live preview | 30 minutes started quickly!Look at credible distributed AI chain oar architectural design

leetcode 15
ROS通信 —— 服务(Service)通信](/img/4d/4657f24bd7809abb4bdc4b418076f7.png)
[ROS](10)ROS通信 —— 服务(Service)通信

继承关系下构造方法的访问特点

Simple implementation of YOLOv7 pre-training model deployment based on OpenVINO toolkit

lua学习

Opening - Open a new .NET modern application development experience

多线程(2)

倒计时 2 天|云原生 Meetup 广州站,等你来!

js中try...catch和finally的用法
随机推荐
关于#sql shell#的问题,如何解决?
DAY22:sqli-labs 靶场通关wp(Less01~~Less20)
OpenGL 工作原理
2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
CPDA|运营人如何从负基础学会数据分析(SQL)
【日常训练】1403. 非递增顺序的最小子序列
Error: Not a signal or slot declaration
从零到一快速学会三子棋
汉字转拼音
the mechanism of ideology
VSCode Change Default Terminal how to modify the Default Terminal VSCode
1873. 计算特殊奖金
C学生管理系统 头添加学生节点
627. 变更性别
C student management system Find student nodes based on student ID
蚁剑高级模块开发
程序员的七夕浪漫时刻
Lexicon - the maximum depth of a binary tree
倒计时 2 天|云原生 Meetup 广州站,等你来!
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