mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	add scripts and problemset
This commit is contained in:
		
							
								
								
									
										41
									
								
								算法题/fix-names-in-a-table.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								算法题/fix-names-in-a-table.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
<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> </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> </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>
 | 
			
		||||
		Reference in New Issue
	
	Block a user