1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (English)/修复表中的名字(English) [fix-names-in-a-table].html

42 lines
1006 B
HTML
Raw Normal View History

2022-03-27 20:45:09 +08:00
<p>Table: <code>Users</code></p>
<pre>
+----------------+---------+
| Column Name | Type |
+----------------+---------+
| user_id | int |
| name | varchar |
+----------------+---------+
user_id is the primary key for this table.
This table contains the ID and the name of the user. The name consists of only lowercase and uppercase characters.
</pre>
<p>&nbsp;</p>
<p>Write an SQL query to fix the names so that only the first character is uppercase and the rest are lowercase.</p>
<p>Return the result table ordered by <code>user_id</code>.</p>
<p>The query result format is in the following example.</p>
<p>&nbsp;</p>
<p><strong>Example 1:</strong></p>
<pre>
<strong>Input:</strong>
Users table:
+---------+-------+
| user_id | name |
+---------+-------+
| 1 | aLice |
| 2 | bOB |
+---------+-------+
<strong>Output:</strong>
+---------+-------+
| user_id | name |
+---------+-------+
| 1 | Alice |
| 2 | Bob |
+---------+-------+
</pre>